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
@Composable | |
fun SplashScreen( | |
modifier: Modifier = Modifier, | |
valid: Boolean?, | |
onStart: () -> Unit, | |
onSplashEndedValid: () -> Unit, | |
onSplashEndedInvalid: () -> Unit, | |
) { | |
val lifecycleOwner = LocalLifecycleOwner.current | |
val color = remember { Animatable(Color.Black) } |
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 currentValid = rememberUpdatedState(newValue = valid) | |
LaunchedEffect(key1 = null) { | |
delay(splashDelay) | |
if (currentValid.value == true) onSplashEndedValid() | |
else onSplashEndedInvalid() | |
} |
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
LaunchedEffect(key1 = null) { | |
delay(splashDelay) | |
if (valid == true) onSplashEndedValid() | |
else onSplashEndedInvalid() | |
} |
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
LaunchedEffect(key1 = null) { | |
delay(splashDelay) | |
onSplashEnded() | |
} |
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
LaunchedEffect(key1 = valid) { | |
valid?.let { valid -> | |
val animateToColor = if (valid) Color.Green else Color.Red | |
color.animateTo(animateToColor, animationSpec = tween(500)) | |
} | |
} |
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
@Composable | |
fun SplashScreen( | |
modifier: Modifier = Modifier, | |
valid: Boolean?, | |
) { | |
val color = remember { Animatable(Color.Black) } | |
valid?.let { valid -> | |
val animateToColor = if (valid) Color.Green else Color.Red | |
color.animateTo(animateToColor, animationSpec = tween(500)) |
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
@Composable | |
fun SplashScreen( | |
modifier: Modifier = Modifier, | |
) { | |
Column( | |
modifier = modifier.fillMaxSize(), | |
verticalArrangement = Arrangement.Center, | |
horizontalAlignment = Alignment.CenterHorizontally | |
) { | |
Image( |
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 MainApp : Application() { | |
override fun onCreate() { | |
super.onCreate() | |
initKoin( | |
module { | |
single<Context> { this@MainApp } | |
single<SharedPreferences> { | |
get<Context>().getSharedPreferences("CHESS_CLOCK_SETTINGS", Context.MODE_PRIVATE) | |
} |
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
actual abstract class ViewModel { | |
actual val viewModelScope = MainScope() | |
protected actual open fun onCleared() { } | |
fun clear() { | |
onCleared() | |
viewModelScope.cancel() | |
} |
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
import kotlinx.coroutines.CoroutineScope | |
import androidx.lifecycle.ViewModel as AndroidXViewModel | |
import androidx.lifecycle.viewModelScope as androidXViewModelScope | |
actual abstract class ViewModel actual constructor() : AndroidXViewModel() { | |
actual val viewModelScope: CoroutineScope = androidXViewModelScope | |
actual override fun onCleared() { | |
super.onCleared() | |
} |
NewerOlder