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>
A one time use
Target class 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
Modifier and TypeMethodDescriptionstatic <Z> PreloadTarget<Z>obtain(RequestManager requestManager, int width, int height) Returns a PreloadTarget.voidonLoadCleared(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 Details
-
obtain
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
Description copied from interface:TargetThe method that will be called when the resource load has finished.This may be called multiple times both within a single load and also across different loads if the
Targetobject is re-used.Within a single load this may be called multiple times for reasons that include:
- The load uses one or more thumbnails. Each time a thumbnail load completes successfully
and no higher priority load has finished, this method will be called with the thumbnail
resource. See
RequestBuilder.thumbnail(com.bumptech.glide.RequestBuilder). - The load is paused and restarted. This can happen automatically in response to
connectivity changes or the Activity / Fragment lifecycle. It can also happen if
RequestManager.pauseRequests()is called manually.
- Parameters:
resource- the loaded resource.
- The load uses one or more thumbnails. Each time a thumbnail load completes successfully
and no higher priority load has finished, this method will be called with the thumbnail
resource. See
-
onLoadCleared
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.
-