Package icyllis.modernui.graphics.drawable

# Class LevelListDrawable

java.lang.Object
icyllis.modernui.graphics.drawable.Drawable
icyllis.modernui.graphics.drawable.DrawableContainer
icyllis.modernui.graphics.drawable.LevelListDrawable

All Implemented Interfaces:
  `Drawable.Callback`

public class LevelListDrawable extends DrawableContainer
A resource that manages a number of alternate Drawables, each assigned a maximum numerical value. Setting the level value of the object with `Drawable.setLevel(int)` will load the image with the next greater or equal value assigned to its max attribute.

A good example use of a LevelListDrawable would be a Wi-Fi signal strength indicator icon, with different images to indicate the current signal level.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class icyllis.modernui.graphics.drawable.DrawableContainer

  `DrawableContainer.DrawableContainerState`

  ## Nested classes/interfaces inherited from class icyllis.modernui.graphics.drawable.Drawable

  `Drawable.Callback, Drawable.ConstantState`

- ## Field Summary

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

  `MAX_LEVEL`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LevelListDrawable()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addLevel(int low, int high, Drawable drawable)`
  `void`
  `clearMutated()`
  Clears the mutated state, allowing this drawable to be cached and mutated again.
  `Drawable`
  `mutate()`
  Make this drawable mutable.
  `protected boolean`
  `onLevelChange(int level)`
  Override this in your subclass to change appearance if you vary based on level.
  `protected void`
  `setConstantState(DrawableContainer.DrawableContainerState state)`

  ### Methods inherited from class icyllis.modernui.graphics.drawable.DrawableContainer

  `draw, getAlpha, getConstantState, getCurrent, getCurrentIndex, getHotspotBounds, getIntrinsicHeight, getIntrinsicWidth, getMinimumHeight, getMinimumWidth, getPadding, hasFocusStateSpecified, invalidateDrawable, isAutoMirrored, isStateful, jumpToCurrentState, onBoundsChange, onLayoutDirectionChanged, onStateChange, scheduleDrawable, selectDrawable, setAlpha, setAutoMirrored, setEnterFadeDuration, setExitFadeDuration, setHotspot, setHotspotBounds, setTintBlendMode, setTintList, setVisible, unscheduleDrawable`

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

  `applyTheme, canApplyTheme, copyBounds, copyBounds, getBounds, getCallback, getChangingConfigurations, getColorFilter, getLayoutDirection, getLevel, getState, invalidateSelf, isVisible, scaleFromDensity, scaleFromDensity, scheduleSelf, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setLayoutDirection, setLevel, setState, setTint, unscheduleSelf`

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

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

- ## Constructor Details

  - ### LevelListDrawable

    public LevelListDrawable()

- ## Method Details

  - ### addLevel

    public void addLevel(int low, int high, Drawable drawable)

  - ### onLevelChange

    protected boolean onLevelChange(int level)
    Description copied from class: `Drawable`
    Override this in your subclass to change appearance if you vary based on level.
    Overrides:
      `onLevelChange` in class `DrawableContainer`
    Returns:
      Returns true if the level change has caused the appearance of the Drawable to change (that is, it needs to be drawn), else false if it looks the same and there is no need to redraw it since its last level.

  - ### mutate

    @NonNull public Drawable mutate()
    Description copied from class: `Drawable`
    Make this drawable mutable. This operation cannot be reversed. A mutable drawable is guaranteed to not share its state with any other drawable. This is especially useful when you need to modify properties of drawables loaded from resources. By default, all drawables instances loaded from the same resource share a common state; if you modify the state of one instance, all the other instances will receive the same modification.

    Calling this method on a mutable Drawable will have no effect.

    Overrides:
      `mutate` in class `DrawableContainer`
    Returns:
      This drawable.
    See Also:
      - `Drawable.ConstantState`
      - `Drawable.getConstantState()`

  - ### clearMutated

    public void clearMutated()
    Description copied from class: `Drawable`
    Clears the mutated state, allowing this drawable to be cached and mutated again.
    Overrides:
      `clearMutated` in class `DrawableContainer`

  - ### setConstantState

    protected void setConstantState(@NonNull DrawableContainer.DrawableContainerState state)
    Overrides:
      `setConstantState` in class `DrawableContainer`