Class PreloadTarget<Z>
- java.lang.Object
-
- com.bumptech.glide.request.target.CustomTarget<Z>
-
- com.bumptech.glide.request.target.PreloadTarget<Z>
-
- Type Parameters:
Z- The type of resource that will be loaded into memory.
- All Implemented Interfaces:
LifecycleListener,Target<Z>
public final class PreloadTarget<Z> extends CustomTarget<Z>
A one time useTargetclass that loads a resource into memory and then clears itself.
-
-
Field Summary
-
Fields inherited from interface com.bumptech.glide.request.target.Target
SIZE_ORIGINAL
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <Z> PreloadTarget<Z>obtain(RequestManager requestManager, int width, int height)Returns a PreloadTarget.voidonLoadCleared(android.graphics.drawable.Drawable placeholder)A mandatory lifecycle callback that is called when a load is cancelled and its resources are freed.voidonResourceReady(Z resource, Transition<? super Z> transition)The method that will be called when the resource load has finished.-
Methods inherited from class com.bumptech.glide.request.target.CustomTarget
getRequest, getSize, onDestroy, onLoadFailed, onLoadStarted, onStart, onStop, removeCallback, setRequest
-
-
-
-
Method Detail
-
obtain
public static <Z> PreloadTarget<Z> obtain(RequestManager requestManager, int width, int height)
Returns a PreloadTarget.- Type Parameters:
Z- The type of the desired resource.- Parameters:
width- The width in pixels of the desired resource.height- The height in pixels of the desired resource.
-
onResourceReady
public void onResourceReady(@NonNull Z resource, @Nullable Transition<? super Z> transition)Description copied from interface:TargetThe method that will be called when the resource load has finished.- Parameters:
resource- the loaded resource.
-
onLoadCleared
public void onLoadCleared(@Nullable android.graphics.drawable.Drawable placeholder)Description copied from interface:TargetA mandatory lifecycle callback that is called when a load is cancelled and its resources are freed.You must ensure that any current Drawable received in
Target.onResourceReady(Object, Transition)is no longer used before redrawing the container (usually a View) or changing its visibility.- Parameters:
placeholder- The placeholder drawable to optionally show, or null.
-
-