Merge "Ensures that the swipe up to home animation is ended prior to view recycling." into ub-launcher3-rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
8451542a25
@@ -472,6 +472,7 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten
|
||||
FloatingIconView fiv = (FloatingIconView) floatingView;
|
||||
anim.addAnimatorListener(fiv);
|
||||
fiv.setOnTargetChangeListener(anim::onTargetPositionChanged);
|
||||
fiv.setFastFinishRunnable(anim::end);
|
||||
}
|
||||
|
||||
AnimatorPlaybackController homeAnim = homeAnimationFactory.createActivityAnimationToHome();
|
||||
|
||||
@@ -207,9 +207,23 @@ public class RectFSpringAnim {
|
||||
mRectScaleAnim.skipToEnd();
|
||||
}
|
||||
}
|
||||
mRectXAnimEnded = true;
|
||||
mRectYAnimEnded = true;
|
||||
mRectScaleAnimEnded = true;
|
||||
maybeOnEnd();
|
||||
}
|
||||
|
||||
private boolean isEnded() {
|
||||
return mRectXAnimEnded && mRectYAnimEnded && mRectScaleAnimEnded;
|
||||
}
|
||||
|
||||
private void onUpdate() {
|
||||
if (isEnded()) {
|
||||
// Prevent further updates from being called. This can happen between callbacks for
|
||||
// ending the x/y/scale animations.
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mOnUpdateListeners.isEmpty()) {
|
||||
float currentWidth = Utilities.mapRange(mCurrentScaleProgress, mStartRect.width(),
|
||||
mTargetRect.width());
|
||||
@@ -229,7 +243,7 @@ public class RectFSpringAnim {
|
||||
}
|
||||
|
||||
private void maybeOnEnd() {
|
||||
if (mAnimsStarted && mRectXAnimEnded && mRectYAnimEnded && mRectScaleAnimEnded) {
|
||||
if (mAnimsStarted && isEnded()) {
|
||||
mAnimsStarted = false;
|
||||
for (Animator.AnimatorListener animatorListener : mAnimatorListeners) {
|
||||
animatorListener.onAnimationEnd(null);
|
||||
|
||||
@@ -19,7 +19,6 @@ import static com.android.launcher3.LauncherAnimUtils.DRAWABLE_ALPHA;
|
||||
import static com.android.launcher3.Utilities.getBadge;
|
||||
import static com.android.launcher3.Utilities.getFullDrawable;
|
||||
import static com.android.launcher3.config.FeatureFlags.ADAPTIVE_ICON_WINDOW_ANIM;
|
||||
import static com.android.launcher3.states.RotationHelper.REQUEST_LOCK;
|
||||
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
|
||||
|
||||
import android.animation.Animator;
|
||||
@@ -100,6 +99,7 @@ public class FloatingIconView extends FrameLayout implements
|
||||
|
||||
private AnimatorSet mFadeAnimatorSet;
|
||||
private ListenerView mListenerView;
|
||||
private Runnable mFastFinishRunnable;
|
||||
|
||||
public FloatingIconView(Context context) {
|
||||
this(context, null);
|
||||
@@ -443,9 +443,21 @@ public class FloatingIconView extends FrameLayout implements
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a runnable that is called after a call to {@link #fastFinish()}.
|
||||
*/
|
||||
public void setFastFinishRunnable(Runnable runnable) {
|
||||
mFastFinishRunnable = runnable;
|
||||
}
|
||||
|
||||
public void fastFinish() {
|
||||
if (mFastFinishRunnable != null) {
|
||||
mFastFinishRunnable.run();
|
||||
mFastFinishRunnable = null;
|
||||
}
|
||||
if (mLoadIconSignal != null) {
|
||||
mLoadIconSignal.cancel();
|
||||
mLoadIconSignal = null;
|
||||
}
|
||||
if (mEndRunnable != null) {
|
||||
mEndRunnable.run();
|
||||
@@ -655,6 +667,7 @@ public class FloatingIconView extends FrameLayout implements
|
||||
sTmpObjArray[0] = null;
|
||||
mIconLoadResult = null;
|
||||
mClipIconView.recycle();
|
||||
mFastFinishRunnable = null;
|
||||
}
|
||||
|
||||
private static class IconLoadResult {
|
||||
|
||||
Reference in New Issue
Block a user