public interface RequestKey
createFileDescriptorFactoryAsync(RequestKey, Callback)
or createInputStream()
.
DecodeTask
will prioritize
createFileDescriptorFactoryAsync(RequestKey, Callback)
before falling back to
createInputStream()
.
Clients of this interface must also implement #equals(Object)
and #hashCode()
as
this object will be used as a cache key.
The following is a high level view of the interactions between RequestKey and the rest of the system. BasicBitmapDrawable UI Thread ++ bind() || Background Thread |+-------------------->+ || createFDFasync() || || || Download from url || || Cache on disk || || || vv |<--------------------+x || FDFcreated() || || || DecodeTask || AsyncTask Thread |+-------------------->+ || new().execute() || || || Decode from FDF || || or createInputStream() || || || vv |<--------------------+x || onDecodeComplete() vv invalidate() xx
Modifier and Type | Interface and Description |
---|---|
static interface |
RequestKey.Callback
Callback for creating the
RequestKey.FileDescriptorFactory asynchronously. |
static interface |
RequestKey.Cancelable
Interface for a background task that is cancelable.
|
static interface |
RequestKey.FileDescriptorFactory |
Modifier and Type | Method and Description |
---|---|
RequestKey.Cancelable |
createFileDescriptorFactoryAsync(RequestKey key,
RequestKey.Callback callback)
Create an
RequestKey.FileDescriptorFactory for a local file stored on the device and pass it to
the given callback. |
InputStream |
createInputStream()
Create an
InputStream for the source. |
boolean |
hasOrientationExif()
Return true if the image source may have be oriented in either portrait or landscape, and
will need to be automatically re-oriented based on accompanying Exif metadata.
|
RequestKey.Cancelable createFileDescriptorFactoryAsync(RequestKey key, RequestKey.Callback callback)
RequestKey.FileDescriptorFactory
for a local file stored on the device and pass it to
the given callback. This method will be called in favor of createInputStream()
},
which will only be called if null is returned from this method,
or Callback#fileDescriptorFactoryCreated(RequestKey, FileDescriptorFactory)
is called
with a null FileDescriptorFactory.
Clients should implement this method if files are in the local cache folder, or if files must
be downloaded and cached.
This method must be called from the UI thread.key
- The key to create a FileDescriptorFactory for. This key will be passed to the
callback so it can check whether the key has changed.callback
- The callback to notify once the FileDescriptorFactory is created or has failed
to be created.
Do not invoke the callback directly from this method. Instead, create a handler
and post a Runnable.InputStream createInputStream() throws IOException
InputStream
for the source. This method will be called if
createFileDescriptorFactoryAsync(RequestKey, Callback)
returns null.
Clients should implement this method if files exist in the assets/ folder, or for prototypes
that open a connection directly on a URL (be warned that this will cause GCs).
This method can be called from any thread.IOException
boolean hasOrientationExif() throws IOException
IOException