summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Michal Brzezinski <brzezinski@google.com> 2024-08-07 11:38:45 +0100
committer Michal Brzezinski <brzezinski@google.com> 2024-08-07 11:38:45 +0100
commit1d9121cd5057f68bcf3e33773ecd4df530c31aaa (patch)
treeb66f3454e7e853253cfc5ddadec8a575b68dd46f
parent10d8e39353660a5a91bdcf5542f5017ae797c646 (diff)
Disabling size animation when switching between lottie animations
Cropping was caused by AnimatedContent automatically animating size. Lottie animation takes some time to load initially so for a moment is seems that target Composable is empty/very small. Fixes: 357539003 Test: transition between animations is fluid and not cropped Flag: com.android.systemui.shared.new_touchpad_gestures_tutorial Change-Id: I3d0c5c3f5acb5108766c0161193c35ddc5e66738
-rw-r--r--packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/GestureTutorialScreen.kt12
1 files changed, 8 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/GestureTutorialScreen.kt b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/GestureTutorialScreen.kt
index 416c562d212d..9ac2cba2b8d8 100644
--- a/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/GestureTutorialScreen.kt
+++ b/packages/SystemUI/src/com/android/systemui/touchpad/tutorial/ui/composable/GestureTutorialScreen.kt
@@ -213,10 +213,14 @@ fun TutorialAnimation(
transitionSpec = {
if (initialState == NOT_STARTED && targetState == IN_PROGRESS) {
val transitionDurationMillis = 150
- fadeIn(
- animationSpec = tween(transitionDurationMillis, easing = LinearEasing)
- ) togetherWith
- fadeOut(animationSpec = snap(delayMillis = transitionDurationMillis))
+ fadeIn(animationSpec = tween(transitionDurationMillis, easing = LinearEasing))
+ .togetherWith(
+ fadeOut(animationSpec = snap(delayMillis = transitionDurationMillis))
+ )
+ // we explicitly don't want size transform because when targetState
+ // animation is loaded for the first time, AnimatedContent thinks target
+ // size is smaller and tries to shrink initial state animation
+ .using(sizeTransform = null)
} else {
// empty transition works because all remaining transitions are from IN_PROGRESS
// state which shares initial animation frame with both FINISHED and NOT_STARTED