public final class ErrorRequestCoordinator extends Object implements RequestCoordinator, Request
Request until it completes and then a fallback error request only
if the single primary request fails.| Constructor and Description |
|---|
ErrorRequestCoordinator(RequestCoordinator coordinator) |
| Modifier and Type | Method and Description |
|---|---|
void |
begin()
Starts an asynchronous load.
|
boolean |
canNotifyStatusChanged(Request request)
Returns true if the
Request can display a placeholder. |
boolean |
canSetImage(Request request)
Returns true if the
Request can display a loaded bitmap. |
void |
clear()
Prevents any bitmaps being loaded from previous requests, releases any resources held by this
request, displays the current placeholder if one was provided, and marks the request as having
been cancelled.
|
boolean |
isAnyResourceSet()
Returns true if any coordinated
Request has successfully completed. |
boolean |
isCancelled()
Returns true if the request has been cancelled.
|
boolean |
isComplete()
Returns true if the request has completed successfully.
|
boolean |
isEquivalentTo(Request o)
|
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.
|
void |
onRequestFailed(Request request)
Must be called when a
Request coordinated by this object fails. |
void |
onRequestSuccess(Request request)
Must be called when a
Request coordinated by this object completes successfully. |
void |
pause()
Identical to
Request.clear() except that the request may later be restarted. |
void |
recycle()
Recycles the request object and releases its resources.
|
void |
setRequests(Request primary,
Request error) |
public ErrorRequestCoordinator(RequestCoordinator coordinator)
public void begin()
Requestpublic void pause()
RequestRequest.clear() except that the request may later be restarted.public void clear()
Requestpublic boolean isPaused()
Requestpublic boolean isRunning()
Requestpublic boolean isComplete()
RequestisComplete in interface Requestpublic boolean isResourceSet()
RequestRequest.isComplete()} returns false.isResourceSet in interface Requestpublic boolean isCancelled()
RequestisCancelled in interface Requestpublic boolean isFailed()
Requestpublic void recycle()
Requestpublic boolean isEquivalentTo(Request o)
Requesttrue if this Request is equivalent to the given Request (has
all of the same options and sizes).
This method is identical to Object.equals(Object) except that it's specific to
Request subclasses. We do not use Object.equals(Object) directly because we
track Requests in collections like Set and it's perfectly legitimate
to have two different Request objects for two different
Targets (for example). Using a similar but different
method let's us selectively compare Request objects to each other when it's useful in
specific scenarios.
isEquivalentTo in interface Requestpublic boolean canSetImage(Request request)
RequestCoordinatorRequest can display a loaded bitmap.canSetImage in interface RequestCoordinatorrequest - The Request requesting permission to display a bitmap.public boolean canNotifyStatusChanged(Request request)
RequestCoordinatorRequest can display a placeholder.canNotifyStatusChanged in interface RequestCoordinatorrequest - The Request requesting permission to display a placeholder.public boolean isAnyResourceSet()
RequestCoordinatorRequest has successfully completed.isAnyResourceSet in interface RequestCoordinatorRequest.isComplete()public void onRequestSuccess(Request request)
RequestCoordinatorRequest coordinated by this object completes successfully.onRequestSuccess in interface RequestCoordinatorpublic void onRequestFailed(Request request)
RequestCoordinatorRequest coordinated by this object fails.onRequestFailed in interface RequestCoordinator