Add the ability to autoStart AID from xml

am: 1dd88daf92

Change-Id: I01fc7e34b4e2909f6984b9266e237f3cc9f08432
This commit is contained in:
Leon Scroggins III
2018-03-22 23:38:55 +00:00
committed by android-build-merger
2 changed files with 9 additions and 0 deletions

View File

@@ -5968,6 +5968,9 @@
in the encoded data. Setting this to infinite (-1) will result in the
animation repeating as long as it is displayed (once start() is called). -->
<attr name="repeatCount"/>
<!-- When true, automatically start animating. The default is false, meaning
that the animation will not start until start() is called. -->
<attr name="autoStart" />
</declare-styleable>
<!-- Drawable used to draw bitmaps. -->

View File

@@ -261,6 +261,12 @@ public class AnimatedImageDrawable extends Drawable implements Animatable2 {
if (repeatCount != REPEAT_UNDEFINED) {
this.setRepeatCount(repeatCount);
}
boolean autoStart = a.getBoolean(
R.styleable.AnimatedImageDrawable_autoStart, false);
if (autoStart && mState.mNativePtr != 0) {
this.start();
}
}
/**