Loading graphics/java/android/graphics/drawable/AnimationDrawable.java +10 −8 Original line number Diff line number Diff line Loading @@ -105,10 +105,12 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An /** * Sets whether this AnimationDrawable is visible. * <p> * When the drawable becomes invisible, it will pause its animation. A * subsequent change to visible with <code>restart</code> set to true will * restart the animation from the first frame. If <code>restart</code> is * false, the animation will resume from the most recent frame. * When the drawable becomes invisible, it will pause its animation. A subsequent change to * visible with <code>restart</code> set to true will restart the animation from the * first frame. If <code>restart</code> is false, the drawable will resume from the most recent * frame. If the drawable has already reached the last frame, it will then loop back to the * first frame, unless it's a one shot drawable (set through {@link #setOneShot(boolean)}), * in which case, it will stay on the last frame. * * @param visible true if visible, false otherwise * @param restart when visible, true to force the animation to restart Loading @@ -120,7 +122,7 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An final boolean changed = super.setVisible(visible, restart); if (visible) { if (restart || changed) { boolean startFromZero = restart || !mRunning || boolean startFromZero = restart || (!mRunning && !mAnimationState.mOneShot) || mCurFrame >= mAnimationState.getChildCount(); setFrame(startFromZero ? 0 : mCurFrame, true, mAnimating); } Loading @@ -131,7 +133,7 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An } /** * Starts the animation, looping if necessary. This method has no effect * Starts the animation from the first frame, looping if necessary. This method has no effect * if the animation is running. * <p> * <strong>Note:</strong> Do not call this in the Loading @@ -158,7 +160,7 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An } /** * Stops the animation. This method has no effect if the animation is not * Stops the animation at the current frame. This method has no effect if the animation is not * running. * * @see #isRunning() Loading @@ -169,6 +171,7 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An mAnimating = false; if (isRunning()) { mCurFrame = 0; unscheduleSelf(this); } } Loading Loading @@ -196,7 +199,6 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An @Override public void unscheduleSelf(Runnable what) { mCurFrame = 0; mRunning = false; super.unscheduleSelf(what); } Loading Loading
graphics/java/android/graphics/drawable/AnimationDrawable.java +10 −8 Original line number Diff line number Diff line Loading @@ -105,10 +105,12 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An /** * Sets whether this AnimationDrawable is visible. * <p> * When the drawable becomes invisible, it will pause its animation. A * subsequent change to visible with <code>restart</code> set to true will * restart the animation from the first frame. If <code>restart</code> is * false, the animation will resume from the most recent frame. * When the drawable becomes invisible, it will pause its animation. A subsequent change to * visible with <code>restart</code> set to true will restart the animation from the * first frame. If <code>restart</code> is false, the drawable will resume from the most recent * frame. If the drawable has already reached the last frame, it will then loop back to the * first frame, unless it's a one shot drawable (set through {@link #setOneShot(boolean)}), * in which case, it will stay on the last frame. * * @param visible true if visible, false otherwise * @param restart when visible, true to force the animation to restart Loading @@ -120,7 +122,7 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An final boolean changed = super.setVisible(visible, restart); if (visible) { if (restart || changed) { boolean startFromZero = restart || !mRunning || boolean startFromZero = restart || (!mRunning && !mAnimationState.mOneShot) || mCurFrame >= mAnimationState.getChildCount(); setFrame(startFromZero ? 0 : mCurFrame, true, mAnimating); } Loading @@ -131,7 +133,7 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An } /** * Starts the animation, looping if necessary. This method has no effect * Starts the animation from the first frame, looping if necessary. This method has no effect * if the animation is running. * <p> * <strong>Note:</strong> Do not call this in the Loading @@ -158,7 +160,7 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An } /** * Stops the animation. This method has no effect if the animation is not * Stops the animation at the current frame. This method has no effect if the animation is not * running. * * @see #isRunning() Loading @@ -169,6 +171,7 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An mAnimating = false; if (isRunning()) { mCurFrame = 0; unscheduleSelf(this); } } Loading Loading @@ -196,7 +199,6 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An @Override public void unscheduleSelf(Runnable what) { mCurFrame = 0; mRunning = false; super.unscheduleSelf(what); } Loading