com.bumptech.glide
Class DrawableTypeRequest<ModelType>

java.lang.Object
  extended by com.bumptech.glide.GenericRequestBuilder<ModelType,ImageVideoWrapper,GifBitmapWrapper,GlideDrawable>
      extended by com.bumptech.glide.DrawableRequestBuilder<ModelType>
          extended by com.bumptech.glide.DrawableTypeRequest<ModelType>
Type Parameters:
ModelType - The type of model to use to load the BitmapDrawable or GifDrawable.
All Implemented Interfaces:
Cloneable

public class DrawableTypeRequest<ModelType>
extends DrawableRequestBuilder<ModelType>

A class for creating a load request that loads either an animated GIF drawable or a Bitmap drawable directly, or adds an ResourceTranscoder to transcode the data into a resource type other than a Drawable.


Field Summary
 
Fields inherited from class com.bumptech.glide.GenericRequestBuilder
context, glide, lifecycle, modelClass, requestTracker, transcodeClass
 
Method Summary
 BitmapTypeRequest<ModelType> asBitmap()
          Attempts to always load the resource as a Bitmap, even if it could actually be animated.
 GifTypeRequest<ModelType> asGif()
          Attempts to always load the resource as a GifDrawable.
 FutureTarget<File> downloadOnly(int width, int height)
          Loads the original unmodified data into the cache and returns a Future that can be used to retrieve the cache File containing the data.
<Y extends Target<File>>
Y
downloadOnly(Y target)
          Loads the original unmodified data into the cache and calls the given Target with the cache File.
 
Methods inherited from class com.bumptech.glide.DrawableRequestBuilder
animate, animate, animate, bitmapTransform, cacheDecoder, centerCrop, clone, crossFade, crossFade, crossFade, crossFade, decoder, diskCacheStrategy, dontAnimate, dontTransform, encoder, error, error, fallback, fallback, fitCenter, into, listener, load, override, placeholder, placeholder, priority, signature, sizeMultiplier, skipMemoryCache, sourceEncoder, thumbnail, thumbnail, thumbnail, transcoder, transform, transform
 
Methods inherited from class com.bumptech.glide.GenericRequestBuilder
into, into, preload, preload
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

asBitmap

public BitmapTypeRequest<ModelType> asBitmap()
Attempts to always load the resource as a Bitmap, even if it could actually be animated.

Returns:
A new request builder for loading a Bitmap

asGif

public GifTypeRequest<ModelType> asGif()
Attempts to always load the resource as a GifDrawable.

If the underlying data is not a GIF, this will fail. As a result, this should only be used if the model represents an animated GIF and the caller wants to interact with the GIfDrawable directly. Normally using just an DrawableTypeRequest is sufficient because it will determine whether or not the given data represents an animated GIF and return the appropriate animated or not animated Drawable automatically.

Returns:
A new request builder for loading a GifDrawable.

downloadOnly

public <Y extends Target<File>> Y downloadOnly(Y target)
Loads the original unmodified data into the cache and calls the given Target with the cache File.

Type Parameters:
Y - The type of Target.
Parameters:
target - The Target that will receive the cache File when the load completes
Returns:
The given Target.

downloadOnly

public FutureTarget<File> downloadOnly(int width,
                                       int height)
Loads the original unmodified data into the cache and returns a Future that can be used to retrieve the cache File containing the data.

Parameters:
width - The width in pixels to use to fetch the data.
height - The height in pixels to use to fetch the data.
Returns:
A Future that can be used to retrieve the cache File containing the data.