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

Commit 02a187e8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Miscellaneous polish for new home animation." into main

parents 7779855a 0f6668d0
Loading
Loading
Loading
Loading
+19 −7
Original line number Diff line number Diff line
@@ -151,6 +151,7 @@ import com.android.quickstep.util.MultiValueUpdateListener;
import com.android.quickstep.util.RectFSpringAnim;
import com.android.quickstep.util.RectFSpringAnim.DefaultSpringConfig;
import com.android.quickstep.util.RectFSpringAnim.TaskbarHotseatSpringConfig;
import com.android.quickstep.util.ScalingWorkspaceRevealAnim;
import com.android.quickstep.util.StaggeredWorkspaceAnim;
import com.android.quickstep.util.SurfaceTransaction;
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
@@ -174,7 +175,6 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map.Entry;

/**
 * Manages the opening and closing app transitions from Launcher
@@ -1630,10 +1630,15 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
            anim.play(getUnlockWindowAnimator(appTargets, wallpaperTargets));
        } else if (ENABLE_BACK_SWIPE_HOME_ANIMATION.get()
                && !playFallBackAnimation) {
            PointF velocity;
            if (enableScalingRevealHomeAnimation()) {
                velocity = new PointF();
            } else {
                // Use a fixed velocity to start the animation.
                float velocityPxPerS = DynamicResource.provider(mLauncher)
                        .getDimension(R.dimen.unlock_staggered_velocity_dp_per_s);
            PointF velocity = new PointF(0, -velocityPxPerS);
                velocity = new PointF(0, -velocityPxPerS);
            }
            rectFSpringAnim = getClosingWindowAnimators(
                    anim, appTargets, launcherView, velocity, startRect,
                    startWindowCornerRadius);
@@ -1642,8 +1647,15 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
                // layout bounds.
                skipAllAppsScale = true;
            } else if (!fromPredictiveBack) {
                if (enableScalingRevealHomeAnimation()) {
                    anim.play(
                            new ScalingWorkspaceRevealAnim(
                                    mLauncher, rectFSpringAnim,
                                    rectFSpringAnim.getTargetRect()).getAnimators());
                } else {
                    anim.play(new StaggeredWorkspaceAnim(mLauncher, velocity.y,
                            true /* animateOverviewScrim */, launcherView).getAnimators());
                }

                if (!areAllTargetsTranslucent(appTargets)) {
                    anim.play(ObjectAnimator.ofFloat(mLauncher.getDepthController().stateDepth,
+23 −11
Original line number Diff line number Diff line
@@ -173,14 +173,10 @@ public class LauncherSwipeHandlerV2 extends
            }

            @Override
            public void playAtomicAnimation(float velocity) {
                if (enableScalingRevealHomeAnimation()) {
            protected void playScalingRevealAnimation() {
                if (mContainer != null) {
                        new ScalingWorkspaceRevealAnim(
                                mContainer, mSiblingAnimation, getWindowTargetRect()).start();
                    }
                } else {
                    super.playAtomicAnimation(velocity);
                    new ScalingWorkspaceRevealAnim(mContainer, mSiblingAnimation,
                            getWindowTargetRect()).start();
                }
            }

@@ -370,9 +366,25 @@ public class LauncherSwipeHandlerV2 extends

        @Override
        public void playAtomicAnimation(float velocity) {
            if (enableScalingRevealHomeAnimation()) {
                playScalingRevealAnimation();
            } else {
                new StaggeredWorkspaceAnim(mContainer, velocity, true /* animateOverviewScrim */,
                        getViewIgnoredInWorkspaceRevealAnimation())
                        .start();
            }
        }

        /**
         * Extracted in a different method so subclasses that have a custom window animation with a
         * target (icons, widgets) can pass the optional parameters.
         */
        protected void playScalingRevealAnimation() {
            if (mContainer != null) {
                new ScalingWorkspaceRevealAnim(
                        mContainer, null /* siblingAnimation */,
                        null /* windowTargetRect */).start();
            }
        }
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -157,6 +157,10 @@ public class RectFSpringAnim extends ReleaseCheck {
        mCurrentY = getTrackedYFromRect(mStartRect);
    }

    public RectF getTargetRect() {
        return mTargetRect;
    }

    private float getTrackedYFromRect(RectF rect) {
        switch (mTracking) {
            case TRACKING_TOP:
+6 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.quickstep.util

import android.animation.AnimatorSet
import android.graphics.Matrix
import android.graphics.Path
import android.graphics.RectF
@@ -187,7 +188,11 @@ class ScalingWorkspaceRevealAnim(
        )
    }

    fun getAnimators(): AnimatorSet {
        return animation.buildAnim()
    }

    fun start() {
        animation.buildAnim().start()
        getAnimators().start()
    }
}