T
- type of the wrapped Drawable
public abstract class DrawableResource<T extends Drawable> extends Object implements Resource<T>, Initializable
Drawable
which returns a
new drawable
based on it's state
.
Suggested usages only include T
s where the new drawable is of the same or descendant
class.Constructor and Description |
---|
DrawableResource(T drawable) |
Modifier and Type | Method and Description |
---|---|
T |
get()
Returns an instance of the wrapped resource.
|
void |
initialize()
Called on a background thread so the
Resource can do some eager initialization. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getResourceClass, getSize, recycle
public DrawableResource(T drawable)
@NonNull public final T get()
Resource
Note - This does not have to be the same instance of the wrapped resource class and in fact
it is often appropriate to return a new instance for each call. For example,
Drawable
s should only be used by a single
View
at a time so each call to this method for Resources that wrap
Drawable
s should always return a new
Drawable
.
public void initialize()
Initializable
Resource
can do some eager initialization.initialize
in interface Initializable