diff options
| author | 2011-12-19 15:49:42 -0800 | |
|---|---|---|
| committer | 2011-12-19 15:49:42 -0800 | |
| commit | f7917e656b94ec2adfc3fa826e093665d39748d2 (patch) | |
| tree | 810e97e5f32b2fd7af5d9d1b2ce9b51e2e691ab9 | |
| parent | 01583ef715641c8a3ce68269b091e75adbe9335a (diff) | |
Fix AnimationDrawable double-start bug
AnimationDrawable.setVisible(true, true) was not correctly recording
the fact that it had started the animation, so it was possible to call
start(0 immediately afterwards and have two animations running on the
drawable in parallel, resulting in incorrect frame ordering.
Issue #5782773
Change-Id: Ifc328f755a51d10ab76b84006d1999df03d2dca1
| -rw-r--r-- | graphics/java/android/graphics/drawable/AnimationDrawable.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/graphics/java/android/graphics/drawable/AnimationDrawable.java b/graphics/java/android/graphics/drawable/AnimationDrawable.java index 7efdc6cf0203..f02d0f99ae49 100644 --- a/graphics/java/android/graphics/drawable/AnimationDrawable.java +++ b/graphics/java/android/graphics/drawable/AnimationDrawable.java @@ -42,7 +42,7 @@ import android.util.AttributeSet; * <p>spin_animation.xml file in res/drawable/ folder:</p> * <pre><!-- Animation frames are wheel0.png -- wheel5.png files inside the * res/drawable/ folder --> - * <animation-list android:id="selected" android:oneshot="false"> + * <animation-list android:id="@+id/selected" android:oneshot="false"> * <item android:drawable="@drawable/wheel0" android:duration="50" /> * <item android:drawable="@drawable/wheel1" android:duration="50" /> * <item android:drawable="@drawable/wheel2" android:duration="50" /> @@ -216,6 +216,8 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An unscheduleSelf(this); } if (animate) { + // Unscheduling may have clobbered this value; restore it to record that we're animating + mCurFrame = frame; scheduleSelf(this, SystemClock.uptimeMillis() + mAnimationState.mDurations[frame]); } } |