summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2014-11-06 00:12:39 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-11-06 00:12:39 +0000
commitac418e07f7a726c6888f1f4f9871fcae8c46798d (patch)
tree17eb42b6def3257636a7272dc7b700827d666ebc
parentdfd0099ce515d10887be756d60f8fb088d608fee (diff)
parenta3fdc18fd7a8191d7452e63823d7c4589dd5c894 (diff)
downloadframeworks_base-ac418e07f7a726c6888f1f4f9871fcae8c46798d.zip
frameworks_base-ac418e07f7a726c6888f1f4f9871fcae8c46798d.tar.gz
frameworks_base-ac418e07f7a726c6888f1f4f9871fcae8c46798d.tar.bz2
am a3fdc18f: am aa627037: am c838b677: Merge "Cancel animation when target changes." into lmp-mr1-dev
* commit 'a3fdc18fd7a8191d7452e63823d7c4589dd5c894': Cancel animation when target changes.
-rw-r--r--core/java/android/animation/ObjectAnimator.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/animation/ObjectAnimator.java b/core/java/android/animation/ObjectAnimator.java
index 500634c..59daaab 100644
--- a/core/java/android/animation/ObjectAnimator.java
+++ b/core/java/android/animation/ObjectAnimator.java
@@ -885,7 +885,8 @@ public final class ObjectAnimator extends ValueAnimator {
}
/**
- * Sets the target object whose property will be animated by this animation
+ * Sets the target object whose property will be animated by this animation. If the
+ * animator has been started, it will be canceled.
*
* @param target The object being animated
*/
@@ -893,6 +894,9 @@ public final class ObjectAnimator extends ValueAnimator {
public void setTarget(@Nullable Object target) {
final Object oldTarget = getTarget();
if (oldTarget != target) {
+ if (isStarted()) {
+ cancel();
+ }
mTarget = target == null ? null : new WeakReference<Object>(target);
// New target should cause re-initialization prior to starting
mInitialized = false;