A - The type of the model that the resource will be loaded from.T - The type of the data that the resource will be loaded from.Z - The type of the resource that will be loaded.R - The type of the resource that will be transcoded from the loaded resource.public final class GenericRequest<A,T,Z,R> extends Object implements Request, SizeReadyCallback, ResourceCallback
| Modifier and Type | Method and Description |
|---|---|
void |
begin()
Starts an asynchronous load.
|
void |
clear()
Cancels the current load if it is in progress, clears any resources held onto by the request and replaces
the loaded resource if the load completed with the placeholder.
|
boolean |
isCancelled()
Returns true if the request has been cancelled.
|
boolean |
isComplete()
Returns true if the request has completed successfully.
|
boolean |
isFailed()
Returns true if the request has failed.
|
boolean |
isPaused()
Returns true if this request is paused and may be restarted.
|
boolean |
isResourceSet()
Returns true if a non-placeholder resource is set.
|
boolean |
isRunning()
Returns true if this request is running and has not completed or failed.
|
static <A,T,Z,R> GenericRequest<A,T,Z,R> |
obtain(LoadProvider<A,T,Z,R> loadProvider,
A model,
Key signature,
Context context,
Priority priority,
Target<R> target,
float sizeMultiplier,
Drawable placeholderDrawable,
int placeholderResourceId,
Drawable errorDrawable,
int errorResourceId,
Drawable fallbackDrawable,
int fallbackResourceId,
RequestListener<? super A,R> requestListener,
RequestCoordinator requestCoordinator,
Engine engine,
Transformation<Z> transformation,
Class<R> transcodeClass,
boolean isMemoryCacheable,
GlideAnimationFactory<R> animationFactory,
int overrideWidth,
int overrideHeight,
DiskCacheStrategy diskCacheStrategy) |
void |
onException(Exception e)
A callback method that should never be invoked directly.
|
void |
onResourceReady(Resource<?> resource)
A callback method that should never be invoked directly.
|
void |
onSizeReady(int width,
int height)
A callback method that should never be invoked directly.
|
void |
pause()
Identical to
Request.clear() except that the request may later be restarted. |
void |
recycle()
Recycles the request object and releases its resources.
|
public static <A,T,Z,R> GenericRequest<A,T,Z,R> obtain(LoadProvider<A,T,Z,R> loadProvider, A model, Key signature, Context context, Priority priority, Target<R> target, float sizeMultiplier, Drawable placeholderDrawable, int placeholderResourceId, Drawable errorDrawable, int errorResourceId, Drawable fallbackDrawable, int fallbackResourceId, RequestListener<? super A,R> requestListener, RequestCoordinator requestCoordinator, Engine engine, Transformation<Z> transformation, Class<R> transcodeClass, boolean isMemoryCacheable, GlideAnimationFactory<R> animationFactory, int overrideWidth, int overrideHeight, DiskCacheStrategy diskCacheStrategy)
public void recycle()
Requestpublic void clear()
Cleared requests can be restarted with a subsequent call to begin()
public boolean isPaused()
Requestpublic void pause()
RequestRequest.clear() except that the request may later be restarted.public boolean isRunning()
public boolean isComplete()
isComplete in interface Requestpublic boolean isResourceSet()
Request.isComplete()} returns false.isResourceSet in interface Requestpublic boolean isCancelled()
isCancelled in interface Requestpublic boolean isFailed()
public void onSizeReady(int width,
int height)
onSizeReady in interface SizeReadyCallbackwidth - The width in pixels of the target, or Target.SIZE_ORIGINAL to indicate that we want the
resource at its original width.height - The height in pixels of the target, or Target.SIZE_ORIGINAL to indicate that we want the
resource at its original height.public void onResourceReady(Resource<?> resource)
onResourceReady in interface ResourceCallbackresource - The loaded resource.public void onException(Exception e)
onException in interface ResourceCallbacke - The exception that caused the failure, or null it the load failed for some reason other than an
exception.