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
diff --git a/src/com/android/launcher3/PinchAnimationManager.java b/src/com/android/launcher3/PinchAnimationManager.java
index c1d60fd..41074be 100644
--- a/src/com/android/launcher3/PinchAnimationManager.java
+++ b/src/com/android/launcher3/PinchAnimationManager.java
@@ -215,9 +215,18 @@
view.setVisibility(View.VISIBLE);
} else {
animator.addListener(new AnimatorListenerAdapter() {
+ private boolean mCancelled = false;
+
+ @Override
+ public void onAnimationCancel(Animator animation) {
+ mCancelled = true;
+ }
+
@Override
public void onAnimationEnd(Animator animation) {
- view.setVisibility(View.INVISIBLE);
+ if (!mCancelled) {
+ view.setVisibility(View.INVISIBLE);
+ }
}
});
}
@@ -226,7 +235,6 @@
private void startAnimator(int index, Animator animator, long duration) {
if (mAnimators[index] != null) {
- mAnimators[index].removeAllListeners();
mAnimators[index].cancel();
}
mAnimators[index] = animator;