DrawableWrapperCompat


public class DrawableWrapperCompat extends Drawable implements Drawable.Callback


Drawable which delegates all calls to its wrapped Drawable.

The wrapped Drawablemust be fully released from any View before wrapping, otherwise internal Callback may be dropped.

Adapted from platform class, altered with API level checks as necessary.

Summary

Public constructors

Creates a new wrapper around the specified drawable.

Public methods

void
draw(@NonNull Canvas canvas)
int
Drawable
@Nullable Drawable
int
int
int
int
int

This method is deprecated.

boolean
getPadding(Rect padding)
int[]
Region
void
boolean
boolean
void
void
scheduleDrawable(Drawable who, Runnable what, long when)
void
setAlpha(int alpha)
void
setAutoMirrored(boolean mirrored)
void
void
void
setDither(boolean dither)

This method is deprecated.

void

Sets the wrapped drawable.

void
setFilterBitmap(boolean filter)
void
setHotspot(float x, float y)
void
setHotspotBounds(int left, int top, int right, int bottom)
boolean
setState(int[] stateSet)
void
setTint(int tint)
void
void
boolean
setVisible(boolean visible, boolean restart)
void

Protected methods

void
boolean
onLevelChange(int level)

Inherited methods

From android.graphics.drawable.Drawable
void
boolean
void
final Rect
final void
copyBounds(Rect bounds)
static Drawable
static Drawable
createFromResourceStream(
    Resources res,
    TypedValue value,
    InputStream is,
    String srcName
)
static Drawable
static Drawable
static Drawable
createFromXmlInner(
    Resources r,
    XmlPullParser parser,
    AttributeSet attrs
)
int
final Rect
Drawable.Callback
ColorFilter
Drawable.ConstantState
Rect
void
int
final int
Insets
void
boolean
void
void
boolean
boolean
final boolean
Drawable
boolean
onLayoutDirectionChanged(int layoutDirection)
boolean
onStateChange(int[] state)
static int
resolveOpacity(int op1, int op2)
void
scheduleSelf(Runnable what, long when)
void
setBounds(int left, int top, int right, int bottom)
final void
final boolean
setLayoutDirection(int layoutDirection)
final boolean
setLevel(int level)
void
void

Public constructors

DrawableWrapperCompat

Added in 1.6.0
public DrawableWrapperCompat(Drawable drawable)

Creates a new wrapper around the specified drawable.

Public methods

draw

Added in 1.6.0
public void draw(@NonNull Canvas canvas)

getChangingConfigurations

public int getChangingConfigurations()

getCurrent

public Drawable getCurrent()

getDrawable

Added in 1.6.0
public @Nullable Drawable getDrawable()
Returns
@Nullable Drawable

the wrapped drawable

getIntrinsicHeight

public int getIntrinsicHeight()

getIntrinsicWidth

public int getIntrinsicWidth()

getMinimumHeight

public int getMinimumHeight()

getMinimumWidth

public int getMinimumWidth()

getOpacity

Added in 1.6.0
public int getOpacity()

getPadding

public boolean getPadding(Rect padding)

getState

public int[] getState()

getTransparentRegion

public Region getTransparentRegion()

invalidateDrawable

Added in 1.6.0
public void invalidateDrawable(Drawable who)

isAutoMirrored

public boolean isAutoMirrored()

isStateful

public boolean isStateful()

jumpToCurrentState

public void jumpToCurrentState()

scheduleDrawable

Added in 1.6.0
public void scheduleDrawable(Drawable who, Runnable what, long when)

setAlpha

Added in 1.6.0
public void setAlpha(int alpha)

setAutoMirrored

public void setAutoMirrored(boolean mirrored)

setChangingConfigurations

public void setChangingConfigurations(int configs)

setColorFilter

Added in 1.6.0
public void setColorFilter(ColorFilter cf)

setDither

Added in 1.6.0
public void setDither(boolean dither)

setDrawable

Added in 1.6.0
public void setDrawable(@Nullable Drawable drawable)

Sets the wrapped drawable.

Parameters
@Nullable Drawable drawable

the wrapped drawable

setFilterBitmap

public void setFilterBitmap(boolean filter)

setHotspot

public void setHotspot(float x, float y)

setHotspotBounds

public void setHotspotBounds(int left, int top, int right, int bottom)

setState

public boolean setState(int[] stateSet)

setTint

public void setTint(int tint)

setTintList

public void setTintList(ColorStateList tint)

setTintMode

public void setTintMode(PorterDuff.Mode tintMode)

setVisible

public boolean setVisible(boolean visible, boolean restart)

unscheduleDrawable

Added in 1.6.0
public void unscheduleDrawable(Drawable who, Runnable what)

Protected methods

onBoundsChange

protected void onBoundsChange(Rect bounds)

onLevelChange

protected boolean onLevelChange(int level)