-
- All Implemented Interfaces:
-
com.mobwith.imgmodule.request.Request,com.mobwith.imgmodule.request.RequestCoordinator
public class ThumbnailRequestCoordinator implements RequestCoordinator, Request
A coordinator that coordinates two individual Requests that load a small thumbnail version of an image and the full size version of the image at the same time.
-
-
Constructor Summary
Constructors Constructor Description ThumbnailRequestCoordinator(Object requestLock, RequestCoordinator parent)
-
Method Summary
Modifier and Type Method Description voidsetRequests(Request full, Request thumb)booleancanSetImage(Request request)Returns true if the request is either the request loading the full size image or if the requestloading the full size image has not yet completed. booleancanNotifyStatusChanged(Request request)Returns true if the request is the request loading the full size image and if neither the fullnor the thumbnail image have completed successfully. booleancanNotifyCleared(Request request)Returns {@code true}if the Request can clear the .booleanisAnyResourceSet()Returns true if any coordinated Request has successfully completed. voidonRequestSuccess(Request request)Must be called when a Request coordinated by this object completes successfully. voidonRequestFailed(Request request)Must be called when a Request coordinated by this object fails. RequestCoordinatorgetRoot()Returns the top most parent {@code RequestCoordinator}.voidbegin()Starts first the thumb request and then the full request. voidclear()Prevents any bitmaps being loaded from previous requests, releases any resources held by thisrequest, displays the current placeholder if one was provided, and marks the request as havingbeen cancelled. 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. booleanisEquivalentTo(Request o)Returns {@code true}if this Request is equivalent to the given Request (hasall of the same options and sizes).-
-
Constructor Detail
-
ThumbnailRequestCoordinator
ThumbnailRequestCoordinator(Object requestLock, RequestCoordinator parent)
-
-
Method Detail
-
setRequests
void setRequests(Request full, Request thumb)
-
canSetImage
boolean canSetImage(Request request)
Returns true if the request is either the request loading the full size image or if the requestloading the full size image has not yet completed.
- Parameters:
request- The Request requesting permission to display a bitmap.
-
canNotifyStatusChanged
boolean canNotifyStatusChanged(Request request)
Returns true if the request is the request loading the full size image and if neither the fullnor the thumbnail image have completed successfully.
- Parameters:
request- The Request requesting permission to display a placeholder..
-
canNotifyCleared
boolean canNotifyCleared(Request request)
Returns
{@code true}if the Request can clear the .
-
isAnyResourceSet
boolean isAnyResourceSet()
Returns true if any coordinated Request has successfully completed.
-
onRequestSuccess
void onRequestSuccess(Request request)
Must be called when a Request coordinated by this object completes successfully.
-
onRequestFailed
void onRequestFailed(Request request)
Must be called when a Request coordinated by this object fails.
-
getRoot
RequestCoordinator getRoot()
Returns the top most parent
{@code RequestCoordinator}.
-
begin
void begin()
Starts first the thumb request and then the full request.
-
clear
void clear()
Prevents any bitmaps being loaded from previous requests, releases any resources held by thisrequest, displays the current placeholder if one was provided, and marks the request as havingbeen cancelled.
-
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.
-
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.
-
-
-
-