summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2012-04-12 07:51:50 -0700
committerChet Haase <chet@google.com>2012-04-12 07:51:50 -0700
commitc299a3384171e36fc9ab6d1011d8a589a7f344d1 (patch)
tree6b9516e362350f584a3f837863482f2c846eb5a7 /core
parent0a1c6c8bc76716c482fc32e140975d7a1bffdd4b (diff)
downloadframeworks_base-c299a3384171e36fc9ab6d1011d8a589a7f344d1.zip
frameworks_base-c299a3384171e36fc9ab6d1011d8a589a7f344d1.tar.gz
frameworks_base-c299a3384171e36fc9ab6d1011d8a589a7f344d1.tar.bz2
Fix AnimatorSet duration issue
Setting the duration on an AnimatorSet should propagate that value to its children. This works, but only if all children are added to the set before setDuration() is called. This fix delays that propagation until the set is started, making it possible to have a more flexible order of when the children are added and when the duration is set. Issue #6324904 AnimatorSet durations too long Change-Id: I797971c2310eb2e3fe931b4aa35de505f2a519f7
Diffstat (limited to 'core')
-rw-r--r--core/java/android/animation/AnimatorSet.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/core/java/android/animation/AnimatorSet.java b/core/java/android/animation/AnimatorSet.java
index c5a4171..f9fa444 100644
--- a/core/java/android/animation/AnimatorSet.java
+++ b/core/java/android/animation/AnimatorSet.java
@@ -420,11 +420,7 @@ public final class AnimatorSet extends Animator {
if (duration < 0) {
throw new IllegalArgumentException("duration must be a value of zero or greater");
}
- for (Node node : mNodes) {
- // TODO: don't set the duration of the timing-only nodes created by AnimatorSet to
- // insert "play-after" delays
- node.animation.setDuration(duration);
- }
+ // Just record the value for now - it will be used later when the AnimatorSet starts
mDuration = duration;
return this;
}
@@ -456,6 +452,14 @@ public final class AnimatorSet extends Animator {
mTerminated = false;
mStarted = true;
+ if (mDuration >= 0) {
+ // If the duration was set on this AnimatorSet, pass it along to all child animations
+ for (Node node : mNodes) {
+ // TODO: don't set the duration of the timing-only nodes created by AnimatorSet to
+ // insert "play-after" delays
+ node.animation.setDuration(mDuration);
+ }
+ }
// First, sort the nodes (if necessary). This will ensure that sortedNodes
// contains the animation nodes in the correct order.
sortNodes();