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

Commit f5534a07 authored by Chet Haase's avatar Chet Haase
Browse files

Fixes for AnimationDrawable

Set up AnimationDrawable with an initial frame when it is
constructed from code (via addFrame()). This is equivalent to
what is done when it is constructed via xml resources.

Change-Id: I86784a241268aa2d03af8edecbc80a7cc3548e19
parent 8239b95d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ import android.util.AttributeSet;
 * AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground();
 *
 * // Start the animation (looped playback by default).
 * frameAnimation.start()
 * frameAnimation.start();
 * </pre>
 * <p>For more information, see the guide to <a
 * href="{@docRoot}guide/topics/resources/animation-resource.html">Animation Resources</a>.</p>
@@ -192,6 +192,9 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An
     */
    public void addFrame(Drawable frame, int duration) {
        mAnimationState.addFrame(frame, duration);
        if (mCurFrame < 0) {
            setFrame(0, true, false);
        }
    }
    
    private void nextFrame(boolean unschedule) {