From e9a4f878528976efb4ec6f3d7797bef44732b00e Mon Sep 17 00:00:00 2001 From: George Mount Date: Tue, 29 Mar 2016 07:39:02 -0700 Subject: [PATCH] Run cleanup before end actions of ViewPropertyAnimator. 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 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/java/android/view/ViewPropertyAnimator.java b/core/java/android/view/ViewPropertyAnimator.java index f18b7acf64f0..c5b8849e88ab 100644 --- a/core/java/android/view/ViewPropertyAnimator.java +++ b/core/java/android/view/ViewPropertyAnimator.java @@ -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); } -- 2.11.0