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

Commit 3e366d65 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix foreground position during widget home animation" into sc-dev

parents b5459c9b 5fcc3a90
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -190,6 +190,12 @@ public class LauncherSwipeHandlerV2 extends

        return new FloatingViewHomeAnimationFactory(floatingWidgetView) {

            @Override
            @Nullable
            protected View getViewIgnoredInWorkspaceRevealAnimation() {
                return hostView;
            }

            @Override
            public RectF getWindowTargetRect() {
                super.getWindowTargetRect();
@@ -387,6 +393,16 @@ public class LauncherSwipeHandlerV2 extends
    }

    private class LauncherHomeAnimationFactory extends HomeAnimationFactory {

        /**
         * Returns a view which should be excluded from the Workspace animation, or null if there
         * is no view to exclude.
         */
        @Nullable
        protected View getViewIgnoredInWorkspaceRevealAnimation() {
            return null;
        }

        @NonNull
        @Override
        public AnimatorPlaybackController createActivityAnimationToHome() {
@@ -400,7 +416,8 @@ public class LauncherSwipeHandlerV2 extends
        @Override
        public void playAtomicAnimation(float velocity) {
            if (!PROTOTYPE_APP_CLOSE.get()) {
                new StaggeredWorkspaceAnim(mActivity, velocity, true /* animateOverviewScrim */)
                new StaggeredWorkspaceAnim(mActivity, velocity, true /* animateOverviewScrim */,
                        getViewIgnoredInWorkspaceRevealAnimation())
                        .start();
            } else if (shouldPlayAtomicWorkspaceReveal()) {
                new WorkspaceRevealAnim(mActivity, true).start();
+9 −3
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ import android.animation.ValueAnimator;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.Nullable;

import com.android.launcher3.BaseQuickstepLauncher;
import com.android.launcher3.CellLayout;
import com.android.launcher3.DeviceProfile;
@@ -68,15 +70,18 @@ public class StaggeredWorkspaceAnim {
    private final float mSpringTransY;

    private final AnimatorSet mAnimators = new AnimatorSet();
    private final @Nullable View mIgnoredView;

    public StaggeredWorkspaceAnim(Launcher launcher, float velocity, boolean animateOverviewScrim) {
        this(launcher, velocity, animateOverviewScrim, true);
    public StaggeredWorkspaceAnim(Launcher launcher, float velocity, boolean animateOverviewScrim,
            @Nullable View ignoredView) {
        this(launcher, velocity, animateOverviewScrim, ignoredView, true);
    }

    public StaggeredWorkspaceAnim(Launcher launcher, float velocity, boolean animateOverviewScrim,
            boolean staggerWorkspace) {
            @Nullable View ignoredView, boolean staggerWorkspace) {
        prepareToAnimate(launcher, animateOverviewScrim);

        mIgnoredView = ignoredView;
        mVelocity = velocity;

        // Scale the translationY based on the initial velocity to better sync the workspace items
@@ -224,6 +229,7 @@ public class StaggeredWorkspaceAnim {
     * @param totalRows Total number of rows.
     */
    private void addStaggeredAnimationForView(View v, int row, int totalRows) {
        if (mIgnoredView != null && mIgnoredView == v) return;
        // Invert the rows, because we stagger starting from the bottom of the screen.
        int invertedRow = totalRows - row;
        // Add 1 to the inverted row so that the bottom most row has a start delay.