summaryrefslogtreecommitdiffstats
path: root/core/java/android/animation
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2011-04-04 15:25:09 -0700
committerChet Haase <chet@google.com>2011-04-04 15:33:55 -0700
commitd4dd7025a1b356476e119de19a2e2cd5cf50d43c (patch)
tree1134f9d6a70a38ac75d8e4164ad0307d62ee3690 /core/java/android/animation
parent756484c2bb110c7c2155e41b6f51672ecc638a23 (diff)
downloadframeworks_base-d4dd7025a1b356476e119de19a2e2cd5cf50d43c.zip
frameworks_base-d4dd7025a1b356476e119de19a2e2cd5cf50d43c.tar.gz
frameworks_base-d4dd7025a1b356476e119de19a2e2cd5cf50d43c.tar.bz2
Fix bug with values in cloned animators.
When a ValueAnimator is cloned, we correctly clone the underlying PropertyValuesHolder objects and assign them to the new object. However, we then put values into the new property map using the old values instead of the new ones. This means that the per-property animated values cannot be retrieved with the property names from the cloned animator, because the map refers to the values of the original object, not the cloned object that is actually being animated. Fix is easy: just put the cloned values (which are already being created) into the map. Change-Id: I81282ca1dab6b1767ddc894d57a1110b344b4b0a
Diffstat (limited to 'core/java/android/animation')
-rwxr-xr-xcore/java/android/animation/ValueAnimator.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/core/java/android/animation/ValueAnimator.java b/core/java/android/animation/ValueAnimator.java
index f562851..1dcaa04 100755
--- a/core/java/android/animation/ValueAnimator.java
+++ b/core/java/android/animation/ValueAnimator.java
@@ -1173,13 +1173,11 @@ public class ValueAnimator extends Animator {
if (oldValues != null) {
int numValues = oldValues.length;
anim.mValues = new PropertyValuesHolder[numValues];
- for (int i = 0; i < numValues; ++i) {
- anim.mValues[i] = oldValues[i].clone();
- }
anim.mValuesMap = new HashMap<String, PropertyValuesHolder>(numValues);
for (int i = 0; i < numValues; ++i) {
- PropertyValuesHolder valuesHolder = mValues[i];
- anim.mValuesMap.put(valuesHolder.getPropertyName(), valuesHolder);
+ PropertyValuesHolder newValuesHolder = oldValues[i].clone();
+ anim.mValues[i] = newValuesHolder;
+ anim.mValuesMap.put(newValuesHolder.getPropertyName(), newValuesHolder);
}
}
return anim;