summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2012-09-10 13:42:07 -0700
committerChet Haase <chet@google.com>2012-09-10 13:42:07 -0700
commit00177e483dd5b703545e742e6e2f8346dd4f624f (patch)
treee2748395797ad177925ab38cbb0b6c194139b944
parenta3909a93958676d341424d574752bc7b3280d421 (diff)
downloadframeworks_base-00177e483dd5b703545e742e6e2f8346dd4f624f.zip
frameworks_base-00177e483dd5b703545e742e6e2f8346dd4f624f.tar.gz
frameworks_base-00177e483dd5b703545e742e6e2f8346dd4f624f.tar.bz2
Fix clone() for Animators with just a 'to' value
Previously, clone() on an Animator with only one value would mistakenly think that the clone had a real starting value (which would end up being 0 in the int and float cases). Fix is to set the 'mHasFirstValue' flag appropriately for the clone, based on the state of the cloned animator. Issue #7106442 ObjectAnimator.clone() does not work properly for single parameter Change-Id: I08bf03b7687a65eb613c1671a58e4cbfae66a30e
-rw-r--r--core/java/android/animation/Keyframe.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/core/java/android/animation/Keyframe.java b/core/java/android/animation/Keyframe.java
index e98719a..dc8538f 100644
--- a/core/java/android/animation/Keyframe.java
+++ b/core/java/android/animation/Keyframe.java
@@ -261,7 +261,7 @@ public abstract class Keyframe implements Cloneable {
@Override
public ObjectKeyframe clone() {
- ObjectKeyframe kfClone = new ObjectKeyframe(getFraction(), mValue);
+ ObjectKeyframe kfClone = new ObjectKeyframe(getFraction(), mHasValue ? mValue : null);
kfClone.setInterpolator(getInterpolator());
return kfClone;
}
@@ -306,7 +306,9 @@ public abstract class Keyframe implements Cloneable {
@Override
public IntKeyframe clone() {
- IntKeyframe kfClone = new IntKeyframe(getFraction(), mValue);
+ IntKeyframe kfClone = mHasValue ?
+ new IntKeyframe(getFraction(), mValue) :
+ new IntKeyframe(getFraction());
kfClone.setInterpolator(getInterpolator());
return kfClone;
}
@@ -350,7 +352,9 @@ public abstract class Keyframe implements Cloneable {
@Override
public FloatKeyframe clone() {
- FloatKeyframe kfClone = new FloatKeyframe(getFraction(), mValue);
+ FloatKeyframe kfClone = mHasValue ?
+ new FloatKeyframe(getFraction(), mValue) :
+ new FloatKeyframe(getFraction());
kfClone.setInterpolator(getInterpolator());
return kfClone;
}