|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bumptech.glide.GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable> com.bumptech.glide.GifRequestBuilder<ModelType>
ModelType
- The type of model that will be loaded into the target.public class GifRequestBuilder<ModelType>
A class for creating a request to load an animated gif.
Warning - It is not safe to use this builder after calling into()
, it may be pooled and
reused.
Field Summary |
---|
Fields inherited from class com.bumptech.glide.GenericRequestBuilder |
---|
context, glide, lifecycle, modelClass, requestTracker, transcodeClass |
Method Summary | |
---|---|
GifRequestBuilder<ModelType> |
animate(Animation animation)
Deprecated. |
GifRequestBuilder<ModelType> |
animate(int animationId)
Sets an animation to run on the wrapped target when an resource load finishes. |
GifRequestBuilder<ModelType> |
animate(ViewPropertyAnimation.Animator animator)
Sets an animator to run a ViewPropertyAnimator on a view that the target may be wrapping
when a resource load finishes. |
GifRequestBuilder<ModelType> |
cacheDecoder(ResourceDecoder<File,GifDrawable> cacheDecoder)
Sets the ResourceDecoder to use to load the resource from the disk cache. |
GifRequestBuilder<ModelType> |
centerCrop()
Transforms each frame of the GIF using CenterCrop . |
GifRequestBuilder<ModelType> |
clone()
Returns a copy of this request builder with all of the options set so far on this builder. |
GifRequestBuilder<ModelType> |
crossFade()
Applies a cross fade transformation that fades from the placeholder to the loaded Drawable . |
GifRequestBuilder<ModelType> |
crossFade(Animation animation,
int duration)
Deprecated. |
GifRequestBuilder<ModelType> |
crossFade(int duration)
Applies a cross fade transformation that fades from the placeholder to the loaded Drawable . |
GifRequestBuilder<ModelType> |
crossFade(int animationId,
int duration)
Applies a cross fade transformation that des from the placeholder to the loaded Drawable . |
GifRequestBuilder<ModelType> |
decoder(ResourceDecoder<InputStream,GifDrawable> decoder)
Sets the ResourceDecoder to use to load the resource from the original data. |
GifRequestBuilder<ModelType> |
diskCacheStrategy(DiskCacheStrategy strategy)
Sets the DiskCacheStrategy to use for this load. |
GifRequestBuilder<ModelType> |
dontAnimate()
Removes any existing animation set on the builder. |
GifRequestBuilder<ModelType> |
dontTransform()
Removes the current Transformation . |
GifRequestBuilder<ModelType> |
encoder(ResourceEncoder<GifDrawable> encoder)
Sets the Encoder to use to encode the original data directly to cache. |
GifRequestBuilder<ModelType> |
error(Drawable drawable)
Sets a Drawable to display if a load fails. |
GifRequestBuilder<ModelType> |
error(int resourceId)
Sets a resource to display if a load fails. |
GifRequestBuilder<ModelType> |
fallback(Drawable drawable)
Sets an Drawable to display if the model provided to
GenericRequestBuilder.load(Object) is null . |
GifRequestBuilder<ModelType> |
fallback(int resourceId)
Sets a resource to display if the model provided to GenericRequestBuilder.load(Object) is null . |
GifRequestBuilder<ModelType> |
fitCenter()
Transforms each frame of the GIF using FitCenter . |
GifRequestBuilder<ModelType> |
listener(RequestListener<? super ModelType,GifDrawable> requestListener)
Sets a RequestBuilder listener to monitor the resource load. |
GifRequestBuilder<ModelType> |
load(ModelType model)
Sets the specific model to load data for. |
GifRequestBuilder<ModelType> |
override(int width,
int height)
Overrides the Target 's width and height with the given values. |
GifRequestBuilder<ModelType> |
placeholder(Drawable drawable)
Sets an Drawable to display while a resource is loading. |
GifRequestBuilder<ModelType> |
placeholder(int resourceId)
Sets an Android resource id for a Drawable resourceto display while a resource
is loading. |
GifRequestBuilder<ModelType> |
priority(Priority priority)
Sets the priority for this load. |
GifRequestBuilder<ModelType> |
signature(Key signature)
Sets some additional data to be mixed in to the memory and disk cache keys allowing the caller more control over when cached data is invalidated. |
GifRequestBuilder<ModelType> |
sizeMultiplier(float sizeMultiplier)
Applies a multiplier to the Target 's size before loading the resource. |
GifRequestBuilder<ModelType> |
skipMemoryCache(boolean skip)
Allows the loaded resource to skip the memory cache. |
GifRequestBuilder<ModelType> |
sourceEncoder(Encoder<InputStream> sourceEncoder)
Sets the source encoder to use to encode the data retrieved by this request directly into cache. |
GifRequestBuilder<ModelType> |
thumbnail(float sizeMultiplier)
Loads a resource in an identical manner to this request except with the dimensions of the target multiplied by the given size multiplier. |
GifRequestBuilder<ModelType> |
thumbnail(GenericRequestBuilder<?,?,?,GifDrawable> thumbnailRequest)
Loads and displays the resource retrieved by the given thumbnail request if it finishes before this request. |
GifRequestBuilder<ModelType> |
thumbnail(GifRequestBuilder<?> thumbnailRequest)
Loads and displays the GIF retrieved by the given thumbnail request if it finishes before this request. |
GifRequestBuilder<ModelType> |
transcoder(ResourceTranscoder<GifDrawable,GifDrawable> transcoder)
Sets the ResourceTranscoder to use for this load. |
GifRequestBuilder<ModelType> |
transform(Transformation<GifDrawable>... transformations)
Transform resources with the given Transformation s. |
GifRequestBuilder<ModelType> |
transformFrame(BitmapTransformation... bitmapTransformations)
Transforms each frame of the GIF using the given transformations. |
GifRequestBuilder<ModelType> |
transformFrame(Transformation<Bitmap>... bitmapTransformations)
Transforms each frame of the GIF using the given transformations. |
Methods inherited from class com.bumptech.glide.GenericRequestBuilder |
---|
into, into, into, preload, preload |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public GifRequestBuilder<ModelType> thumbnail(GenericRequestBuilder<?,?,?,GifDrawable> thumbnailRequest)
thumbnail
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
thumbnailRequest
- The request to use to load the thumbnail.
Recursive calls to thumbnail are supported.
public GifRequestBuilder<ModelType> thumbnail(GifRequestBuilder<?> thumbnailRequest)
thumbnailRequest
- The request to use to load the thumbnail.
Note - Any options on the main request will not be passed on to the thumbnail request. For example, if
you want an animation to occur when either the full GIF loads or the thumbnail loads,
you need to call {@link #animate(int)} on both the thumb and the full request. For a simpler thumbnail
option where these options are applied to the humbnail as well, see {@link #thumbnail(float)}.
Only the thumbnail call on the main request will be obeyed, recursive calls to this method are ignored.
public GifRequestBuilder<ModelType> thumbnail(float sizeMultiplier)
Note - The thumbnail resource will be smaller than the size requested so the target (or ImageView
)
must be able to scale the thumbnail appropriately. See ImageView.ScaleType
.
Almost all options will be copied from the original load, including the
ModelLoader
, ResourceDecoder
, and
Transformation
s. However, GenericRequestBuilder.placeholder(int)
and GenericRequestBuilder.error(int)
,
and GenericRequestBuilder.listener(RequestListener)
will only be used on the fullsize load and will not be copied for
the thumbnail load.
Recursive calls to thumbnail are supported.
thumbnail
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
sizeMultiplier
- The multiplier to apply to the Target
's dimensions when loading the thumbnail.
public GifRequestBuilder<ModelType> sizeMultiplier(float sizeMultiplier)
Target
's size before loading the resource. Useful for loading thumbnails
or trying to avoid loading huge resources (particularly Bitmap
s on devices with overly
dense screens.
sizeMultiplier
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
sizeMultiplier
- The multiplier to apply to the Target
's dimensions when loading the resource.
public GifRequestBuilder<ModelType> decoder(ResourceDecoder<InputStream,GifDrawable> decoder)
ResourceDecoder
to use to load the resource from the original data.
By default, this decoder will only be used if the final transformed resource is not in the disk cache.
decoder
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
decoder
- The ResourceDecoder
to use to decode the resource.
GenericRequestBuilder.cacheDecoder(com.bumptech.glide.load.ResourceDecoder)
,
DiskCacheStrategy
public GifRequestBuilder<ModelType> cacheDecoder(ResourceDecoder<File,GifDrawable> cacheDecoder)
ResourceDecoder
to use to load the resource from the disk cache. By
default, this decoder will only be used if the final transformed resource is already in the disk cache.
cacheDecoder
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
cacheDecoder
- The decoder to use.
GenericRequestBuilder.decoder(com.bumptech.glide.load.ResourceDecoder)
,
DiskCacheStrategy
public GifRequestBuilder<ModelType> encoder(ResourceEncoder<GifDrawable> encoder)
Encoder
to use to encode the original data directly to cache. Will only
be used if the original data is not already in cache and if the
DiskCacheStrategy
is set to
DiskCacheStrategy.SOURCE
or
DiskCacheStrategy.ALL
.
encoder
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
encoder
- The encoder to use.
GenericRequestBuilder.sourceEncoder(com.bumptech.glide.load.Encoder)
,
DiskCacheStrategy
public GifRequestBuilder<ModelType> priority(Priority priority)
priority
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
priority
- A priority.
public GifRequestBuilder<ModelType> centerCrop()
CenterCrop
.
fitCenter()
,
transformFrame(com.bumptech.glide.load.resource.bitmap.BitmapTransformation...)
,
transformFrame(com.bumptech.glide.load.Transformation[])
,
transform(com.bumptech.glide.load.Transformation[])
public GifRequestBuilder<ModelType> fitCenter()
FitCenter
.
centerCrop()
,
transformFrame(com.bumptech.glide.load.resource.bitmap.BitmapTransformation...)
,
transformFrame(com.bumptech.glide.load.Transformation[])
,
transform(com.bumptech.glide.load.Transformation[])
public GifRequestBuilder<ModelType> transformFrame(BitmapTransformation... bitmapTransformations)
bitmapTransformations
- The transformations to apply in order to each frame.
centerCrop()
,
fitCenter()
,
transformFrame(com.bumptech.glide.load.Transformation[])
,
transform(com.bumptech.glide.load.Transformation[])
public GifRequestBuilder<ModelType> transformFrame(Transformation<Bitmap>... bitmapTransformations)
bitmapTransformations
- The transformations to apply in order to each frame.
fitCenter()
,
centerCrop()
,
transformFrame(com.bumptech.glide.load.resource.bitmap.BitmapTransformation...)
,
transform(com.bumptech.glide.load.Transformation[])
public GifRequestBuilder<ModelType> transform(Transformation<GifDrawable>... transformations)
Transformation
s. Replaces any existing transformation or
transformations.
transform
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
transformations
- the transformations to apply in order.
fitCenter()
,
centerCrop()
,
transformFrame(com.bumptech.glide.load.resource.bitmap.BitmapTransformation...)
,
transformFrame(com.bumptech.glide.load.Transformation[])
public GifRequestBuilder<ModelType> transcoder(ResourceTranscoder<GifDrawable,GifDrawable> transcoder)
ResourceTranscoder
to use for this load.
transcoder
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
transcoder
- The transcoder to use.
UnitTranscoder
,
GlideBitmapDrawableTranscoder
,
GifBitmapWrapperDrawableTranscoder
public GifRequestBuilder<ModelType> crossFade()
Drawable
. If no placeholder is set, the Drawable will instead simply fade in.
crossFade(int)
,
crossFade(int, int)
public GifRequestBuilder<ModelType> crossFade(int duration)
Drawable
. If no placeholder is set the Drawable will instead simply fade in.
duration
- The duration of the cross fade and initial fade in.
crossFade()
,
crossFade(int, int)
@Deprecated public GifRequestBuilder<ModelType> crossFade(Animation animation, int duration)
Drawable
. If no placeholder is set, the Drawable will instead be animated in
using the given Animation
.
animation
- The Animation to use if no placeholder is set.duration
- The duration of the cross fade animation.
crossFade()
,
crossFade(int)
,
crossFade(int, int)
public GifRequestBuilder<ModelType> crossFade(int animationId, int duration)
Drawable
. If no placeholder is set, the Drawable will instead be animated in
using the Animation
loaded from the given animation id.
animationId
- The id of the Animation to use if no placeholder is set.duration
- The duration of the cross fade animation.
crossFade()
,
crossFade(int)
public GifRequestBuilder<ModelType> dontAnimate()
dontAnimate
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
public GifRequestBuilder<ModelType> animate(int animationId)
animate
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
animationId
- The resource id of the animation to run
@Deprecated public GifRequestBuilder<ModelType> animate(Animation animation)
animate
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
animation
- The animation to run
GenericRequestBuilder.animate(int)
,
GenericRequestBuilder.animate(com.bumptech.glide.request.animation.ViewPropertyAnimation.Animator)
public GifRequestBuilder<ModelType> animate(ViewPropertyAnimation.Animator animator)
ViewPropertyAnimator
on a view that the target may be wrapping
when a resource load finishes. Will only be run if the load was loaded asynchronously (ie was not in the
memory cache).
animate
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
animator
- The ViewPropertyAnimation.Animator
to run.
public GifRequestBuilder<ModelType> placeholder(int resourceId)
Drawable
resourceto display while a resource
is loading.
placeholder
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
resourceId
- The id of the resource to use as a placeholder
public GifRequestBuilder<ModelType> placeholder(Drawable drawable)
Drawable
to display while a resource is loading.
placeholder
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
drawable
- The drawable to display as a placeholder.
public GifRequestBuilder<ModelType> fallback(Drawable drawable)
GenericRequestBuilder
Drawable
to display if the model provided to
GenericRequestBuilder.load(Object)
is null
.
If a fallback is not set, null models will cause the error drawable to be displayed. If the error drawable is not set, the placeholder will be displayed.
fallback
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
drawable
- The drawable to display as a placeholder.
GenericRequestBuilder.placeholder(Drawable)
,
GenericRequestBuilder.placeholder(int)
public GifRequestBuilder<ModelType> fallback(int resourceId)
GenericRequestBuilder
GenericRequestBuilder.load(Object)
is null
.
If a fallback is not set, null models will cause the error drawable to be displayed. If the error drawable is not set, the placeholder will be displayed.
fallback
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
resourceId
- The id of the resource to use as a fallback.
GenericRequestBuilder.placeholder(Drawable)
,
GenericRequestBuilder.placeholder(int)
public GifRequestBuilder<ModelType> error(int resourceId)
error
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
resourceId
- The id of the resource to use as a placeholder.
public GifRequestBuilder<ModelType> error(Drawable drawable)
Drawable
to display if a load fails.
error
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
drawable
- The drawable to display.
public GifRequestBuilder<ModelType> listener(RequestListener<? super ModelType,GifDrawable> requestListener)
listener
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
requestListener
- The request listener to use.
public GifRequestBuilder<ModelType> skipMemoryCache(boolean skip)
Note - this is not a guarantee. If a request is already pending for this resource and that request is not also skipping the memory cache, the resource will be cached in memory.
skipMemoryCache
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
skip
- True to allow the resource to skip the memory cache.
public GifRequestBuilder<ModelType> diskCacheStrategy(DiskCacheStrategy strategy)
DiskCacheStrategy
to use for this load. Defaults to
DiskCacheStrategy.RESULT
.
For most applications DiskCacheStrategy.RESULT
is ideal.
Applications that use the same resource multiple times in multiple sizes and are willing to trade off some
speed and disk space in return for lower bandwidth usage may want to consider using
DiskCacheStrategy.SOURCE
or
DiskCacheStrategy.RESULT
. Any download only operations should
typically use DiskCacheStrategy.SOURCE
.
diskCacheStrategy
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
strategy
- The strategy to use.
public GifRequestBuilder<ModelType> override(int width, int height)
Target
's width and height with the given values. This is useful almost exclusively for
thumbnails, and should only be used when you both need a very specific sized image and when it is impossible or
impractical to return that size from Target.getSize(com.bumptech.glide.request.target.SizeReadyCallback)
.
override
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
width
- The width in pixels to use to load the resource.height
- The height in pixels to use to load the resource.
public GifRequestBuilder<ModelType> sourceEncoder(Encoder<InputStream> sourceEncoder)
sourceEncoder
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
sourceEncoder
- The encoder to use.
DiskCacheStrategy
public GifRequestBuilder<ModelType> dontTransform()
Transformation
.
dontTransform
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
public GifRequestBuilder<ModelType> signature(Key signature)
GenericRequestBuilder
Note - The signature does not replace the cache key, it is purely additive.
signature
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
signature
- A unique non-null Key
representing the current state of the
model that will be mixed in to the cache key.
StringSignature
public GifRequestBuilder<ModelType> load(ModelType model)
GenericRequestBuilder
This method must be called at least once before GenericRequestBuilder.into(com.bumptech.glide.request.target.Target)
is
called.
load
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
model
- The model to load data for, or null.
public GifRequestBuilder<ModelType> clone()
GenericRequestBuilder
This method returns a "deep" copy in that all non-immutable arguments are copied such that changes to one builder will not affect the other builder. However, in addition to immutable arguments, the current model is not copied copied so changes to the model will affect both builders.
clone
in class GenericRequestBuilder<ModelType,InputStream,GifDrawable,GifDrawable>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |