diff options
author | Adam Cohen <adamcohen@google.com> | 2014-11-18 17:53:44 -0800 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2015-09-27 21:06:09 -0700 |
commit | 2fa2db1e8c2c963d917f0563d7961f45e57ab8aa (patch) | |
tree | 363e66f704e16730a4f8cb132aa600ceb0a664e6 /src | |
parent | 28d42e88a7d6abdeb6f8da0fe291cd7fb7bc5679 (diff) | |
download | android_packages_apps_Trebuchet-2fa2db1e8c2c963d917f0563d7961f45e57ab8aa.tar.gz android_packages_apps_Trebuchet-2fa2db1e8c2c963d917f0563d7961f45e57ab8aa.tar.bz2 android_packages_apps_Trebuchet-2fa2db1e8c2c963d917f0563d7961f45e57ab8aa.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 3c6ab317a..ad045ccf4 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -289,6 +289,7 @@ public class Workspace extends SmoothPagedView private float[] mNewAlphas; private int mLastChildCount = -1; private float mTransitionProgress; + private Animator mStateAnimator = null; float mOverScrollEffect = 0f; @@ -2341,6 +2342,13 @@ public class Workspace extends SmoothPagedView 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 boolean oldStateIsNormal = (oldState == State.NORMAL); final boolean oldStateIsSpringLoaded = (oldState == State.SPRING_LOADED); @@ -2627,6 +2635,12 @@ public class Workspace extends SmoothPagedView anim.play(hotseatAlpha); anim.play(pageIndicatorAlpha); anim.setStartDelay(delay); + anim.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + mStateAnimator = null; + } + }); } else { overviewPanel.setAlpha(finalOverviewPanelAlpha); AlphaUpdateListener.updateVisibility(overviewPanel); |