Class AnimatedImageDrawable
java.lang.Object
icyllis.modernui.graphics.drawable.Drawable
icyllis.modernui.graphics.drawable.AnimatedImageDrawable
- All Implemented Interfaces:
Animatable
,Animatable2
Drawable
for drawing animated images (like GIF).
The framework handles decoding subsequent frames in another thread and updating when necessary. The drawable will only animate while it is being displayed.
-
Nested Class Summary
Nested classes/interfaces inherited from class icyllis.modernui.graphics.drawable.Drawable
Drawable.Callback, Drawable.ConstantState
Nested classes/interfaces inherited from interface icyllis.modernui.graphics.drawable.Animatable2
Animatable2.AnimationCallback
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Removes all existing animation callbacks.void
Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha).static Executor
boolean
Indicates whether the animation is running.void
Adds a callback to listen to the animation events.void
start()
Starts the drawable's animation.void
stop()
Stops the drawable's animation.boolean
Removes the specified animation callback.Methods inherited from class icyllis.modernui.graphics.drawable.Drawable
applyTheme, canApplyTheme, clearMutated, copyBounds, copyBounds, getAlpha, getBounds, getCallback, getChangingConfigurations, getColorFilter, getConstantState, getCurrent, getHotspotBounds, getIntrinsicHeight, getIntrinsicWidth, getLayoutDirection, getLevel, getMinimumHeight, getMinimumWidth, getPadding, getState, hasFocusStateSpecified, invalidateSelf, isAutoMirrored, isStateful, isVisible, jumpToCurrentState, mutate, onBoundsChange, onLayoutDirectionChanged, onLevelChange, onStateChange, scaleFromDensity, scaleFromDensity, scheduleSelf, setAlpha, setAutoMirrored, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setHotspot, setHotspotBounds, setLayoutDirection, setLevel, setState, setTint, setTintBlendMode, setTintList, setVisible, unscheduleSelf
-
Constructor Details
-
AnimatedImageDrawable
public AnimatedImageDrawable()
-
-
Method Details
-
getAnimatedImageExecutor
-
start
public void start()Description copied from interface:Animatable
Starts the drawable's animation.- Specified by:
start
in interfaceAnimatable
-
stop
public void stop()Description copied from interface:Animatable
Stops the drawable's animation.- Specified by:
stop
in interfaceAnimatable
-
isRunning
public boolean isRunning()Description copied from interface:Animatable
Indicates whether the animation is running.- Specified by:
isRunning
in interfaceAnimatable
- Returns:
- True if the animation is running, false otherwise.
-
registerAnimationCallback
Description copied from interface:Animatable2
Adds a callback to listen to the animation events.- Specified by:
registerAnimationCallback
in interfaceAnimatable2
- Parameters:
callback
- Callback to add.
-
unregisterAnimationCallback
Description copied from interface:Animatable2
Removes the specified animation callback.- Specified by:
unregisterAnimationCallback
in interfaceAnimatable2
- Parameters:
callback
- Callback to remove.- Returns:
false
if callback didn't exist in the call back list, ortrue
if callback has been removed successfully.
-
clearAnimationCallbacks
public void clearAnimationCallbacks()Description copied from interface:Animatable2
Removes all existing animation callbacks.- Specified by:
clearAnimationCallbacks
in interfaceAnimatable2
-
draw
Description copied from class:Drawable
Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha).
-