OSDN Git Service

Ensure that FirstFrameAnimatorHelper doesn't set play time when animation is complete
authorAdam Cohen <adamcohen@google.com>
Tue, 2 Dec 2014 23:24:52 +0000 (15:24 -0800)
committerAdam Cohen <adamcohen@google.com>
Tue, 2 Dec 2014 23:40:19 +0000 (15:40 -0800)
Bug: 18567716

Change-Id: I656e869b8553d650916c2abe6dc83282c8b6fd65

src/com/android/launcher3/FirstFrameAnimatorHelper.java

index f4c49d7..095c563 100644 (file)
@@ -92,12 +92,14 @@ public class FirstFrameAnimatorHelper extends AnimatorListenerAdapter
         }
 
         final long currentPlayTime = animation.getCurrentPlayTime();
+        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
-            currentPlayTime < animation.getDuration()) {
+            currentPlayTime < animation.getDuration() && !isFinalFrame) {
             mHandlingOnAnimationUpdate = true;
             long frameNum = sGlobalFrameCounter - mStartFrame;
             // If we haven't drawn our first frame, reset the time to t = 0