Fixes alpha issue in lock screen shortcuts.
This bug was introduced in ag/21077389 where we implemented "dimming" of the views to support the remote rendering of the screen preview that's shown in the wallpaper picker but never tested that it doesn't affect the views when shown in the normal lock screen. This CL fixes that. Fix: 266875410 Test: manually verified that pulling the shade down or the bouncer up properly fades out the lock screen shortcuts Test: manually verified that the appropriate "dimming" of the currently-not-selected button is working as expected in the wallpaper picker Change-Id: I9f3e6f7ec600567065d10e6f94a87096607817bf
This commit is contained in:
@@ -49,6 +49,7 @@ import kotlin.math.pow
|
||||
import kotlin.math.sqrt
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.flatMapLatest
|
||||
@@ -163,11 +164,25 @@ object KeyguardBottomAreaViewBinder {
|
||||
|
||||
ambientIndicationArea?.alpha = alpha
|
||||
indicationArea.alpha = alpha
|
||||
startButton.alpha = alpha
|
||||
endButton.alpha = alpha
|
||||
}
|
||||
}
|
||||
|
||||
launch {
|
||||
updateButtonAlpha(
|
||||
view = startButton,
|
||||
viewModel = viewModel.startButton,
|
||||
alphaFlow = viewModel.alpha,
|
||||
)
|
||||
}
|
||||
|
||||
launch {
|
||||
updateButtonAlpha(
|
||||
view = endButton,
|
||||
viewModel = viewModel.endButton,
|
||||
alphaFlow = viewModel.alpha,
|
||||
)
|
||||
}
|
||||
|
||||
launch {
|
||||
viewModel.indicationAreaTranslationX.collect { translationX ->
|
||||
indicationArea.translationX = translationX
|
||||
@@ -321,7 +336,6 @@ object KeyguardBottomAreaViewBinder {
|
||||
.animate()
|
||||
.scaleX(if (viewModel.isSelected) SCALE_SELECTED_BUTTON else 1f)
|
||||
.scaleY(if (viewModel.isSelected) SCALE_SELECTED_BUTTON else 1f)
|
||||
.alpha(if (viewModel.isDimmed) DIM_ALPHA else 1f)
|
||||
.start()
|
||||
|
||||
view.isClickable = viewModel.isClickable
|
||||
@@ -341,6 +355,17 @@ object KeyguardBottomAreaViewBinder {
|
||||
view.isSelected = viewModel.isSelected
|
||||
}
|
||||
|
||||
private suspend fun updateButtonAlpha(
|
||||
view: View,
|
||||
viewModel: Flow<KeyguardQuickAffordanceViewModel>,
|
||||
alphaFlow: Flow<Float>,
|
||||
) {
|
||||
combine(viewModel.map { it.isDimmed }, alphaFlow) { isDimmed, alpha ->
|
||||
if (isDimmed) DIM_ALPHA else alpha
|
||||
}
|
||||
.collect { view.alpha = it }
|
||||
}
|
||||
|
||||
private class OnTouchListener(
|
||||
private val view: View,
|
||||
private val viewModel: KeyguardQuickAffordanceViewModel,
|
||||
|
||||
Reference in New Issue
Block a user