From 4b4e426b30a3587f529d655c0dab4278dc0e382b Mon Sep 17 00:00:00 2001 From: Luca Zuccarini Date: Thu, 20 Jun 2024 13:33:54 +0000 Subject: [PATCH] Fix widget jump at the end of the new home animation. The window animation wasn't being updated correctly, which resulted in a jump at the end. Bug: 298089923 Fix: 347880952 Flag: com.android.launcher3.enable_scaling_reveal_home_animation Test: manual Change-Id: Idbbd2e8485ae6f2bcbc1b42aa3744c2c659d1cfc --- .../quickstep/LauncherSwipeHandlerV2.java | 42 +++++++++++-------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java index 3c665906b5..e17cdcd99d 100644 --- a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java +++ b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java @@ -144,8 +144,6 @@ public class LauncherSwipeHandlerV2 extends return new FloatingViewHomeAnimationFactory(floatingIconView) { @Nullable private RectF mTargetRect; - @Nullable - private RectFSpringAnim mSiblingAnimation; @Nullable @Override @@ -172,14 +170,6 @@ public class LauncherSwipeHandlerV2 extends } } - @Override - protected void playScalingRevealAnimation() { - if (mContainer != null) { - new ScalingWorkspaceRevealAnim(mContainer, mSiblingAnimation, - getWindowTargetRect()).start(); - } - } - @Override public void setAnimation(RectFSpringAnim anim) { super.setAnimation(anim); @@ -245,6 +235,8 @@ public class LauncherSwipeHandlerV2 extends isTargetTranslucent, fallbackBackgroundColor); return new FloatingViewHomeAnimationFactory(floatingWidgetView) { + @Nullable + private RectF mTargetRect; @Override @Nullable @@ -254,8 +246,14 @@ public class LauncherSwipeHandlerV2 extends @Override public RectF getWindowTargetRect() { - super.getWindowTargetRect(); - return backgroundLocation; + if (enableScalingRevealHomeAnimation()) { + if (mTargetRect == null) { + mTargetRect = new RectF(backgroundLocation); + } + return mTargetRect; + } else { + return backgroundLocation; + } } @Override @@ -266,10 +264,11 @@ public class LauncherSwipeHandlerV2 extends @Override public void setAnimation(RectFSpringAnim anim) { super.setAnimation(anim); - - anim.addAnimatorListener(floatingWidgetView); - floatingWidgetView.setOnTargetChangeListener(anim::onTargetPositionChanged); - floatingWidgetView.setFastFinishRunnable(anim::end); + mSiblingAnimation = anim; + mSiblingAnimation.addAnimatorListener(floatingWidgetView); + floatingWidgetView.setOnTargetChangeListener( + mSiblingAnimation::onTargetPositionChanged); + floatingWidgetView.setFastFinishRunnable(mSiblingAnimation::end); } @Override @@ -330,13 +329,22 @@ public class LauncherSwipeHandlerV2 extends } private class FloatingViewHomeAnimationFactory extends LauncherHomeAnimationFactory { - private final FloatingView mFloatingView; + @Nullable + protected RectFSpringAnim mSiblingAnimation; FloatingViewHomeAnimationFactory(FloatingView floatingView) { mFloatingView = floatingView; } + @Override + protected void playScalingRevealAnimation() { + if (mContainer != null) { + new ScalingWorkspaceRevealAnim(mContainer, mSiblingAnimation, + getWindowTargetRect()).start(); + } + } + @Override public void onCancel() { mFloatingView.fastFinish();