diff options
author | John Spurlock <jspurlock@google.com> | 2013-11-15 17:10:03 -0500 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2013-11-18 15:59:37 -0500 |
commit | 180979f76b0c99cd7053a44692f6408721b74bce (patch) | |
tree | 1f81118ce47d94b87d1422ca96d98cf6171aa1b2 /graphics | |
parent | aff6ea9516ebb4c7e5bf487f7c867f31e8fbbd96 (diff) | |
download | frameworks_base-180979f76b0c99cd7053a44692f6408721b74bce.zip frameworks_base-180979f76b0c99cd7053a44692f6408721b74bce.tar.gz frameworks_base-180979f76b0c99cd7053a44692f6408721b74bce.tar.bz2 |
Fix logic problems in AnimationDrawable and View.
1. View now checks both queues when unscheduling runnables,
fixing the case where work was scheduled pre-attach, and unscheduled
post-attach.
2. AnimationDrawable avoids posting duplicate runnables when rescheduling
itself.
3. Decouple is-animation-running state from current frame pointer in
AnimationDrawable. Some calls init to the first frame, but do not
kick off the animation.
4. Remove workaround in SystemUI's AnimatedImageView (status bar icon)
now that the underlying framework issues are fixed.
Bug:11694594
Change-Id: I77ca6bd80262f7edcf980b2d7efc2592f8051f29
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/drawable/AnimationDrawable.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/graphics/java/android/graphics/drawable/AnimationDrawable.java b/graphics/java/android/graphics/drawable/AnimationDrawable.java index bde978d..02b2588 100644 --- a/graphics/java/android/graphics/drawable/AnimationDrawable.java +++ b/graphics/java/android/graphics/drawable/AnimationDrawable.java @@ -81,6 +81,7 @@ import android.util.AttributeSet; public class AnimationDrawable extends DrawableContainer implements Runnable, Animatable { private final AnimationState mAnimationState; private int mCurFrame = -1; + private boolean mAnimating; private boolean mMutated; public AnimationDrawable() { @@ -137,7 +138,7 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An * @return true if the animation is running, false otherwise */ public boolean isRunning() { - return mCurFrame > -1; + return mAnimating; } /** @@ -153,6 +154,7 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An @Override public void unscheduleSelf(Runnable what) { mCurFrame = -1; + mAnimating = false; super.unscheduleSelf(what); } @@ -222,12 +224,13 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An } mCurFrame = frame; selectDrawable(frame); - if (unschedule) { + if (unschedule || animate) { unscheduleSelf(this); } if (animate) { - // Unscheduling may have clobbered this value; restore it to record that we're animating + // Unscheduling may have clobbered these values; restore them mCurFrame = frame; + mAnimating = true; scheduleSelf(this, SystemClock.uptimeMillis() + mAnimationState.mDurations[frame]); } } |