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

Commit a152f8f0 authored by Luca Zuccarini's avatar Luca Zuccarini
Browse files

Tune the window to icon and home scaling animation.

Result of several rounds of testing with UX and product. Ready to start
rolling out after this CL.

Bug: 298089923
Flag: ACONFIG com.android.launcher3.enable_scaling_reveal_home_animation DISABLED
Test: tested with the help of UX and PM
Change-Id: I2bcdfa5a314aeeb60acf7b38f3f3d463fedc277e
parent 1ebeb1d1
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -565,7 +565,11 @@ public class RectFSpringAnim extends ReleaseCheck {
                final float bottomThreshold = deviceProfile.heightPx - padding.bottom;

                if (targetRect.bottom > bottomThreshold) {
                    if (enableScalingRevealHomeAnimation()) {
                        tracking = TRACKING_CENTER;
                    } else {
                        tracking = TRACKING_BOTTOM;
                    }
                } else if (targetRect.top < topThreshold) {
                    tracking = TRACKING_TOP;
                } else {
+20 −6
Original line number Diff line number Diff line
@@ -17,11 +17,12 @@
package com.android.quickstep.util

import android.graphics.Matrix
import android.graphics.Path
import android.graphics.RectF
import android.view.View
import android.view.animation.PathInterpolator
import androidx.core.graphics.transform
import com.android.app.animation.Interpolators
import com.android.app.animation.Interpolators.EMPHASIZED
import com.android.app.animation.Interpolators.LINEAR
import com.android.launcher3.LauncherAnimUtils.HOTSEAT_SCALE_PROPERTY_FACTORY
import com.android.launcher3.LauncherAnimUtils.SCALE_INDEX_WORKSPACE_STATE
@@ -53,6 +54,19 @@ class ScalingWorkspaceRevealAnim(
        private const val MIN_ALPHA = 0f
        private const val MAX_SIZE = 1f
        private const val MIN_SIZE = 0.85f

        /**
         * Custom interpolator for both the home and wallpaper scaling. Necessary because EMPHASIZED
         * is too aggressive, but EMPHASIZED_DECELERATE is too soft.
         */
        private val SCALE_INTERPOLATOR =
            PathInterpolator(
                Path().apply {
                    moveTo(0f, 0f)
                    cubicTo(0.045f, 0.0356f, 0.0975f, 0.2055f, 0.15f, 0.3952f)
                    cubicTo(0.235f, 0.6855f, 0.235f, 1f, 1f, 1f)
                }
            )
    }

    private val animation = PendingAnimation(SCALE_DURATION_MS)
@@ -78,20 +92,20 @@ class ScalingWorkspaceRevealAnim(
        val hotseat = launcher.hotseat

        // Scale the Workspace and Hotseat around the same pivot.
        workspace.setPivotToScaleWithSelf(hotseat)
        animation.addFloat(
            workspace,
            WORKSPACE_SCALE_PROPERTY_FACTORY[SCALE_INDEX_WORKSPACE_STATE],
            MIN_SIZE,
            MAX_SIZE,
            EMPHASIZED,
            SCALE_INTERPOLATOR,
        )
        workspace.setPivotToScaleWithSelf(hotseat)
        animation.addFloat(
            hotseat,
            HOTSEAT_SCALE_PROPERTY_FACTORY[SCALE_INDEX_WORKSPACE_STATE],
            MIN_SIZE,
            MAX_SIZE,
            EMPHASIZED,
            SCALE_INTERPOLATOR,
        )

        // Fade in quickly at the beginning of the animation, so the content doesn't look like it's
@@ -114,11 +128,11 @@ class ScalingWorkspaceRevealAnim(

        // Match the Wallpaper animation to the rest of the content.
        val depthController = (launcher as? QuickstepLauncher)?.depthController
        transitionConfig.setInterpolator(StateAnimationConfig.ANIM_DEPTH, EMPHASIZED)
        transitionConfig.setInterpolator(StateAnimationConfig.ANIM_DEPTH, SCALE_INTERPOLATOR)
        depthController?.setStateWithAnimation(LauncherState.NORMAL, transitionConfig, animation)

        // Make sure that the contrast scrim animates correctly if needed.
        transitionConfig.setInterpolator(StateAnimationConfig.ANIM_SCRIM_FADE, EMPHASIZED)
        transitionConfig.setInterpolator(StateAnimationConfig.ANIM_SCRIM_FADE, SCALE_INTERPOLATOR)
        launcher.workspace.stateTransitionAnimation.setScrim(
            animation,
            LauncherState.NORMAL,
+4 −4
Original line number Diff line number Diff line
@@ -102,8 +102,8 @@
    <item name="swipe_up_rect_scale_stiffness" type="dimen" format="float">200</item>
    <item name="swipe_up_rect_scale_higher_stiffness" type="dimen" format="float">400</item>
    <!-- Flag: enableScalingRevealHomeAnimation() -->
    <item name="swipe_up_rect_scale_damping_ratio_v2" type="dimen" format="float">0.8</item>
    <item name="swipe_up_rect_scale_stiffness_v2" type="dimen" format="float">650</item>
    <item name="swipe_up_rect_scale_damping_ratio_v2" type="dimen" format="float">0.99</item>
    <item name="swipe_up_rect_scale_stiffness_v2" type="dimen" format="float">500</item>

    <item name="swipe_up_rect_xy_fling_friction" type="dimen" format="float">1.5</item>

@@ -113,9 +113,9 @@
    <item name="swipe_up_rect_xy_stiffness" type="dimen" format="float">200</item>
    <!-- Flag: enableScalingRevealHomeAnimation() -->
    <item name="swipe_up_rect_x_damping_ratio" type="dimen" format="float">0.965</item>
    <item name="swipe_up_rect_x_stiffness" type="dimen" format="float">300</item>
    <item name="swipe_up_rect_x_stiffness" type="dimen" format="float">450</item>
    <item name="swipe_up_rect_y_damping_ratio" type="dimen" format="float">0.95</item>
    <item name="swipe_up_rect_y_stiffness" type="dimen" format="float">190</item>
    <item name="swipe_up_rect_y_stiffness" type="dimen" format="float">400</item>

    <!-- Taskbar -->
    <!-- This is a float because it is converted to dp later in DeviceProfile -->