com.bumptech.glide.request
Class GenericRequest<A,T,Z,R>

java.lang.Object
  extended by com.bumptech.glide.request.GenericRequest<A,T,Z,R>
Type Parameters:
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.
All Implemented Interfaces:
Request, ResourceCallback, SizeReadyCallback

public final class GenericRequest<A,T,Z,R>
extends Object
implements Request, SizeReadyCallback, ResourceCallback

A Request that loads a Resource into a given Target.


Method Summary
 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, 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

obtain

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,
                                                       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)

recycle

public void recycle()
Description copied from interface: Request
Recycles the request object and releases its resources.

Specified by:
recycle in interface Request

begin

public void begin()
Starts an asynchronous load.

Specified by:
begin in interface Request

clear

public 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.

Cleared requests can be restarted with a subsequent call to begin()

Specified by:
clear in interface Request
See Also:
cancel()

isPaused

public boolean isPaused()
Description copied from interface: Request
Returns true if this request is paused and may be restarted.

Specified by:
isPaused in interface Request

pause

public void pause()
Description copied from interface: Request
Identical to Request.clear() except that the request may later be restarted.

Specified by:
pause in interface Request

isRunning

public boolean isRunning()
Returns true if this request is running and has not completed or failed.

Specified by:
isRunning in interface Request

isComplete

public boolean isComplete()
Returns true if the request has completed successfully.

Specified by:
isComplete in interface Request

isResourceSet

public boolean isResourceSet()
Returns true if a non-placeholder resource is set. For Requests that load more than one resource, isResourceSet may return true even if Request.isComplete()} returns false.

Specified by:
isResourceSet in interface Request

isCancelled

public boolean isCancelled()
Returns true if the request has been cancelled.

Specified by:
isCancelled in interface Request

isFailed

public boolean isFailed()
Returns true if the request has failed.

Specified by:
isFailed in interface Request

onSizeReady

public void onSizeReady(int width,
                        int height)
A callback method that should never be invoked directly.

Specified by:
onSizeReady in interface SizeReadyCallback
Parameters:
width - The width in pixels of the target.
height - The height in pixels of the target.

onResourceReady

public void onResourceReady(Resource<?> resource)
A callback method that should never be invoked directly.

Specified by:
onResourceReady in interface ResourceCallback
Parameters:
resource - The loaded resource.

onException

public void onException(Exception e)
A callback method that should never be invoked directly.

Specified by:
onException in interface ResourceCallback
Parameters:
e - The exception that caused the failure, or null it the load failed for some reason other than an exception.