public class ThumbnailRequestCoordinator extends java.lang.Object implements RequestCoordinator, Request
Request
s that load a small thumbnail
version of an image and the full size version of the image at the same time.RequestCoordinator.RequestState
Constructor and Description |
---|
ThumbnailRequestCoordinator(java.lang.Object requestLock,
RequestCoordinator parent) |
Modifier and Type | Method and Description |
---|---|
void |
begin()
Starts first the thumb request and then the full request.
|
boolean |
canNotifyCleared(Request request)
|
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.
|
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.
|
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.
|
RequestCoordinator |
getRoot()
Returns the top most parent
RequestCoordinator . |
boolean |
isAnyResourceSet()
Returns true if any coordinated
Request has successfully completed. |
boolean |
isCleared()
Returns true if the request has been cleared.
|
boolean |
isComplete()
Returns true if the request has completed successfully.
|
boolean |
isEquivalentTo(Request o)
|
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()
Similar to
Request.clear() for in progress requests (or portions of a request), but does nothing
if the request is already complete. |
void |
setRequests(Request full,
Request thumb) |
public ThumbnailRequestCoordinator(java.lang.Object requestLock, @Nullable RequestCoordinator parent)
public boolean canSetImage(Request request)
canSetImage
in interface RequestCoordinator
request
- The Request
requesting permission to display a bitmap.public boolean canNotifyStatusChanged(Request request)
canNotifyStatusChanged
in interface RequestCoordinator
request
- The Request
requesting permission to display a placeholder..public boolean canNotifyCleared(Request request)
RequestCoordinator
canNotifyCleared
in interface RequestCoordinator
public boolean isAnyResourceSet()
RequestCoordinator
Request
has successfully completed.isAnyResourceSet
in interface Request
isAnyResourceSet
in interface RequestCoordinator
Request.isComplete()
public void onRequestSuccess(Request request)
RequestCoordinator
Request
coordinated by this object completes successfully.onRequestSuccess
in interface RequestCoordinator
public void onRequestFailed(Request request)
RequestCoordinator
Request
coordinated by this object fails.onRequestFailed
in interface RequestCoordinator
public RequestCoordinator getRoot()
RequestCoordinator
RequestCoordinator
.getRoot
in interface RequestCoordinator
public void begin()
public void clear()
Request
public void pause()
Request
Request.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.
public boolean isRunning()
Request
public boolean isComplete()
Request
isComplete
in interface Request
public boolean isCleared()
Request
public boolean isEquivalentTo(Request o)
Request
true
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 Request
s in collections like Set
and it's perfectly legitimate
to have two different Request
objects for two different Target
s (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 Request