Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 793807ff authored by Chet Haase's avatar Chet Haase Committed by Android (Google) Code Review
Browse files

Merge "Fix AnimatorSet duration issue"

parents decd3039 c299a338
Loading
Loading
Loading
Loading
+9 −5
Original line number Original line Diff line number Diff line
@@ -420,11 +420,7 @@ public final class AnimatorSet extends Animator {
        if (duration < 0) {
        if (duration < 0) {
            throw new IllegalArgumentException("duration must be a value of zero or greater");
            throw new IllegalArgumentException("duration must be a value of zero or greater");
        }
        }
        for (Node node : mNodes) {
        // Just record the value for now - it will be used later when the AnimatorSet starts
            // TODO: don't set the duration of the timing-only nodes created by AnimatorSet to
            // insert "play-after" delays
            node.animation.setDuration(duration);
        }
        mDuration = duration;
        mDuration = duration;
        return this;
        return this;
    }
    }
@@ -456,6 +452,14 @@ public final class AnimatorSet extends Animator {
        mTerminated = false;
        mTerminated = false;
        mStarted = true;
        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
        // First, sort the nodes (if necessary). This will ensure that sortedNodes
        // contains the animation nodes in the correct order.
        // contains the animation nodes in the correct order.
        sortNodes();
        sortNodes();