diff options
| author | 2024-08-14 19:04:02 +0000 | |
|---|---|---|
| committer | 2024-08-14 19:04:02 +0000 | |
| commit | a4296057cf3267302da20641dabdc0752c1a9f66 (patch) | |
| tree | 4ae397e7a6e9930df3ca8b465b9dd4443b128b9c | |
| parent | 3589cb7ab493d079ec9b0f3d29e553aaa070e238 (diff) | |
| parent | d6f45e8c9eb221789b411e92caa825aef5eed4e3 (diff) | |
Merge "Move animation flows to immediate dispatcher" into main
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt | 110 |
1 files changed, 56 insertions, 54 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt index aab5b9b29680..89851dbec7bc 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt @@ -152,6 +152,62 @@ object KeyguardRootViewBinder { } } } + + if ( + KeyguardBottomAreaRefactor.isEnabled || DeviceEntryUdfpsRefactor.isEnabled + ) { + launch("$TAG#alpha") { + viewModel.alpha(viewState).collect { alpha -> + view.alpha = alpha + if (KeyguardBottomAreaRefactor.isEnabled) { + childViews[statusViewId]?.alpha = alpha + childViews[burnInLayerId]?.alpha = alpha + } + } + } + } + + if (MigrateClocksToBlueprint.isEnabled) { + launch("$TAG#translationY") { + // When translation happens in burnInLayer, it won't be weather clock + // large clock isn't added to burnInLayer due to its scale transition + // so we also need to add translation to it here + // same as translationX + viewModel.translationY.collect { y -> + childViews[burnInLayerId]?.translationY = y + childViews[largeClockId]?.translationY = y + childViews[aodNotificationIconContainerId]?.translationY = y + } + } + + launch("$TAG#translationX") { + viewModel.translationX.collect { state -> + val px = state.value ?: return@collect + when { + state.isToOrFrom(KeyguardState.AOD) -> { + // Large Clock is not translated in the x direction + childViews[burnInLayerId]?.translationX = px + childViews[aodNotificationIconContainerId]?.translationX = + px + } + state.isToOrFrom(KeyguardState.GLANCEABLE_HUB) -> { + for ((key, childView) in childViews.entries) { + when (key) { + indicationArea, + startButton, + endButton, + lockIcon, + deviceEntryIcon -> { + // Do not move these views + } + else -> childView.translationX = px + } + } + } + } + } + } + } } } disposables += @@ -188,20 +244,6 @@ object KeyguardRootViewBinder { } } - if ( - KeyguardBottomAreaRefactor.isEnabled || DeviceEntryUdfpsRefactor.isEnabled - ) { - launch { - viewModel.alpha(viewState).collect { alpha -> - view.alpha = alpha - if (KeyguardBottomAreaRefactor.isEnabled) { - childViews[statusViewId]?.alpha = alpha - childViews[burnInLayerId]?.alpha = alpha - } - } - } - } - if (MigrateClocksToBlueprint.isEnabled) { launch { viewModel.burnInLayerVisibility.collect { visibility -> @@ -222,46 +264,6 @@ object KeyguardRootViewBinder { } launch { - // When translation happens in burnInLayer, it won't be weather clock - // large clock isn't added to burnInLayer due to its scale transition - // so we also need to add translation to it here - // same as translationX - viewModel.translationY.collect { y -> - childViews[burnInLayerId]?.translationY = y - childViews[largeClockId]?.translationY = y - childViews[aodNotificationIconContainerId]?.translationY = y - } - } - - launch { - viewModel.translationX.collect { state -> - val px = state.value ?: return@collect - when { - state.isToOrFrom(KeyguardState.AOD) -> { - // Large Clock is not translated in the x direction - childViews[burnInLayerId]?.translationX = px - childViews[aodNotificationIconContainerId]?.translationX = - px - } - state.isToOrFrom(KeyguardState.GLANCEABLE_HUB) -> { - for ((key, childView) in childViews.entries) { - when (key) { - indicationArea, - startButton, - endButton, - lockIcon, - deviceEntryIcon -> { - // Do not move these views - } - else -> childView.translationX = px - } - } - } - } - } - } - - launch { viewModel.scale.collect { scaleViewModel -> if (scaleViewModel.scaleClockOnly) { // For clocks except weather clock, we have scale transition |