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") |
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
| private val Context.density: Float | |
| get() = resources.displayMetrics.density | |
| private val Context.scale: Float | |
| get() = resources.displayMetrics.scaledDensity | |
| /* ----- dp(Dp) → px(Float) ----- */ | |
| fun Context.dpToPx(dp: Dp): Float = | |
| dp.value * density |
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
| object TestEnvironmentChecker { | |
| /** | |
| * Firebase Test Lab またはテスト環境で実行されているかを推定 | |
| */ | |
| fun isRunningInTestLab(context: Context): Boolean { | |
| return when { | |
| isFirebaseTestLab(context) -> { | |
| Log.d("EnvCheck", "Detected: Firebase Test Lab via system setting") | |
| true |
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
| fun ProductDetails.showLog() { | |
| Timber.d("ProductDetails") | |
| Timber.d(" productId : ${this.productId}") | |
| Timber.d(" productType : ${this.productType}") | |
| Timber.d(" title : ${this.title}") | |
| Timber.d(" name : ${this.name}") | |
| Timber.d(" description : ${this.description}") | |
| this.subscriptionOfferDetails?.forEachIndexed { index, offer -> | |
| Timber.d(" subscriptionOfferDetails") | |
| Timber.d(" index : $index") |
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 SettingsScreen( | |
| modifier: Modifier = Modifier, | |
| viewModel: SettingsViewModel = hiltViewModel() | |
| ) { | |
| val on = viewModel.on.collectAsState() | |
| LazyColumn{ | |
| items(10) { | |
| OutlinedCard( |
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
| import SwiftUI | |
| struct Sample: View { | |
| @State private var data: Data = .init() | |
| private let urlStrings = [ | |
| "https://i.imgur.com/05S3yYZ.png", | |
| "https://i.imgur.com/REuN9RR.png" // removed | |
| ] |
NewerOlder