R
- The type of the resource that will be transcoded from the loaded resource.public final class SingleRequest<R> extends Object implements Request, SizeReadyCallback, ResourceCallback, FactoryPools.Poolable
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.
|
StateVerifier |
getVerifier() |
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 put.
|
boolean |
isRunning()
Returns true if this request is running and has not completed or failed.
|
static <R> SingleRequest<R> |
obtain(GlideContext glideContext,
Object model,
Class<R> transcodeClass,
RequestOptions requestOptions,
int overrideWidth,
int overrideHeight,
Priority priority,
Target<R> target,
RequestListener<R> requestListener,
RequestCoordinator requestCoordinator,
Engine engine,
TransitionFactory<? super R> animationFactory) |
void |
onLoadFailed(GlideException e)
A callback method that should never be invoked directly.
|
void |
onResourceReady(Resource<?> resource,
DataSource dataSource)
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 <R> SingleRequest<R> obtain(GlideContext glideContext, Object model, Class<R> transcodeClass, RequestOptions requestOptions, int overrideWidth, int overrideHeight, Priority priority, Target<R> target, RequestListener<R> requestListener, RequestCoordinator requestCoordinator, Engine engine, TransitionFactory<? super R> animationFactory)
public StateVerifier getVerifier()
getVerifier
in interface FactoryPools.Poolable
public void recycle()
Request
public void begin()
Request
public void clear()
Cleared requests can be restarted with a subsequent call to begin()
public boolean isPaused()
Request
public void pause()
Request
Request.clear()
except that the request may later be restarted.public boolean isRunning()
Request
public boolean isComplete()
Request
isComplete
in interface Request
public boolean isResourceSet()
Request
Request.isComplete()
} returns false.isResourceSet
in interface Request
public boolean isCancelled()
Request
isCancelled
in interface Request
public boolean isFailed()
Request
public void onSizeReady(int width, int height)
onSizeReady
in interface SizeReadyCallback
width
- 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, DataSource dataSource)
onResourceReady
in interface ResourceCallback
resource
- The loaded resource.public void onLoadFailed(GlideException e)
onLoadFailed
in interface ResourceCallback
e
- a non-null GlideException
.