com.bumptech.glide.load.model.stream
Class MediaStoreStreamLoader

java.lang.Object
  extended by com.bumptech.glide.load.model.stream.MediaStoreStreamLoader
All Implemented Interfaces:
ModelLoader<Uri,InputStream>

public class MediaStoreStreamLoader
extends Object
implements ModelLoader<Uri,InputStream>

An ModelLoader that can use media store uris to open pre-generated thumbnails from the media store using MediaStore.Images.Thumbnails and MediaStore.Video.Thumbnails if the requested size is less than or equal to the media store thumbnail size. If the given uri is not a media store uri or if the desired dimensions are too large, it falls back to the wrapped ModelLoader to load the InputStream data.


Constructor Summary
MediaStoreStreamLoader(Context context, ModelLoader<Uri,InputStream> uriLoader, String mimeType, long dateModified, int orientation)
           
 
Method Summary
 DataFetcher<InputStream> getResourceFetcher(Uri model, int width, int height)
          Obtains an DataFetcher that can fetch the data required to decode the resource represented by this model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MediaStoreStreamLoader

public MediaStoreStreamLoader(Context context,
                              ModelLoader<Uri,InputStream> uriLoader,
                              String mimeType,
                              long dateModified,
                              int orientation)
Method Detail

getResourceFetcher

public DataFetcher<InputStream> getResourceFetcher(Uri model,
                                                   int width,
                                                   int height)
Description copied from interface: ModelLoader
Obtains an DataFetcher that can fetch the data required to decode the resource represented by this model. The DataFetcher will not be used if the resource is already cached.

Note - If no valid data fetcher can be returned (for example if a model has a null URL), then it is acceptable to return a null data fetcher from this method. Doing so will be treated any other failure or exception during the load process.

Specified by:
getResourceFetcher in interface ModelLoader<Uri,InputStream>
Parameters:
model - The model representing the resource.
width - The width of the view or target the resource will be loaded into
height - The height of the view or target the resource will be loaded into
Returns:
A DataFetcher that can obtain the data the resource can be decoded from if the resource is not cached, or null if no valid DataFetcher could be constructed.