Skip to content

Commit 4dd1768

Browse files
committed
end() a reverse()'d animation correctly
Previously, an animator that had been reverse()'d (and was thus playing backwards) would not end() at the right value. That is, a call to end() would cause the animation to snap to its original end value, not the reverse-playing end value (i.e., its start value). Logic to handle calculating the proper end value was not taking the reversing behavior into account. Issue #6583656 When you call end() after calling reverse() on an animation that has not started leads to forward animation finishing. Change-Id: Ifca60a32d4973c21b85aed9c459f802526c0207e
1 parent d428e95 commit 4dd1768

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

core/java/android/animation/ValueAnimator.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -958,13 +958,7 @@ public void end() {
958958
} else if (!mInitialized) {
959959
initAnimation();
960960
}
961-
// The final value set on the target varies, depending on whether the animation
962-
// was supposed to repeat an odd number of times
963-
if (mRepeatCount > 0 && (mRepeatCount & 0x01) == 1) {
964-
animateValue(0f);
965-
} else {
966-
animateValue(1f);
967-
}
961+
animateValue(mPlayingBackwards ? 0f : 1f);
968962
endAnimation(handler);
969963
}
970964

0 commit comments

Comments
 (0)