This file contains hidden or 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
| #!/bin/bash | |
| # Exit immediately if a command exits with a non-zero status | |
| set -e | |
| # === Configuration === | |
| BINARY_NAME="android" | |
| INSTALL_DIR="/usr/local/bin" | |
| OS="$(uname -s)" |
This file contains hidden or 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
| @Serializable | |
| sealed interface AppDestination { | |
| val label: String | |
| @get:DrawableRes val iconRes: Int | |
| } | |
| @Serializable | |
| data object HomeDestination : AppDestination { | |
| override val label = "Home"; override val iconRes = R.drawable.ic_home | |
| } |
This file contains hidden or 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
| @Serializable | |
| sealed interface AppDestination { | |
| val label: String | |
| @get:DrawableRes val iconRes: Int | |
| @Serializable | |
| data object Home : AppDestination { | |
| override val label = "Home" | |
| override val iconRes = R.drawable.ic_home | |
| } |
This file contains hidden or 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
| // ========================================================== | |
| // 【DEFINITION AREA】 | |
| // Must be defined at the TOP-LEVEL (Outside of any @Composable) | |
| // ========================================================== | |
| // A. object: A global, immutable box (Constants) | |
| object AppDesignConfig { | |
| val BrandColor = Color(0xFF6200EE) // Fixed brand color | |
| val CornerRadius = 12.dp | |
| } |
This file contains hidden or 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
| @Composable | |
| fun AnalyticsScreen(screenName: String) { | |
| var startTime by remember { mutableLongStateOf(0L) } | |
| ScreenLifecycleObserver { event -> | |
| when (event) { | |
| Lifecycle.Event.ON_RESUME -> startTime = System.currentTimeMillis() | |
| Lifecycle.Event.ON_PAUSE -> { | |
| val duration = System.currentTimeMillis() - startTime | |
| Analytics.sendScreenTime(screenName, duration) |
This file contains hidden or 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
| // No ViewModel | |
| @Composable | |
| fun UiOnlySample() { | |
| val context = LocalContext.current | |
| Button(onClick = { | |
| Toast.makeText(context, "Clicked!", Toast.LENGTH_SHORT).show() | |
| }) { | |
| Text("Click") |
NewerOlder