Class ErrorRequestCoordinator
- java.lang.Object
-
- com.bumptech.glide.request.ErrorRequestCoordinator
-
- All Implemented Interfaces:
Request,RequestCoordinator
public final class ErrorRequestCoordinator extends java.lang.Object implements RequestCoordinator, Request
Runs a single primaryRequestuntil it completes and then a fallback error request only if the single primary request fails.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.bumptech.glide.request.RequestCoordinator
RequestCoordinator.RequestState
-
-
Constructor Summary
Constructors Constructor Description ErrorRequestCoordinator(java.lang.Object requestLock, RequestCoordinator parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbegin()Starts an asynchronous load.booleancanNotifyCleared(Request request)booleancanNotifyStatusChanged(Request request)Returns true if theRequestcan display a placeholder.booleancanSetImage(Request request)Returns true if theRequestcan display a loaded bitmap.voidclear()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.RequestCoordinatorgetRoot()Returns the top most parentRequestCoordinator.booleanisAnyResourceSet()Returns true if any coordinatedRequesthas successfully completed.booleanisCleared()Returns true if the request has been cleared.booleanisComplete()Returns true if the request has completed successfully.booleanisEquivalentTo(Request o)booleanisRunning()Returns true if this request is running and has not completed or failed.voidonRequestFailed(Request request)Must be called when aRequestcoordinated by this object fails.voidonRequestSuccess(Request request)Must be called when aRequestcoordinated by this object completes successfully.voidpause()Similar toRequest.clear()for in progress requests (or portions of a request), but does nothing if the request is already complete.voidsetRequests(Request primary, Request error)
-
-
-
Constructor Detail
-
ErrorRequestCoordinator
public ErrorRequestCoordinator(java.lang.Object requestLock, @Nullable RequestCoordinator parent)
-
-
Method Detail
-
begin
public void begin()
Description copied from interface:RequestStarts an asynchronous load.
-
clear
public void clear()
Description copied from interface:RequestPrevents 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.
-
pause
public void pause()
Description copied from interface:RequestSimilar toRequest.clear()for in progress requests (or portions of a request), but does nothing if the request is already complete.Unlike
Request.clear(), this method allows implementations to act differently on subparts of a request. For example if a Request has both a thumbnail and a primary request and the thumbnail portion of the request is complete, this method allows only the primary portion of the request to be paused without clearing the previously completed thumbnail portion.
-
isRunning
public boolean isRunning()
Description copied from interface:RequestReturns true if this request is running and has not completed or failed.
-
isComplete
public boolean isComplete()
Description copied from interface:RequestReturns true if the request has completed successfully.- Specified by:
isCompletein interfaceRequest
-
isCleared
public boolean isCleared()
Description copied from interface:RequestReturns true if the request has been cleared.
-
isEquivalentTo
public boolean isEquivalentTo(Request o)
Description copied from interface:RequestReturnstrueif thisRequestis equivalent to the givenRequest(has all of the same options and sizes).This method is identical to
Object.equals(Object)except that it's specific toRequestsubclasses. We do not useObject.equals(Object)directly because we trackRequests in collections likeSetand it's perfectly legitimate to have two differentRequestobjects for two differentTargets (for example). Using a similar but different method let's us selectively compareRequestobjects to each other when it's useful in specific scenarios.- Specified by:
isEquivalentToin interfaceRequest
-
canSetImage
public boolean canSetImage(Request request)
Description copied from interface:RequestCoordinatorReturns true if theRequestcan display a loaded bitmap.- Specified by:
canSetImagein interfaceRequestCoordinator- Parameters:
request- TheRequestrequesting permission to display a bitmap.
-
canNotifyStatusChanged
public boolean canNotifyStatusChanged(Request request)
Description copied from interface:RequestCoordinatorReturns true if theRequestcan display a placeholder.- Specified by:
canNotifyStatusChangedin interfaceRequestCoordinator- Parameters:
request- TheRequestrequesting permission to display a placeholder.
-
canNotifyCleared
public boolean canNotifyCleared(Request request)
Description copied from interface:RequestCoordinator- Specified by:
canNotifyClearedin interfaceRequestCoordinator
-
isAnyResourceSet
public boolean isAnyResourceSet()
Description copied from interface:RequestCoordinatorReturns true if any coordinatedRequesthas successfully completed.- Specified by:
isAnyResourceSetin interfaceRequest- Specified by:
isAnyResourceSetin interfaceRequestCoordinator- See Also:
Request.isComplete()
-
onRequestSuccess
public void onRequestSuccess(Request request)
Description copied from interface:RequestCoordinatorMust be called when aRequestcoordinated by this object completes successfully.- Specified by:
onRequestSuccessin interfaceRequestCoordinator
-
onRequestFailed
public void onRequestFailed(Request request)
Description copied from interface:RequestCoordinatorMust be called when aRequestcoordinated by this object fails.- Specified by:
onRequestFailedin interfaceRequestCoordinator
-
getRoot
public RequestCoordinator getRoot()
Description copied from interface:RequestCoordinatorReturns the top most parentRequestCoordinator.- Specified by:
getRootin interfaceRequestCoordinator
-
-