OSDN Git Service

Run cleanup before end actions of ViewPropertyAnimator.
authorGeorge Mount <mount@google.com>
Tue, 29 Mar 2016 14:39:02 +0000 (07:39 -0700)
committerGeorge Mount <mount@google.com>
Tue, 29 Mar 2016 14:39:02 +0000 (07:39 -0700)
Bug 27788719

The end action of a ViewPropertyAnimator may do anything,
including starting a new animator. If the next animator has
started prior to cleaning up the previous one, it will capture
the dirty state as the final state. This CL runs the cleanup
Runnables before running the end actions so that any captured
state is the clean state.

Change-Id: Ib005b817d420e79b636e61987669a852e15df9ce

core/java/android/view/ViewPropertyAnimator.java

index f18b7ac..c5b8849 100644 (file)
@@ -1113,19 +1113,19 @@ public class ViewPropertyAnimator {
             if (mListener != null) {
                 mListener.onAnimationEnd(animation);
             }
-            if (mAnimatorOnEndMap != null) {
-                Runnable r = mAnimatorOnEndMap.get(animation);
+            if (mAnimatorCleanupMap != null) {
+                Runnable r = mAnimatorCleanupMap.get(animation);
                 if (r != null) {
                     r.run();
                 }
-                mAnimatorOnEndMap.remove(animation);
+                mAnimatorCleanupMap.remove(animation);
             }
-            if (mAnimatorCleanupMap != null) {
-                Runnable r = mAnimatorCleanupMap.get(animation);
+            if (mAnimatorOnEndMap != null) {
+                Runnable r = mAnimatorOnEndMap.get(animation);
                 if (r != null) {
                     r.run();
                 }
-                mAnimatorCleanupMap.remove(animation);
+                mAnimatorOnEndMap.remove(animation);
             }
             mAnimatorMap.remove(animation);
         }