public static abstract class

XResources.DrawableLoader

extends Object
java.lang.Object
   ↳ android.content.res.XResources.DrawableLoader

Class Overview

Callback for drawable replacements. Instances of this class can passed to XResources.setReplacement(String, String, String, Object) and its variants.

Make sure to always return new Drawable instances, as drawables usually can't be reused.

Summary

Public Constructors
XResources.DrawableLoader()
Constructor.
Public Methods
abstract Drawable newDrawable(XResources res, int id)
Called when the hooked drawable resource has been requested.
Drawable newDrawableForDensity(XResources res, int id, int density)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public XResources.DrawableLoader ()

Constructor.

Public Methods

public abstract Drawable newDrawable (XResources res, int id)

Called when the hooked drawable resource has been requested.

Parameters
res The XResources object in which the hooked drawable resides.
id The resource ID which has been requested.
Returns
  • The Drawable which should be used as replacement. null is ignored.
Throws
Throwable Everything the callback throws is caught and logged.

public Drawable newDrawableForDensity (XResources res, int id, int density)

Like newDrawable(XResources, int), but called for Resources.getDrawableForDensity(int, int). The default implementation is to use the result of newDrawable(XResources, int).

Parameters
res The XResources object in which the hooked drawable resides.
id The resource ID which has been requested.
density The desired screen density indicated by the resource as found in DisplayMetrics.
Returns
  • The Drawable which should be used as replacement. null is ignored.
Throws
Throwable Everything the callback throws is caught and logged.