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

Commit ee684556 authored by Doris Liu's avatar Doris Liu
Browse files

Correct isRunning() behavior for AnimatorSet

isRunning() for an Animator indicates whether an animator has gone
past its start delay and not yet finished. As a subclass of Animator,
AnimatorSet should follow the same principle. The implemention prior
to this CL returns whether any child animation is running, which is
inconsistent with the javadoc for isRunning() and general behavior
for Animator.

Change-Id: Iece814dfcd609ee292dbc00bd55dc64c7bda8e57
parent 35ede6a9
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -408,15 +408,18 @@ public final class AnimatorSet extends Animator {

    /**
     * Returns true if any of the child animations of this AnimatorSet have been started and have
     * not yet ended.
     * @return Whether this AnimatorSet has been started and has not yet ended.
     * not yet ended. Child animations will not be started until the AnimatorSet has gone past
     * its initial delay set through {@link #setStartDelay(long)}.
     *
     * @return Whether this AnimatorSet has gone past the initial delay, and at least one child
     *         animation has been started and not yet ended.
     */
    @Override
    public boolean isRunning() {
        int size = mNodes.size();
        for (int i = 0; i < size; i++) {
            Node node = mNodes.get(i);
            if (node != mRootNode && node.mAnimation.isRunning()) {
            if (node != mRootNode && node.mAnimation.isStarted()) {
                return true;
            }
        }