Fix bugs with quickstep springs.

* Listeners weren't getting called properly. We add one listener to the
SpringbjectAnimator and then use that to dispatch to the other listeners.

* We fast finish on both double swipe cases to prevent the shelf from
  ending in an invalid state. This causes a visual jump but this can be
  addressed in follow up CL.

Bug: 111698021
Change-Id: Ifeb55da9dd253d062122a8e1577f94044f688641
This commit is contained in:
Jon Miranda
2019-01-28 15:00:46 -08:00
parent e0c5f5d0ab
commit f82fd49244
3 changed files with 50 additions and 7 deletions
@@ -73,7 +73,9 @@ public class SpringObjectAnimator<T extends ProgressInterface> extends ValueAnim
mListeners = new ArrayList<>();
setFloatValues(values);
mObjectAnimator.addListener(new AnimatorListenerAdapter() {
// We use this listener and track mListeners so that we can sync the animator and spring
// listeners.
super.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
mAnimatorEnded = false;
@@ -94,7 +96,7 @@ public class SpringObjectAnimator<T extends ProgressInterface> extends ValueAnim
for (AnimatorListener l : mListeners) {
l.onAnimationCancel(animation);
}
mSpring.animateToFinalPosition(mObject.getProgress());
mSpring.cancel();
}
});
@@ -145,6 +147,10 @@ public class SpringObjectAnimator<T extends ProgressInterface> extends ValueAnim
mListeners.add(listener);
}
public ArrayList<AnimatorListener> getSuperListeners() {
return super.getListeners();
}
@Override
public ArrayList<AnimatorListener> getListeners() {
return mListeners;
@@ -167,8 +173,8 @@ public class SpringObjectAnimator<T extends ProgressInterface> extends ValueAnim
@Override
public void cancel() {
mSpring.animateToFinalPosition(mObject.getProgress());
mObjectAnimator.cancel();
mSpring.cancel();
}
@Override