summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Leon Scroggins III <scroggo@google.com> 2018-01-29 19:51:35 -0500
committer Leon Scroggins III <scroggo@google.com> 2018-01-29 21:08:56 -0500
commit1996dbb19cd43d0ffa034cafe460fe27342e584e (patch)
tree09f79f046cd99b10fc49543bf01345e7cbc45c8c
parent5b7f426ff04820f81877ccb696bf6245dede89e7 (diff)
Make AnimatedImageDrawable.start reset
Bug: b/63908092 Test: Manual: Ie18811ba29a1db163aca08472b04ae185e9344f0 If the animation has already started and stopped (via stop()), restart the animatino on a call to start(). Change-Id: I0a14a1e643f32469fe5519949ee8ef046107e9a8
-rw-r--r--graphics/java/android/graphics/drawable/AnimatedImageDrawable.java3
-rw-r--r--libs/hwui/hwui/AnimatedImageDrawable.cpp3
2 files changed, 5 insertions, 1 deletions
diff --git a/graphics/java/android/graphics/drawable/AnimatedImageDrawable.java b/graphics/java/android/graphics/drawable/AnimatedImageDrawable.java
index 4328109937c1..bd49b87ec200 100644
--- a/graphics/java/android/graphics/drawable/AnimatedImageDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimatedImageDrawable.java
@@ -319,7 +319,8 @@ public class AnimatedImageDrawable extends Drawable implements Animatable2 {
/**
* Start the animation.
*
- * <p>Does nothing if the animation is already running.
+ * <p>Does nothing if the animation is already running. If the animation is stopped,
+ * this will reset it.</p>
*
* <p>If the animation starts, this will call
* {@link Animatable2.AnimationCallback#onAnimationStart}.</p>
diff --git a/libs/hwui/hwui/AnimatedImageDrawable.cpp b/libs/hwui/hwui/AnimatedImageDrawable.cpp
index 264b95e0e6dc..5356d3bfc7c9 100644
--- a/libs/hwui/hwui/AnimatedImageDrawable.cpp
+++ b/libs/hwui/hwui/AnimatedImageDrawable.cpp
@@ -41,6 +41,9 @@ bool AnimatedImageDrawable::start() {
return false;
}
+ // This will trigger a reset.
+ mFinished = true;
+
mRunning = true;
return true;
}