Ensure that FirstFrameAnimatorHelper doesn't set play time when animation is complete
Bug: 18567716
Change-Id: I4f098caaa514fef3054930888b938af1e8744df4
diff --git a/src/com/android/launcher2/FirstFrameAnimatorHelper.java b/src/com/android/launcher2/FirstFrameAnimatorHelper.java
index 3815486..0b83a50 100644
--- a/src/com/android/launcher2/FirstFrameAnimatorHelper.java
+++ b/src/com/android/launcher2/FirstFrameAnimatorHelper.java
@@ -91,12 +91,14 @@
mStartTime = currentTime;
}
+ boolean isFinalFrame = Float.compare(1f, animation.getAnimatedFraction()) == 0;
+
if (!mHandlingOnAnimationUpdate &&
sVisible &&
- // If the current play time exceeds the duration, the animation
- // will get finished, even if we call setCurrentPlayTime -- therefore
+ // If the current play time exceeds the duration, or the animated fraction is 1,
+ // the animation will get finished, even if we call setCurrentPlayTime -- therefore
// don't adjust the animation in that case
- animation.getCurrentPlayTime() < animation.getDuration()) {
+ animation.getCurrentPlayTime() < animation.getDuration() && !isFinalFrame) {
mHandlingOnAnimationUpdate = true;
long frameNum = sGlobalFrameCounter - mStartFrame;
// If we haven't drawn our first frame, reset the time to t = 0