Prevent multiple workspace state animators from being started
-> Probably an issue with the way we're wrapping ViewPropertyAnimator which can lead to us acting like it's valid to have multiple instances of a VPA. In reality I think this is very problematic. -> For now, we can just make sure the previous animation is canceled if it hasn't yet completed. Bug 18428886 Change-Id: I097eec08ec68ed098e68866fb5eda72734c51b00
This commit is contained in:
1 parent
7c39e2380f
commit
08072c05bf
1 file changed
+14
@@ -283,6 +283,7 @@ public class Workspace extends SmoothPagedView
|
|||||||
private float[] mNewAlphas;
|
private float[] mNewAlphas;
|
||||||
private int mLastChildCount = -1;
|
private int mLastChildCount = -1;
|
||||||
private float mTransitionProgress;
|
private float mTransitionProgress;
|
||||||
|
private Animator mStateAnimator = null;
|
||||||
|
|
||||||
float mOverScrollEffect = 0f;
|
float mOverScrollEffect = 0f;
|
||||||
|
|
||||||
@@ -2243,6 +2244,13 @@ public class Workspace extends SmoothPagedView
|
|||||||
|
|
||||||
AnimatorSet anim = animated ? LauncherAnimUtils.createAnimatorSet() : null;
|
AnimatorSet anim = animated ? LauncherAnimUtils.createAnimatorSet() : null;
|
||||||
|
|
||||||
|
// We only want a single instance of a workspace animation to be running at once, so
|
||||||
|
// we cancel any incomplete transition.
|
||||||
|
if (mStateAnimator != null) {
|
||||||
|
mStateAnimator.cancel();
|
||||||
|
}
|
||||||
|
mStateAnimator = anim;
|
||||||
|
|
||||||
final State oldState = mState;
|
final State oldState = mState;
|
||||||
final boolean oldStateIsNormal = (oldState == State.NORMAL);
|
final boolean oldStateIsNormal = (oldState == State.NORMAL);
|
||||||
final boolean oldStateIsSpringLoaded = (oldState == State.SPRING_LOADED);
|
final boolean oldStateIsSpringLoaded = (oldState == State.SPRING_LOADED);
|
||||||
@@ -2440,6 +2448,12 @@ public class Workspace extends SmoothPagedView
|
|||||||
anim.play(hotseatAlpha);
|
anim.play(hotseatAlpha);
|
||||||
anim.play(pageIndicatorAlpha);
|
anim.play(pageIndicatorAlpha);
|
||||||
anim.setStartDelay(delay);
|
anim.setStartDelay(delay);
|
||||||
|
anim.addListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
mStateAnimator = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
overviewPanel.setAlpha(finalOverviewPanelAlpha);
|
overviewPanel.setAlpha(finalOverviewPanelAlpha);
|
||||||
AlphaUpdateListener.updateVisibility(overviewPanel);
|
AlphaUpdateListener.updateVisibility(overviewPanel);
|
||||||
|
|||||||
Reference in new issue
Block a user