Loading packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/modifier/BurnInModifiers.kt +7 −4 Original line number Diff line number Diff line Loading @@ -17,8 +17,9 @@ package com.android.systemui.keyguard.ui.composable.modifier import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableFloatStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.graphicsLayer Loading @@ -41,15 +42,17 @@ fun Modifier.burnInAware( params: BurnInParameters, isClock: Boolean = false, ): Modifier { val translationYState = remember { mutableStateOf(0F) } viewModel.updateBurnInParams(params.copy(translationY = { translationYState.value })) val cachedYTranslation = remember { mutableFloatStateOf(0f) } LaunchedEffect(Unit) { viewModel.updateBurnInParams(params.copy(translationY = { cachedYTranslation.floatValue })) } val burnIn = viewModel.movement val translationX by burnIn.map { it.translationX.toFloat() }.collectAsStateWithLifecycle(initialValue = 0f) val translationY by burnIn.map { it.translationY.toFloat() }.collectAsStateWithLifecycle(initialValue = 0f) translationYState.value = translationY cachedYTranslation.floatValue = translationY val scaleViewModel by burnIn .map { BurnInScaleViewModel(scale = it.scale, scaleClockOnly = it.scaleClockOnly) } Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/modifier/BurnInModifiers.kt +7 −4 Original line number Diff line number Diff line Loading @@ -17,8 +17,9 @@ package com.android.systemui.keyguard.ui.composable.modifier import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableFloatStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.graphicsLayer Loading @@ -41,15 +42,17 @@ fun Modifier.burnInAware( params: BurnInParameters, isClock: Boolean = false, ): Modifier { val translationYState = remember { mutableStateOf(0F) } viewModel.updateBurnInParams(params.copy(translationY = { translationYState.value })) val cachedYTranslation = remember { mutableFloatStateOf(0f) } LaunchedEffect(Unit) { viewModel.updateBurnInParams(params.copy(translationY = { cachedYTranslation.floatValue })) } val burnIn = viewModel.movement val translationX by burnIn.map { it.translationX.toFloat() }.collectAsStateWithLifecycle(initialValue = 0f) val translationY by burnIn.map { it.translationY.toFloat() }.collectAsStateWithLifecycle(initialValue = 0f) translationYState.value = translationY cachedYTranslation.floatValue = translationY val scaleViewModel by burnIn .map { BurnInScaleViewModel(scale = it.scale, scaleClockOnly = it.scaleClockOnly) } Loading