|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bumptech.glide.GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType>
ModelType
- The type of model representing the resource.DataType
- The data type that the resource ModelLoader
will provide that
can be decoded by the ResourceDecoder
.ResourceType
- The type of the resource that will be loaded.TranscodeType
- The type of resource the decoded resource will be transcoded to.public class GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType>
A generic class that can handle setting options and staring loads for generic resource types.
Warning - It is not safe to use this builder after calling into()
, it may be pooled and
reused.
Method Summary | ||
---|---|---|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
animate(Animation animation)
Sets an animation to run on the wrapped target when a resource load finishes. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
animate(int animationId)
Sets an animation to run on the wrapped target when an resource load finishes. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
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. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
cacheDecoder(ResourceDecoder<File,ResourceType> cacheDecoder)
Sets the ResourceDecoder to use to load the resource from the disk cache. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
decoder(ResourceDecoder<DataType,ResourceType> decoder)
Sets the ResourceDecoder to use to load the resource from the original data. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
diskCacheStrategy(DiskCacheStrategy strategy)
Sets the DiskCacheStrategy to use for this load. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
dontAnimate()
Removes any existing animation set on the builder. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
dontTransform()
Removes the current Transformation . |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
encoder(ResourceEncoder<ResourceType> encoder)
Sets the Encoder to use to encode the original data directly to cache. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
error(Drawable drawable)
Sets a Drawable to display if a load fails. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
error(int resourceId)
Sets a resource to display if a load fails. |
|
Target<TranscodeType> |
into(ImageView view)
Sets the ImageView the resource will be loaded into, cancels any existing loads into the view, and frees
any resources Glide may have previously loaded into the view so they may be reused. |
|
FutureTarget<TranscodeType> |
into(int width,
int height)
Returns a future that can be used to do a blocking get on a background thread. |
|
|
into(Y target)
Set the target the resource will be loaded into. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
listener(RequestListener<ModelType,TranscodeType> requestListener)
Sets a RequestBuilder listener to monitor the resource load. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
override(int width,
int height)
Overrides the Target 's width and height with the given values. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
placeholder(Drawable drawable)
Sets an Drawable to display while a resource is loading. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
placeholder(int resourceId)
Sets an Android resource id for a Drawable resourceto display while a resource
is loading. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
priority(Priority priority)
Sets the priority for this load. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
sizeMultiplier(float sizeMultiplier)
Applies a multiplier to the Target 's size before loading the resource. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
skipMemoryCache(boolean skip)
Allows the loaded resource to skip the memory cache. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
sourceEncoder(Encoder<DataType> sourceEncoder)
Sets the source encoder to use to encode the data retrieved by this request directly into cache. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
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. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
thumbnail(GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> thumbnailRequest)
Loads and displays the resource retrieved by the given thumbnail request if it finishes before this request. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
transcoder(ResourceTranscoder<ResourceType,TranscodeType> transcoder)
Sets the ResourceTranscoder to use for this load. |
|
GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> |
transform(Transformation<ResourceType>... transformations)
Transform resources with the given Transformation s. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> thumbnail(GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> 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 resource 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, see
{@link #thumbnail(float)}.
Only the thumbnail call on the main request will be obeyed.
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> 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, placeholder(int)
and error(int)
,
and listener(RequestListener)
will only be used on the fullsize load and will not be copied for
the thumbnail load.
Only the thumbnail call on the main request will be obeyed.
sizeMultiplier
- The multiplier to apply to the Target
's dimensions when loading the thumbnail.
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> 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
- The multiplier to apply to the Target
's dimensions when loading the resource.
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> decoder(ResourceDecoder<DataType,ResourceType> 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
- The ResourceDecoder
to use to decode the resource.
cacheDecoder(com.bumptech.glide.load.ResourceDecoder)
,
DiskCacheStrategy
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> cacheDecoder(ResourceDecoder<File,ResourceType> 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
- The decoder to use.
decoder(com.bumptech.glide.load.ResourceDecoder)
,
DiskCacheStrategy
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> sourceEncoder(Encoder<DataType> sourceEncoder)
sourceEncoder
- The encoder to use.
DiskCacheStrategy
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> 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
.
strategy
- The strategy to use.
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> encoder(ResourceEncoder<ResourceType> 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
- The encoder to use.
sourceEncoder(com.bumptech.glide.load.Encoder)
,
DiskCacheStrategy
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> priority(Priority priority)
priority
- A priority.
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> transform(Transformation<ResourceType>... transformations)
Transformation
s. Replaces any existing transformation or
transformations.
transformations
- the transformations to apply in order.
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> dontTransform()
Transformation
.
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> transcoder(ResourceTranscoder<ResourceType,TranscodeType> transcoder)
ResourceTranscoder
to use for this load.
transcoder
- The transcoder to use.
UnitTranscoder
,
GlideBitmapDrawableTranscoder
,
GifBitmapWrapperDrawableTranscoder
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> dontAnimate()
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> animate(int animationId)
animationId
- The resource id of the animation to run
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> animate(Animation animation)
animation
- The animation to run
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> 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).
animator
- The ViewPropertyAnimation.Animator
to run.
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> placeholder(int resourceId)
Drawable
resourceto display while a resource
is loading.
resourceId
- The id of the resource to use as a placeholder
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> placeholder(Drawable drawable)
Drawable
to display while a resource is loading.
drawable
- The drawable to display as a placeholder.
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> error(int resourceId)
resourceId
- The id of the resource to use as a placeholder.
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> error(Drawable drawable)
Drawable
to display if a load fails.
drawable
- The drawable to display.
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> listener(RequestListener<ModelType,TranscodeType> requestListener)
requestListener
- The request listener to use.
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> 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.
skip
- True to allow the resource to skip the memory cache.
public GenericRequestBuilder<ModelType,DataType,ResourceType,TranscodeType> 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)
.
width
- The width to use to load the resource.height
- The height to use to load the resource.
public <Y extends Target<TranscodeType>> Y into(Y target)
target
- The target to load the resource into.
Glide.clear(com.bumptech.glide.request.target.Target)
public Target<TranscodeType> into(ImageView view)
ImageView
the resource will be loaded into, cancels any existing loads into the view, and frees
any resources Glide may have previously loaded into the view so they may be reused.
view
- The view to cancel previous loads for and load the new resource into.
Target
used to wrap the given ImageView
.Glide.clear(android.view.View)
public FutureTarget<TranscodeType> into(int width, int height)
width
- The desired width (note this will be overriden by override(int, int)
if
previously called.height
- The desired height (note this will be overriden by override(int, int)
}
if previously called.
FutureTarget
that can be used to obtain the
resource in a blocking manner.Glide.clear(com.bumptech.glide.request.FutureTarget)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |