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

Commit de2e793f authored by Luca Zuccarini's avatar Luca Zuccarini Committed by Android (Google) Code Review
Browse files

Merge "Tune the window to icon and home scaling animation." into main

parents 3da07952 a152f8f0
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
@@ -103,8 +103,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>

@@ -114,9 +114,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 -->