This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"timeZone": "America/New_York", | |
"exceptionLogging": "STACKDRIVER", | |
"runtimeVersion": "V8", | |
"addOns": { | |
"common": { | |
"name": "MY COOL APP", | |
"logoUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/9/97/Wikipedia-logo-gv_%281%29.png/196px-Wikipedia-logo-gv_%281%29.png", | |
"useLocaleFromApp": true, | |
"homepageTrigger": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class YourCustomFRagment( | |
var backPressedListener: OnFragmentCallback | |
) : Fragment(R.layout.xyz) { | |
override fun onCreateView() {} | |
// trigger the event! | |
override fun onDestroy() { | |
backPressedListener.onFragmentBackPressed() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onCreate(savedInstanceState: Bundle?) { | |
showFragment() | |
} | |
// callback listener | |
private val fragmentBackPressedListener = object : OnFragmentCallback { | |
override fun onFragmentBackPressed() { | |
foo() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface OnFragmentCallbackListener.kt { | |
fun onFragmentBackPressed() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private inner class ConnectedThread(private val mmSocket: BluetoothSocket) : Thread() { | |
private val mmInStream: InputStream = mmSocket.inputStream | |
private val mmOutStream: OutputStream = mmSocket.outputStream | |
private val mmBuffer: ByteArray = ByteArray(1024) // mmBuffer store for the stream | |
override fun run() { | |
var numBytes: Int // bytes returned from read() | |
// Keep listening to the InputStream until an exception occurs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Class used for the client Binder. | |
*/ | |
inner class LocalBinder : Binder() { | |
/** | |
* Enable the discovery, registering a broadcastreceiver {@link discoveryBroadcastReceiver} | |
* The discovery filter by LABELER_SERVER_TOKEN_NAME | |
*/ | |
public fun startDiscovery(context: Context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BluetoothSDKService : Service() { | |
// Service Binder | |
private val binder = LocalBinder() | |
// Bluetooth stuff | |
private lateinit var bluetoothAdapter: BluetoothAdapter | |
private lateinit var pairedDevices: MutableSet<BluetoothDevice> | |
private var connectedDevice: BluetoothDevice? = null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CoolFragment() : BottomSheetDialogFragment() { | |
private lateinit var mService: BluetoothSDKService | |
private lateinit var binding: FragmentPopupDiscoveredLabelerDeviceBinding | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
} | |
override fun onCreateView( | |
inflater: LayoutInflater, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BluetoothSDKListenerHelper { | |
companion object { | |
private var mBluetoothSDKBroadcastReceiver: BluetoothSDKBroadcastReceiver? = null | |
class BluetoothSDKBroadcastReceiver : BroadcastReceiver() { | |
private var mGlobalListener: IBluetoothSDKListener? = null | |
public fun setBluetoothSDKListener(listener: IBluetoothSDKListener) { | |
mGlobalListener = listener |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IBluetoothSDKListener { | |
/** | |
* from action BluetoothUtils.ACTION_DISCOVERY_STARTED | |
*/ | |
fun onDiscoveryStarted() | |
/** | |
* from action BluetoothUtils.ACTION_DISCOVERY_STOPPED | |
*/ | |
fun onDiscoveryStopped() |