End window animation to home when handler invalidated
We did this already for mCurrentShift, which is used for all animations except home animation. Now we do it for the home animation as well to ensure we are properly cleaned up for the next interaction. Test: Swipe up to home and double tap nav region before animation finishes. Before, this would return to the app you swiped up from but was in a broken state where subsequent swipes were ignored. Now we jump to the home screen and remain there. Bug: 130802487 Change-Id: I98a2e71a1791f5580451c94a35af98da193ff12f
This commit is contained in:
@@ -34,6 +34,7 @@ public class FlingSpringAnim {
|
||||
private static final float SPRING_DAMPING = SpringForce.DAMPING_RATIO_LOW_BOUNCY;
|
||||
|
||||
private final FlingAnimation mFlingAnim;
|
||||
private SpringAnimation mSpringAnim;
|
||||
|
||||
public <K> FlingSpringAnim(K object, FloatPropertyCompat<K> property, float startPosition,
|
||||
float targetPosition, float startVelocity, OnAnimationEndListener onEndListener) {
|
||||
@@ -44,17 +45,24 @@ public class FlingSpringAnim {
|
||||
.setMinValue(Math.min(startPosition, targetPosition))
|
||||
.setMaxValue(Math.max(startPosition, targetPosition));
|
||||
mFlingAnim.addEndListener(((animation, canceled, value, velocity) -> {
|
||||
SpringAnimation springAnim = new SpringAnimation(object, property)
|
||||
mSpringAnim = new SpringAnimation(object, property)
|
||||
.setStartVelocity(velocity)
|
||||
.setSpring(new SpringForce(targetPosition)
|
||||
.setStiffness(SPRING_STIFFNESS)
|
||||
.setDampingRatio(SPRING_DAMPING));
|
||||
springAnim.addEndListener(onEndListener);
|
||||
springAnim.start();
|
||||
mSpringAnim.addEndListener(onEndListener);
|
||||
mSpringAnim.start();
|
||||
}));
|
||||
}
|
||||
|
||||
public void start() {
|
||||
mFlingAnim.start();
|
||||
}
|
||||
|
||||
public void end() {
|
||||
mFlingAnim.cancel();
|
||||
if (mSpringAnim.canSkipToEnd()) {
|
||||
mSpringAnim.skipToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user