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 isComplete()
          Returns true if the request has successfully completed.
 boolean isFailed()
          Returns true if the request has failed.
 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, Context context, Priority priority, Target<R> target, float sizeMultiplier, Drawable placeholderDrawable, int placeholderResourceId, Drawable errorDrawable, int errorResourceId, RequestListener<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 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,
                                                       Context context,
                                                       Priority priority,
                                                       Target<R> target,
                                                       float sizeMultiplier,
                                                       Drawable placeholderDrawable,
                                                       int placeholderResourceId,
                                                       Drawable errorDrawable,
                                                       int errorResourceId,
                                                       RequestListener<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()

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 successfully completed.

Specified by:
isComplete 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 of the target.
height - The height 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.