-
- All Implemented Interfaces:
-
com.mobwith.imgmodule.request.Request,com.mobwith.imgmodule.request.ResourceCallback,com.mobwith.imgmodule.request.target.SizeReadyCallback
public final class SingleRequest<R> implements Request, SizeReadyCallback, ResourceCallback
A Request that loads a com.mobwith.imgmodule.load.engine.Resource into a given Target.
-
-
Method Summary
Modifier and Type Method Description static <R> SingleRequest<R>obtain(Context context, ImageContext imageContext, Object requestLock, Object model, Class<R> transcodeClass, BaseRequestOptions<out Object> requestOptions, int overrideWidth, int overrideHeight, Priority priority, Target<R> target, RequestListener<R> targetListener, @Nullable() List<RequestListener<R>> requestListeners, RequestCoordinator requestCoordinator, Engine engine, TransitionFactory<out Object> animationFactory, Executor callbackExecutor)voidbegin()Starts an asynchronous load. voidclear()Cancels the current load if it is in progress, clears any resources held onto by the requestand replaces the loaded resource if the load completed with the placeholder. voidpause()Similar to clear for in progress requests (or portions of a request), but does nothingif the request is already complete. booleanisRunning()Returns true if this request is running and has not completed or failed. booleanisComplete()Returns true if the request has completed successfully. booleanisCleared()Returns true if the request has been cleared. booleanisAnyResourceSet()Returns true if a resource is set, even if the request is not yet complete or the primaryrequest has failed. voidonSizeReady(int width, int height)A callback method that should never be invoked directly. voidonResourceReady(Resource<out Object> resource, DataSource dataSource, boolean isLoadedFromAlternateCacheKey)A callback method that should never be invoked directly. voidonLoadFailed(ImageModuleException e)A callback method that should never be invoked directly. ObjectgetLock()Returns the lock to use when notifying individual requests. booleanisEquivalentTo(Request o)Returns {@code true}if this Request is equivalent to the given Request (hasall of the same options and sizes).-
-
Method Detail
-
obtain
static <R> SingleRequest<R> obtain(Context context, ImageContext imageContext, Object requestLock, Object model, Class<R> transcodeClass, BaseRequestOptions<out Object> requestOptions, int overrideWidth, int overrideHeight, Priority priority, Target<R> target, RequestListener<R> targetListener, @Nullable() List<RequestListener<R>> requestListeners, RequestCoordinator requestCoordinator, Engine engine, TransitionFactory<out Object> animationFactory, Executor callbackExecutor)
-
begin
void begin()
Starts an asynchronous load.
-
clear
void clear()
Cancels the current load if it is in progress, clears any resources held onto by the requestand replaces the loaded resource if the load completed with the placeholder.
Cleared requests can be restarted with a subsequent call to begin
-
pause
void pause()
Similar to clear for in progress requests (or portions of a request), but does nothingif the request is already complete.
Unlike clear, this method allows implementations to act differently on subpartsof a request. For example if a Request has both a thumbnail and a primary request and thethumbnail portion of the request is complete, this method allows only the primary portion ofthe request to be paused without clearing the previously completed thumbnail portion.
-
isRunning
boolean isRunning()
Returns true if this request is running and has not completed or failed.
-
isComplete
boolean isComplete()
Returns true if the request has completed successfully.
-
isCleared
boolean isCleared()
Returns true if the request has been cleared.
-
isAnyResourceSet
boolean isAnyResourceSet()
Returns true if a resource is set, even if the request is not yet complete or the primaryrequest has failed.
-
onSizeReady
void onSizeReady(int width, int height)
A callback method that should never be invoked directly.
-
onResourceReady
void onResourceReady(Resource<out Object> resource, DataSource dataSource, boolean isLoadedFromAlternateCacheKey)
A callback method that should never be invoked directly.
-
onLoadFailed
void onLoadFailed(ImageModuleException e)
A callback method that should never be invoked directly.
-
isEquivalentTo
boolean isEquivalentTo(Request o)
Returns
{@code true}if this Request is equivalent to the given Request (hasall of the same options and sizes).This method is identical to equals except that it's specific to Request subclasses. We do not use equals directly because wetrack Requests in collections like java.util.Set and it's perfectly legitimateto have two different Request objects for two different s (for example). Using a similar but different methodlet's us selectively compare Request objects to each other when it's useful in specificscenarios.
-
-
-
-