Package icyllis.modernui.graphics.drawable

# Class AnimatedImageDrawable

java.lang.Object
icyllis.modernui.graphics.drawable.Drawable
icyllis.modernui.graphics.drawable.AnimatedImageDrawable

All Implemented Interfaces:
  `Animatable`, `Animatable2`

public class AnimatedImageDrawable extends Drawable implements 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

  ### Fields inherited from class icyllis.modernui.graphics.drawable.Drawable

  `MAX_LEVEL`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AnimatedImageDrawable()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clearAnimationCallbacks()`
  Removes all existing animation callbacks.
  `void`
  `draw(Canvas canvas)`
  Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha).
  `static Executor`
  `getAnimatedImageExecutor()`
  `boolean`
  `isRunning()`
  Indicates whether the animation is running.
  `void`
  `registerAnimationCallback(Animatable2.AnimationCallback callback)`
  Adds a callback to listen to the animation events.
  `void`
  `start()`
  Starts the drawable's animation.
  `void`
  `stop()`
  Stops the drawable's animation.
  `boolean`
  `unregisterAnimationCallback(Animatable2.AnimationCallback callback)`
  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`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AnimatedImageDrawable

    public AnimatedImageDrawable()

- ## Method Details

  - ### getAnimatedImageExecutor

    @Internal public static Executor getAnimatedImageExecutor()

  - ### start

    public void start()
    Description copied from interface: `Animatable`
    Starts the drawable's animation.
    Specified by:
      `start` in interface `Animatable`

  - ### stop

    public void stop()
    Description copied from interface: `Animatable`
    Stops the drawable's animation.
    Specified by:
      `stop` in interface `Animatable`

  - ### isRunning

    public boolean isRunning()
    Description copied from interface: `Animatable`
    Indicates whether the animation is running.
    Specified by:
      `isRunning` in interface `Animatable`
    Returns:
      True if the animation is running, false otherwise.

  - ### registerAnimationCallback

    public void registerAnimationCallback(@NonNull Animatable2.AnimationCallback callback)
    Description copied from interface: `Animatable2`
    Adds a callback to listen to the animation events.
    Specified by:
      `registerAnimationCallback` in interface `Animatable2`
    Parameters:
      `callback` - Callback to add.

  - ### unregisterAnimationCallback

    public boolean unregisterAnimationCallback(@NonNull Animatable2.AnimationCallback callback)
    Description copied from interface: `Animatable2`
    Removes the specified animation callback.
    Specified by:
      `unregisterAnimationCallback` in interface `Animatable2`
    Parameters:
      `callback` - Callback to remove.
    Returns:
      `false` if callback didn't exist in the call back list, or `true` if callback has been removed successfully.

  - ### clearAnimationCallbacks

    public void clearAnimationCallbacks()
    Description copied from interface: `Animatable2`
    Removes all existing animation callbacks.
    Specified by:
      `clearAnimationCallbacks` in interface `Animatable2`

  - ### draw

    public void draw(@NonNull Canvas canvas)
    Description copied from class: `Drawable`
    Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha).
    Specified by:
      `draw` in class `Drawable`
    Parameters:
      `canvas` - The canvas to draw into