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

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

Merge "Add methods to AnimatorSet that take collections"

parents 63c327de 37a7bec5
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -19042,6 +19042,19 @@
<parameter name="items" type="android.animation.Animator...">
</parameter>
</method>
<method name="playSequentially"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="items" type="java.util.List&lt;android.animation.Animator&gt;">
</parameter>
</method>
<method name="playTogether"
 return="void"
 abstract="false"
@@ -19055,6 +19068,19 @@
<parameter name="items" type="android.animation.Animator...">
</parameter>
</method>
<method name="playTogether"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="items" type="java.util.Collection&lt;android.animation.Animator&gt;">
</parameter>
</method>
<method name="setDuration"
 return="android.animation.AnimatorSet"
 abstract="false"
+41 −1
Original line number Diff line number Diff line
@@ -17,7 +17,9 @@
package android.animation;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;

/**
 * This class plays a set of {@link Animator} objects in the specified order. Animations
@@ -116,11 +118,30 @@ public final class AnimatorSet extends Animator {
        }
    }

    /**
     * Sets up this AnimatorSet to play all of the supplied animations at the same time.
     *
     * @param items The animations that will be started simultaneously.
     */
    public void playTogether(Collection<Animator> items) {
        if (items != null && items.size() > 0) {
            mNeedsSort = true;
            Builder builder = null;
            for (Animator anim : items) {
                if (builder == null) {
                    builder = play(anim);
                } else {
                    builder.with(anim);
                }
            }
        }
    }

    /**
     * Sets up this AnimatorSet to play each of the supplied animations when the
     * previous animation ends.
     *
     * @param items The aniamtions that will be started one after another.
     * @param items The animations that will be started one after another.
     */
    public void playSequentially(Animator... items) {
        if (items != null) {
@@ -135,6 +156,25 @@ public final class AnimatorSet extends Animator {
        }
    }

    /**
     * Sets up this AnimatorSet to play each of the supplied animations when the
     * previous animation ends.
     *
     * @param items The animations that will be started one after another.
     */
    public void playSequentially(List<Animator> items) {
        if (items != null && items.size() > 0) {
            mNeedsSort = true;
            if (items.size() == 1) {
                play(items.get(0));
            } else {
                for (int i = 0; i < items.size() - 1; ++i) {
                    play(items.get(i)).before(items.get(i+1));
                }
            }
        }
    }

    /**
     * Returns the current list of child Animator objects controlled by this
     * AnimatorSet. This is a copy of the internal list; modifications to the returned list