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
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
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
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
{ | |
"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
/** | |
* Callback for rendering the homepage card. | |
* @return The card to show to the user. | |
*/ | |
function onHomepage(e) { | |
return createHomeCard(); | |
} | |
/** | |
* Build the home card |
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
const txtInsertId = | |
CardService.newTextParagraph().setText("<b>Bold text</b><br/> -Can you read this?"); | |
const textInput = CardService.newTextInput() | |
.setFieldName("txt_input_id_to_process") | |
.setTitle("Write something here..."); | |
const ico = CardService.newIconImage().setIconUrl( | |
"ico link" | |
); |
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
function createHomeCard() { | |
const imgLogoUri = "http://your.home.page.image.link"; | |
const imgLogo = CardService.newImage() | |
.setImageUrl(imgLogoUri) | |
.setAltText("Digit-Atoms"); | |
const footer = CardService.newFixedFooter().setPrimaryButton( | |
CardService.newTextButton() | |
.setTextButtonStyle(CardService.TextButtonStyle.FILLED) |
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
// ... | |
// coroutines | |
// Guava | |
implementation "com.google.guava:guava:24.1-jre" | |
// Guava fix | |
implementation "com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" | |
//Drive | |
implementation('com.google.api-client:google-api-client-android:1.23.0') { |
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
val startForResult = rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) { result: ActivityResult -> | |
if (result.resultCode == Activity.RESULT_OK) { | |
val intent = result.data | |
if (result.data != null) { | |
val task: Task<GoogleSignInAccount> = | |
GoogleSignIn.getSignedInAccountFromIntent(intent) | |
/** | |
* handle [task] result | |
*/ |