-
- All Implemented Interfaces:
-
com.mobwith.imgmodule.manager.LifecycleListener,com.mobwith.imgmodule.request.target.Target
public final class PreloadTarget<Z> extends CustomTarget<Z>
A one time use com.mobwith.imgmodule.request.target.Target class that loads a resource into memory and then clears itself.
-
-
Method Summary
Modifier and Type Method Description static <Z> PreloadTarget<Z>obtain(RequestManager requestManager, int width, int height)Returns a PreloadTarget. voidonResourceReady(@NonNull() Z resource, @Nullable() Transition<out Object> transition)The method that will be called when the resource load has finished. voidonLoadCleared(@Nullable() Drawable placeholder)A mandatory lifecycle callback that is called when a load is cancelled and its resourcesare freed. -
Methods inherited from class com.mobwith.imgmodule.request.target.CustomTarget
getRequest, getSize, onDestroy, onLoadFailed, onLoadStarted, onStart, onStop, removeCallback, setRequest -
Methods inherited from class com.mobwith.imgmodule.request.target.Target
onResourceReady -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
obtain
static <Z> PreloadTarget<Z> obtain(RequestManager requestManager, int width, int height)
Returns a PreloadTarget.
- Parameters:
width- The width in pixels of the desired resource.height- The height in pixels of the desired resource.
-
onResourceReady
void onResourceReady(@NonNull() Z resource, @Nullable() Transition<out Object> transition)
The method that will be called when the resource load has finished.
- Parameters:
resource- the loaded resource.
-
onLoadCleared
void onLoadCleared(@Nullable() Drawable placeholder)
A mandatory lifecycle callback that is called when a load is cancelled and its resourcesare freed.
You must ensure that any current Drawable received in onResourceReady is no longer used before redrawing the container (usually a View) or changing itsvisibility.
- Parameters:
placeholder- The placeholder drawable to optionally show, or null.
-
-
-
-