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
This commit is contained in:
Luca Zuccarini
2024-06-20 13:40:45 +00:00
parent f6d91d2d37
commit 4b4e426b30
@@ -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();