Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d9121cd authored by Michal Brzezinski's avatar Michal Brzezinski
Browse files

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
parent 10d8e393
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -213,10 +213,14 @@ fun TutorialAnimation(
            transitionSpec = {
                if (initialState == NOT_STARTED && targetState == IN_PROGRESS) {
                    val transitionDurationMillis = 150
                    fadeIn(
                        animationSpec = tween(transitionDurationMillis, easing = LinearEasing)
                    ) togetherWith
                    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