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

Commit 7f0815cd authored by Luca Zuccarini's avatar Luca Zuccarini
Browse files

[3/3] Introduce a new spring-based animation.

This is meant to be used for animations that have a starting velocity
(e.g. gesture nav, predictive back), but it can in principle be used
interchangeably with the interpolator-based animation that we've been
using so far.

Bug: 323863002
Flag: com.android.systemui.shared.return_animation_framework_library
Test: atest TransitionAnimatorTest
Change-Id: I5b22b2b8ef52f248583d71c5ee4d113b6993baae
parent e414925c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -802,6 +802,7 @@ android_library {
        "SystemUICustomizationTestUtils",
        "androidx.compose.runtime_runtime",
        "kosmos",
        "testables",
        "androidx.test.rules",
    ],
    libs: [
+24 −0
Original line number Diff line number Diff line
@@ -135,6 +135,23 @@ constructor(
                contentAfterFadeInDuration = 183L,
            )

        /**
         * The timings when animating a View into an app using a spring animator.
         *
         * Important: since springs don't have fixed durations, these timings represent fractions of
         * the progress between the spring's initial value and its final value.
         *
         * TODO(b/372858592): make this a separate class explicitly using percentages.
         */
        val SPRING_TIMINGS =
            TransitionAnimator.Timings(
                totalDuration = 1000L,
                contentBeforeFadeOutDelay = 0L,
                contentBeforeFadeOutDuration = 800L,
                contentAfterFadeInDelay = 850L,
                contentAfterFadeInDuration = 135L,
            )

        /**
         * The timings when animating a Dialog into an app. We need to wait at least 200ms before
         * showing the app (which is under the dialog window) so that the dialog window dim is fully
@@ -152,6 +169,13 @@ constructor(
                contentAfterFadeInInterpolator = PathInterpolator(0f, 0f, 0.6f, 1f),
            )

        /** The interpolators when animating a View into an app using a spring animator. */
        val SPRING_INTERPOLATORS =
            INTERPOLATORS.copy(
                contentBeforeFadeOutInterpolator = Interpolators.DECELERATE_1_5,
                contentAfterFadeInInterpolator = Interpolators.SLOW_OUT_LINEAR_IN,
            )

        // TODO(b/288507023): Remove this flag.
        @JvmField val DEBUG_TRANSITION_ANIMATION = Build.IS_DEBUGGABLE

+412 −31

File changed.

Preview size limit exceeded, changes collapsed.

+350 −251

File changed.

Preview size limit exceeded, changes collapsed.

+375 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading