Class ThumbnailRequestCoordinator
- java.lang.Object
-
- com.bumptech.glide.request.ThumbnailRequestCoordinator
-
- All Implemented Interfaces:
Request,RequestCoordinator
public class ThumbnailRequestCoordinator extends java.lang.Object implements RequestCoordinator, Request
A coordinator that coordinates two individualRequests that load a small thumbnail version of an image and the full size version of the image at the same time.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.bumptech.glide.request.RequestCoordinator
RequestCoordinator.RequestState
-
-
Constructor Summary
Constructors Constructor Description ThumbnailRequestCoordinator(java.lang.Object requestLock, RequestCoordinator parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbegin()Starts first the thumb request and then the full request.booleancanNotifyCleared(Request request)booleancanNotifyStatusChanged(Request request)Returns true if the request is the request loading the full size image and if neither the full nor the thumbnail image have completed successfully.booleancanSetImage(Request request)Returns true if the request is either the request loading the full size image or if the request loading the full size image has not yet completed.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 full, Request thumb)
-
-
-
Constructor Detail
-
ThumbnailRequestCoordinator
public ThumbnailRequestCoordinator(java.lang.Object requestLock, @Nullable RequestCoordinator parent)
-
-
Method Detail
-
canSetImage
public boolean canSetImage(Request request)
Returns true if the request is either the request loading the full size image or if the request loading the full size image has not yet completed.- Specified by:
canSetImagein interfaceRequestCoordinator- Parameters:
request- TheRequestrequesting permission to display a bitmap.
-
canNotifyStatusChanged
public boolean canNotifyStatusChanged(Request request)
Returns true if the request is the request loading the full size image and if neither the full nor the thumbnail image have completed successfully.- 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
-
begin
public void begin()
Starts first the thumb request and then the full request.
-
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
-
-