FileDocCategorySizeDatePackage
RequestKey.javaAPI DocAndroid 5.1 API5488Thu Mar 12 22:22:50 GMT 2015com.android.bitmap

RequestKey

public interface RequestKey
The decode task uses this class to get input to decode. You must implement at least one of {@link #createFileDescriptorFactoryAsync(RequestKey, Callback)} or {@link #createInputStream()}. {@link DecodeTask} will prioritize {@link #createFileDescriptorFactoryAsync(RequestKey, Callback)} before falling back to {@link #createInputStream()}.

Clients of this interface must also implement {@link #equals(Object)} and {@link #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

Fields Summary
Constructors Summary
Methods Summary
public com.android.bitmap.RequestKey$CancelablecreateFileDescriptorFactoryAsync(com.android.bitmap.RequestKey key, com.android.bitmap.RequestKey$Callback callback)
Create an {@link FileDescriptorFactory} for a local file stored on the device and pass it to the given callback. This method will be called first; if it returns null, {@link #createInputStream()} will be called. 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.

param
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.
param
callback The callback to notify once the FileDescriptorFactory has been created. Do not invoke the callback directly from this method. Instead, create a handler and post a Runnable.
return
If the client will attempt to create a FileDescriptorFactory, return a Cancelable object to cancel the asynchronous task. If the client wants to create an InputStream instead, return null. The callback must be notified if and only if the client returns a Cancelable object and not null.

public java.io.InputStreamcreateInputStream()
Create an {@link InputStream} for the source. This method will be called if {@link #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.

public booleanhasOrientationExif()
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. This method can be called from any thread.