summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/pageindicators
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-11-24 06:46:50 +0530
committerSunny Goyal <sunnygoyal@google.com>2016-11-24 15:32:45 +0530
commit1c581c6d61ad51df26390027725521289bd9ce4a (patch)
tree292fe89f3abe679a2a8894f425bf93e025dd280f /src/com/android/launcher3/pageindicators
parentfeba90fe802cb54e02dd961dbea265c044ad5f9e (diff)
downloadandroid_packages_apps_Trebuchet-1c581c6d61ad51df26390027725521289bd9ce4a.tar.gz
android_packages_apps_Trebuchet-1c581c6d61ad51df26390027725521289bd9ce4a.tar.bz2
android_packages_apps_Trebuchet-1c581c6d61ad51df26390027725521289bd9ce4a.zip
Bug fix: QSB sometimes gets stuck to transparent.
At some places, we were calling removeAllListeners before calling cancel on an animation. AnimationListeners are also used to track states, and removing listeners before canceling will prevent onAnimationEnd to be called, thus preventing state cleanup. PinchAnimationManager was causing ZeroAlphaAnimatorListener to be removing from Qsb alpha animation, making the MultiStateAlphaController think there is a zeroAlpha animation running. > Removing all instances of removeAllListeners > Updating various affected listeners to handle onAnimatinoCancel > Fixing WorkspaceStateTransitionAnimation, which was animation QSB alpha on page scroll index Bug: 31910152 Change-Id: Ie7f31b67d4c502badcdd41f7b04867d1f35f5d27
Diffstat (limited to 'src/com/android/launcher3/pageindicators')
-rw-r--r--src/com/android/launcher3/pageindicators/PageIndicatorDots.java36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
index 12a67014d..4f5edc94f 100644
--- a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
+++ b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
@@ -72,18 +72,6 @@ public class PageIndicatorDots extends PageIndicator {
}
};
- /**
- * Listener for keep running the animation until the final state is reached.
- */
- private final AnimatorListenerAdapter mAnimCycleListener = new AnimatorListenerAdapter() {
-
- @Override
- public void onAnimationEnd(Animator animation) {
- mAnimator = null;
- animateToPosition(mFinalPosition);
- }
- };
-
private final Paint mCirclePaint;
private final float mDotRadius;
private final int mActiveColor;
@@ -163,7 +151,7 @@ public class PageIndicatorDots extends PageIndicator {
float positionForThisAnim = mCurrentPosition > mFinalPosition ?
mCurrentPosition - SHIFT_PER_ANIMATION : mCurrentPosition + SHIFT_PER_ANIMATION;
mAnimator = ObjectAnimator.ofFloat(this, CURRENT_POSITION, positionForThisAnim);
- mAnimator.addListener(mAnimCycleListener);
+ mAnimator.addListener(new AnimationCycleListener());
mAnimator.setDuration(ANIMATION_DURATION);
mAnimator.start();
}
@@ -171,7 +159,6 @@ public class PageIndicatorDots extends PageIndicator {
public void stopAllAnimations() {
if (mAnimator != null) {
- mAnimator.removeAllListeners();
mAnimator.cancel();
mAnimator = null;
}
@@ -326,4 +313,25 @@ public class PageIndicatorDots extends PageIndicator {
}
}
}
+
+ /**
+ * Listener for keep running the animation until the final state is reached.
+ */
+ private class AnimationCycleListener extends AnimatorListenerAdapter {
+
+ private boolean mCancelled = false;
+
+ @Override
+ public void onAnimationCancel(Animator animation) {
+ mCancelled = true;
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ if (!mCancelled) {
+ mAnimator = null;
+ animateToPosition(mFinalPosition);
+ }
+ }
+ }
}