Animate navigation bar color change

This commit is contained in:
Artem Chepurnoy 2024-02-18 11:49:03 +02:00
parent 90c8b7e3ba
commit 324abebb88
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
2 changed files with 4 additions and 2 deletions

View File

@ -102,6 +102,7 @@ abstract class BaseActivity : AppCompatActivity(), DIAware {
setContent {
KeyguardTheme {
val containerColor = LocalBackgroundManager.current.colorHighest
val containerColorAnimatedState = animateColorAsState(containerColor)
val contentColor = contentColorFor(containerColor)
Surface(
modifier = Modifier.semantics {
@ -110,7 +111,7 @@ abstract class BaseActivity : AppCompatActivity(), DIAware {
// so that it's enabled for the whole subtree
testTagsAsResourceId = true
},
color = containerColor,
color = containerColorAnimatedState.value,
contentColor = contentColor,
) {
CompositionLocalProvider(

View File

@ -264,6 +264,7 @@ private fun ApplicationScope.KeyguardWindow(
) {
KeyguardTheme {
val containerColor = LocalBackgroundManager.current.colorHighest
val containerColorAnimatedState = animateColorAsState(containerColor)
val contentColor = contentColorFor(containerColor)
Surface(
modifier = Modifier.semantics {
@ -272,7 +273,7 @@ private fun ApplicationScope.KeyguardWindow(
// so that it's enabled for the whole subtree
// testTagsAsResourceId = true
},
color = containerColor,
color = containerColorAnimatedState.value,
contentColor = contentColor,
) {
val kamelConfig by rememberInstance<KamelConfig>()