Constructor and Description |
---|
RequestOptions() |
Modifier and Type | Method and Description |
---|---|
RequestOptions |
apply(RequestOptions other) |
RequestOptions |
autoClone()
|
static RequestOptions |
bitmapTransform(Transformation<Bitmap> transformation)
Returns a
RequestOptions object with transform(Transformation) set. |
RequestOptions |
centerCrop()
Applies
CenterCrop to all default types and
throws an exception if asked to transform an unknown type. |
static RequestOptions |
centerCropTransform()
Returns a
RequestOptions object with centerCrop() set. |
RequestOptions |
centerInside()
Applies
CenterInside to all default types, DownsampleStrategy.CENTER_INSIDE to
image types and throws an exception if asked to transform an unknown type. |
static RequestOptions |
centerInsideTransform()
Returns a
RequestOptions object with centerInside() set. |
RequestOptions |
circleCrop()
Applies
CircleCrop to all default types and throws an exception if asked to transform
an unknown type. |
static RequestOptions |
circleCropTransform()
Returns a
RequestOptions object with circleCrop() set. |
RequestOptions |
clone()
Returns a copy of this request builder with all of the options put so far on this builder.
|
RequestOptions |
decode(Class<?> resourceClass) |
static RequestOptions |
decodeTypeOf(Class<?> resourceClass)
Returns a
RequestOptions object with decode(Class) set. |
RequestOptions |
disallowHardwareConfig()
Disables the use of
Bitmap.Config.HARDWARE in Downsampler to
avoid errors caused by inspecting Bitmap pixels, drawing with hardware support disabled,
drawing to Canvas s backed by Bitmap s etc. |
RequestOptions |
diskCacheStrategy(DiskCacheStrategy strategy)
Sets the
DiskCacheStrategy to use for this load. |
static RequestOptions |
diskCacheStrategyOf(DiskCacheStrategy diskCacheStrategy)
Returns a
RequestOptions object with diskCacheStrategy(DiskCacheStrategy) set. |
RequestOptions |
dontAnimate()
Disables resource decoders that return animated resources so any resource returned will be
static.
|
RequestOptions |
dontTransform()
Removes all applied
Transformations for all
resource classes and allows unknown resource types to be transformed without throwing an
exception. |
RequestOptions |
downsample(DownsampleStrategy strategy)
|
static RequestOptions |
downsampleOf(DownsampleStrategy strategy)
Returns a
RequestOptions object with downsample(DownsampleStrategy) set. |
RequestOptions |
encodeFormat(Bitmap.CompressFormat format)
Sets the value for key
BitmapEncoder.COMPRESSION_FORMAT . |
static RequestOptions |
encodeFormatOf(Bitmap.CompressFormat format)
Returns a
RequestOptions with encodeFormat(android.graphics.Bitmap.CompressFormat) called with the given format. |
RequestOptions |
encodeQuality(int quality)
Sets the value for key
BitmapEncoder.COMPRESSION_QUALITY . |
static RequestOptions |
encodeQualityOf(int quality)
Returns a
RequestOptions with encodeQuality(int) called with the given quality. |
boolean |
equals(Object o) |
RequestOptions |
error(Drawable drawable)
Sets a
Drawable to display if a load fails. |
RequestOptions |
error(int resourceId)
Sets a resource to display if a load fails.
|
static RequestOptions |
errorOf(Drawable errorDrawable)
Returns a
RequestOptions object with error(Drawable) set. |
static RequestOptions |
errorOf(int errorId)
Returns a
RequestOptions object with error(int) } set. |
RequestOptions |
fallback(Drawable drawable)
|
RequestOptions |
fallback(int resourceId)
Sets a resource to display if the model provided to
RequestBuilder.load(Object) is null . |
RequestOptions |
fitCenter()
Applies
FitCenter and to all default types, DownsampleStrategy.FIT_CENTER to
image types, and throws an exception if asked to transform an unknown
type. |
static RequestOptions |
fitCenterTransform()
Returns a
RequestOptions object with fitCenter() set. |
RequestOptions |
format(DecodeFormat format)
Sets the
DecodeFormat to use when decoding Bitmap objects using
Downsampler and Glide's default GIF decoders. |
static RequestOptions |
formatOf(DecodeFormat format)
Returns a
RequestOptions object with format(DecodeFormat) set. |
RequestOptions |
frame(long frameTimeMicros)
Sets the time position of the frame to extract from a video.
|
static RequestOptions |
frameOf(long frameTimeMicros)
Returns a
RequestOptions object with frame(long) set. |
DiskCacheStrategy |
getDiskCacheStrategy() |
int |
getErrorId() |
Drawable |
getErrorPlaceholder() |
Drawable |
getFallbackDrawable() |
int |
getFallbackId() |
boolean |
getOnlyRetrieveFromCache() |
Options |
getOptions() |
int |
getOverrideHeight() |
int |
getOverrideWidth() |
Drawable |
getPlaceholderDrawable() |
int |
getPlaceholderId() |
Priority |
getPriority() |
Class<?> |
getResourceClass() |
Key |
getSignature() |
float |
getSizeMultiplier() |
Resources.Theme |
getTheme() |
Map<Class<?>,Transformation<?>> |
getTransformations() |
boolean |
getUseAnimationPool() |
boolean |
getUseUnlimitedSourceGeneratorsPool() |
int |
hashCode() |
protected boolean |
isAutoCloneEnabled() |
boolean |
isDiskCacheStrategySet() |
boolean |
isLocked() |
boolean |
isMemoryCacheable() |
boolean |
isPrioritySet() |
boolean |
isSkipMemoryCacheSet() |
boolean |
isTransformationAllowed() |
boolean |
isTransformationRequired() |
boolean |
isTransformationSet() |
boolean |
isValidOverride() |
RequestOptions |
lock()
Throws if any further mutations are attempted.
|
static RequestOptions |
noAnimation()
Returns a new
RequestOptions with dontAnimate()
called. |
static RequestOptions |
noTransformation()
Returns a
RequestOptions object with dontTransform() set. |
RequestOptions |
onlyRetrieveFromCache(boolean flag)
If set to true, will only load an item if found in the cache, and will not fetch from source.
|
static <T> RequestOptions |
option(Option<T> option,
T value)
|
RequestOptions |
optionalCenterCrop()
Applies
CenterCrop to all default types, and
ignores unknown types. |
RequestOptions |
optionalCenterInside()
Applies
CenterInside to all default types,
DownsampleStrategy.CENTER_INSIDE to image types, and ignores unknown types. |
RequestOptions |
optionalCircleCrop()
Applies
CircleCrop to all default types, and ignores unknown types. |
RequestOptions |
optionalFitCenter()
Applies
FitCenter and to all default types, DownsampleStrategy.FIT_CENTER to
image types, and ignores unknown types. |
<T> RequestOptions |
optionalTransform(Class<T> resourceClass,
Transformation<T> transformation)
Applies the given
Transformation for any decoded resource of
the given type and allows unknown resource types to be ignored. |
RequestOptions |
optionalTransform(Transformation<Bitmap> transformation)
Applies the given
Transformation for
Bitmaps to the default types (Bitmap ,
BitmapDrawable , and
GifDrawable ) and ignores unknown types. |
RequestOptions |
override(int size)
Overrides the
Target 's width and height with the
given size. |
RequestOptions |
override(int width,
int height)
Overrides the
Target 's width and height with the
given values. |
static RequestOptions |
overrideOf(int size)
Returns a
RequestOptions with override(int, int) set where both the width and
height are the given size. |
static RequestOptions |
overrideOf(int width,
int height)
Returns a
RequestOptions object with override(int, int) } set. |
RequestOptions |
placeholder(Drawable drawable)
Sets an
Drawable to display while a resource is loading. |
RequestOptions |
placeholder(int resourceId)
Sets an Android resource id for a
Drawable resource to
display while a resource is loading. |
static RequestOptions |
placeholderOf(Drawable placeholder)
Returns a
RequestOptions object with placeholder(Drawable) set. |
static RequestOptions |
placeholderOf(int placeholderId)
Returns a
RequestOptions object with placeholder(int) set. |
RequestOptions |
priority(Priority priority)
Sets the priority for this load.
|
static RequestOptions |
priorityOf(Priority priority)
Returns a
RequestOptions object with priority(Priority) } set. |
<T> RequestOptions |
set(Option<T> option,
T value) |
RequestOptions |
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.
|
static RequestOptions |
signatureOf(Key signature)
Returns a
RequestOptions object with signature set. |
RequestOptions |
sizeMultiplier(float sizeMultiplier)
Applies a multiplier to the
Target 's size before
loading the resource. |
static RequestOptions |
sizeMultiplierOf(float sizeMultiplier)
Returns a
RequestOptions object with sizeMultiplier(float) set. |
RequestOptions |
skipMemoryCache(boolean skip)
Allows the loaded resource to skip the memory cache.
|
static RequestOptions |
skipMemoryCacheOf(boolean skipMemoryCache)
Returns a
RequestOptions object with skipMemoryCache(boolean) set. |
RequestOptions |
theme(Resources.Theme theme)
Sets the
Resources.Theme to apply when loading Drawable s
for resource ids provided via error(int) , placeholder(int) , and
fallback(Drawable) . |
RequestOptions |
timeout(int timeoutMs)
Sets the read and write timeout for the http requests used to load the image.
|
static RequestOptions |
timeoutOf(int timeout)
Returns a
RequestOptions object with timeout(int) set. |
<T> RequestOptions |
transform(Class<T> resourceClass,
Transformation<T> transformation)
Applies the given
Transformation for any decoded resource of
the given type and throws if asked to transform an unknown resource type. |
RequestOptions |
transform(Transformation<Bitmap> transformation)
Applies the given
Transformation for
Bitmaps to the default types (Bitmap ,
BitmapDrawable , and
GifDrawable )
and throws an exception if asked to transform an unknown type. |
RequestOptions |
transforms(Transformation<Bitmap>... transformations)
Applies the given
Transformation s in the given order for
Bitmaps to the default types (Bitmap ,
BitmapDrawable , and
GifDrawable )
and throws an exception if asked to transform an unknown type. |
RequestOptions |
useAnimationPool(boolean flag)
If set to
true , uses a special Executor that is used
exclusively for decoding frames of animated resources, like GIFs. |
RequestOptions |
useUnlimitedSourceGeneratorsPool(boolean flag)
If set to
true , uses a cached unlimited Executor to run
the request. |
@NonNull @CheckResult public static RequestOptions sizeMultiplierOf(float sizeMultiplier)
RequestOptions
object with sizeMultiplier(float)
set.@NonNull @CheckResult public static RequestOptions diskCacheStrategyOf(@NonNull DiskCacheStrategy diskCacheStrategy)
RequestOptions
object with diskCacheStrategy(DiskCacheStrategy)
set.@NonNull @CheckResult public static RequestOptions priorityOf(@NonNull Priority priority)
RequestOptions
object with priority(Priority)
} set.@NonNull @CheckResult public static RequestOptions placeholderOf(@Nullable Drawable placeholder)
RequestOptions
object with placeholder(Drawable)
set.@NonNull @CheckResult public static RequestOptions placeholderOf(@DrawableRes int placeholderId)
RequestOptions
object with placeholder(int)
set.@NonNull @CheckResult public static RequestOptions errorOf(@Nullable Drawable errorDrawable)
RequestOptions
object with error(Drawable)
set.@NonNull @CheckResult public static RequestOptions errorOf(@DrawableRes int errorId)
RequestOptions
object with error(int)
} set.@NonNull @CheckResult public static RequestOptions skipMemoryCacheOf(boolean skipMemoryCache)
RequestOptions
object with skipMemoryCache(boolean)
set.@NonNull @CheckResult public static RequestOptions overrideOf(int width, int height)
RequestOptions
object with override(int, int)
} set.@NonNull @CheckResult public static RequestOptions overrideOf(int size)
RequestOptions
with override(int, int)
set where both the width and
height are the given size.@NonNull @CheckResult public static RequestOptions signatureOf(@NonNull Key signature)
RequestOptions
object with signature
set.@NonNull @CheckResult public static RequestOptions fitCenterTransform()
RequestOptions
object with fitCenter()
set.@NonNull @CheckResult public static RequestOptions centerInsideTransform()
RequestOptions
object with centerInside()
set.@NonNull @CheckResult public static RequestOptions centerCropTransform()
RequestOptions
object with centerCrop()
set.@NonNull @CheckResult public static RequestOptions circleCropTransform()
RequestOptions
object with circleCrop()
set.@NonNull @CheckResult public static RequestOptions bitmapTransform(@NonNull Transformation<Bitmap> transformation)
RequestOptions
object with transform(Transformation)
set.@NonNull @CheckResult public static RequestOptions noTransformation()
RequestOptions
object with dontTransform()
set.@NonNull @CheckResult public static <T> RequestOptions option(@NonNull Option<T> option, @NonNull T value)
@NonNull @CheckResult public static RequestOptions decodeTypeOf(@NonNull Class<?> resourceClass)
RequestOptions
object with decode(Class)
set.@NonNull @CheckResult public static RequestOptions formatOf(@NonNull DecodeFormat format)
RequestOptions
object with format(DecodeFormat)
set.@NonNull @CheckResult public static RequestOptions frameOf(long frameTimeMicros)
RequestOptions
object with frame(long)
set.@NonNull @CheckResult public static RequestOptions downsampleOf(@NonNull DownsampleStrategy strategy)
RequestOptions
object with downsample(DownsampleStrategy)
set.@NonNull @CheckResult public static RequestOptions timeoutOf(int timeout)
RequestOptions
object with timeout(int)
set.@NonNull @CheckResult public static RequestOptions encodeQualityOf(int quality)
RequestOptions
with encodeQuality(int)
called with the given quality.@NonNull @CheckResult public static RequestOptions encodeFormatOf(@NonNull Bitmap.CompressFormat format)
RequestOptions
with encodeFormat(android.graphics.Bitmap.CompressFormat)
called with the given format.@NonNull @CheckResult public static RequestOptions noAnimation()
RequestOptions
with dontAnimate()
called.@NonNull @CheckResult public RequestOptions 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.@NonNull @CheckResult public RequestOptions useUnlimitedSourceGeneratorsPool(boolean flag)
true
, uses a cached unlimited Executor
to run
the request.
This method should ONLY be used when a Glide load is started recursively on one of Glide's threads as part of another request. Using this method in other scenarios can lead to excessive memory usage and OOMs and/or a significant decrease in performance across an application.
If both this method and useAnimationPool(boolean)
are set, this method will be
preferred and useAnimationPool(boolean)
will be ignored.
@NonNull @CheckResult public RequestOptions useAnimationPool(boolean flag)
true
, uses a special Executor
that is used
exclusively for decoding frames of animated resources, like GIFs.
The animation executor disallows network operations and must not be used for loads that may load remote data. The animation executor has fewer threads available to it than Glide's normal executors and is only useful as a way of avoiding blocking on longer and more expensive reads for critical requests like those in an animating GIF.
If both useUnlimitedSourceGeneratorsPool(boolean)
and this method are set,
useUnlimitedSourceGeneratorsPool(boolean)
will be preferred and this method will be
ignored.
@NonNull @CheckResult public RequestOptions onlyRetrieveFromCache(boolean flag)
@NonNull @CheckResult public RequestOptions diskCacheStrategy(@NonNull DiskCacheStrategy strategy)
DiskCacheStrategy
to use for this load.
Defaults to DiskCacheStrategy.AUTOMATIC
.
For most applications DiskCacheStrategy.RESOURCE
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.DATA
or
DiskCacheStrategy.ALL
.
strategy
- The strategy to use.@NonNull @CheckResult public RequestOptions priority(@NonNull Priority priority)
priority
- A priority.@NonNull @CheckResult public RequestOptions placeholder(@Nullable Drawable drawable)
Drawable
to display while a resource is loading.drawable
- The drawable to display as a placeholder.@NonNull @CheckResult public RequestOptions placeholder(@DrawableRes int resourceId)
Drawable
resource to
display while a resource is loading.resourceId
- The id of the resource to use as a placeholder@NonNull @CheckResult public RequestOptions fallback(@Nullable Drawable drawable)
Drawable
to display if the model provided to
RequestBuilder.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.
drawable
- The drawable to display as a placeholder.placeholder(Drawable)
,
placeholder(int)
@NonNull @CheckResult public RequestOptions fallback(@DrawableRes int resourceId)
RequestBuilder.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.
resourceId
- The id of the resource to use as a fallback.placeholder(Drawable)
,
placeholder(int)
@NonNull @CheckResult public RequestOptions error(@Nullable Drawable drawable)
Drawable
to display if a load fails.drawable
- The drawable to display.@NonNull @CheckResult public RequestOptions error(@DrawableRes int resourceId)
resourceId
- The id of the resource to use as a placeholder.@NonNull @CheckResult public RequestOptions theme(@Nullable Resources.Theme theme)
Resources.Theme
to apply when loading Drawable
s
for resource ids provided via error(int)
, placeholder(int)
, and
fallback(Drawable)
.
The theme is NOT applied in the decoder that will attempt to decode a given resource id model on Glide's background threads. The theme is used exclusively on the main thread to obtain placeholder/error/fallback drawables to avoid leaking Activities.
If the Context
of the Fragment
or
Activity
used to start this load has a different
Resources.Theme
, the Resources.Theme
provided here will override the Resources.Theme
of the
Context
.
theme
- The theme to use when loading Drawables.@NonNull @CheckResult public RequestOptions 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.@NonNull @CheckResult public RequestOptions override(int width, int height)
Target
's width and height with the
given values. This is useful for thumbnails, and should only be used for other cases when you
need a very specific image size.width
- The width in pixels to use to load the resource.height
- The height in pixels to use to load the resource.@NonNull @CheckResult public RequestOptions override(int size)
Target
's width and height with the
given size.size
- The width and height to use.override(int, int)
@NonNull @CheckResult public RequestOptions signature(@NonNull Key signature)
Note - The signature does not replace the cache key, it is purely additive.
@CheckResult public RequestOptions clone()
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.
Even if this object was locked, the cloned object returned from this method will not be locked.
@NonNull @CheckResult public <T> RequestOptions set(@NonNull Option<T> option, @NonNull T value)
@NonNull @CheckResult public RequestOptions decode(@NonNull Class<?> resourceClass)
public final boolean isTransformationAllowed()
public final boolean isTransformationSet()
public final boolean isLocked()
@NonNull @CheckResult public RequestOptions encodeFormat(@NonNull Bitmap.CompressFormat format)
BitmapEncoder.COMPRESSION_FORMAT
.@NonNull @CheckResult public RequestOptions encodeQuality(int quality)
BitmapEncoder.COMPRESSION_QUALITY
.@NonNull @CheckResult public RequestOptions frame(long frameTimeMicros)
This is a component option specific to VideoDecoder
. If the default video
decoder is replaced or skipped because of your configuration, this option may be ignored.
frameTimeMicros
- The time position in microseconds of the desired frame. If negative, the
Android framework implementation return a representative frame.VideoDecoder.TARGET_FRAME
@NonNull @CheckResult public RequestOptions format(@NonNull DecodeFormat format)
DecodeFormat
to use when decoding Bitmap
objects using
Downsampler
and Glide's default GIF decoders.
DecodeFormat
is a request, not a requirement. It's possible the resource will be
decoded using a decoder that cannot control the format
(MediaMetadataRetriever
for example), or that the decoder may choose to
ignore the requested format if it can't display the image (i.e. RGB_565 is requested, but the
image has alpha).
This is a component option specific to Downsampler
and Glide's GIF decoders. If the
default Bitmap decoders are replaced or skipped because of your configuration, this option may
be ignored.
To set only the format used when decoding Bitmap
s, use
option(Option, Object)
and Downsampler.DECODE_FORMAT
. To set only the format
used when decoding GIF frames, use option(Option, Object)
and
GifOptions.DECODE_FORMAT
.
@NonNull @CheckResult public RequestOptions disallowHardwareConfig()
Bitmap.Config.HARDWARE
in Downsampler
to
avoid errors caused by inspecting Bitmap pixels, drawing with hardware support disabled,
drawing to Canvas
s backed by Bitmap
s etc.
It's almost never safe to set Downsampler.ALLOW_HARDWARE_CONFIG
to true
so
we only provide a way to disable hardware configs entirely. If no option is set for
Downsampler.ALLOW_HARDWARE_CONFIG
, Glide will set the value per request based on
whether or not a Transformation
is applied and if one is, the type of
Transformation
applied. Built in transformations like FitCenter
and
DownsampleStrategy.CenterOutside
can safely use
Bitmap.Config.HARDWARE
because they can be entirely replaced by
scaling within Downsampler
. Transformation
s like circleCrop()
that
can't be replicated by Downsampler
cannot use Bitmap.Config#HARDWARE
because
Bitmap.Config.HARDWARE
cannot be drawn to
Canvas
s, which is required by most Transformation
s.
@NonNull @CheckResult public RequestOptions downsample(@NonNull DownsampleStrategy strategy)
DownsampleStrategy
to use when decoding Bitmaps
using
Downsampler
.
This is a component option specific to Downsampler
. If the defautlt Bitmap decoder
is replaced or skipped because of your configuration, this option may be ignored.
@NonNull @CheckResult public RequestOptions timeout(int timeoutMs)
This is a component option specific to Glide's default networking library and
HttpGlideUrlLoader
. If you use any other
networking library including Glide's Volley or OkHttp integration libraries, this option will
be ignored.
timeoutMs
- The read and write timeout in milliseconds.HttpGlideUrlLoader.TIMEOUT
@NonNull @CheckResult public RequestOptions optionalCenterCrop()
CenterCrop
to all default types, and
ignores unknown types.
This will override previous calls to dontTransform()
.
@NonNull @CheckResult public RequestOptions centerCrop()
CenterCrop
to all default types and
throws an exception if asked to transform an unknown type.
this will override previous calls to dontTransform()
()}.
@NonNull @CheckResult public RequestOptions optionalFitCenter()
FitCenter
and to all default types, DownsampleStrategy.FIT_CENTER
to
image types, and ignores unknown types.
This will override previous calls to dontTransform()
and previous calls to
downsample(DownsampleStrategy)
.
@NonNull @CheckResult public RequestOptions fitCenter()
FitCenter
and to all default types, DownsampleStrategy.FIT_CENTER
to
image types, and throws an exception if asked to transform an unknown
type.
This will override previous calls to dontTransform()
and previous calls to
downsample(DownsampleStrategy)
.
@NonNull @CheckResult public RequestOptions optionalCenterInside()
CenterInside
to all default types,
DownsampleStrategy.CENTER_INSIDE
to image types, and ignores unknown types.
This will override previous calls to dontTransform()
and previous calls to
downsample(DownsampleStrategy)
.
@NonNull @CheckResult public RequestOptions centerInside()
CenterInside
to all default types, DownsampleStrategy.CENTER_INSIDE
to
image types and throws an exception if asked to transform an unknown type.
This will override previous calls to dontTransform()
and previous calls to
downsample(DownsampleStrategy)
.
@NonNull @CheckResult public RequestOptions optionalCircleCrop()
CircleCrop
to all default types, and ignores unknown types.
This will override previous calls to dontTransform()
.
optionalTransform(Transformation)
,
circleCrop()
@NonNull @CheckResult public RequestOptions circleCrop()
CircleCrop
to all default types and throws an exception if asked to transform
an unknown type.
This will override previous calls to dontTransform()
.
@NonNull @CheckResult public RequestOptions transform(@NonNull Transformation<Bitmap> transformation)
Transformation
for
Bitmaps
to the default types (Bitmap
,
BitmapDrawable
, and
GifDrawable
)
and throws an exception if asked to transform an unknown type.
This will override previous calls to dontTransform()
.
transformation
- Any Transformation
for Bitmap
s.optionalTransform(Transformation)
,
optionalTransform(Class, Transformation)
@NonNull @CheckResult public RequestOptions transforms(@NonNull Transformation<Bitmap>... transformations)
Transformation
s in the given order for
Bitmaps
to the default types (Bitmap
,
BitmapDrawable
, and
GifDrawable
)
and throws an exception if asked to transform an unknown type.
This will override previous calls to dontTransform()
.
transformations
- One or more Transformation
s for Bitmap
s.optionalTransform(Transformation)
,
optionalTransform(Class, Transformation)
@NonNull @CheckResult public RequestOptions optionalTransform(@NonNull Transformation<Bitmap> transformation)
Transformation
for
Bitmaps
to the default types (Bitmap
,
BitmapDrawable
, and
GifDrawable
) and ignores unknown types.
This will override previous calls to dontTransform()
.
transformation
- Any Transformation
for Bitmap
s.transform(Transformation)
,
transform(Class, Transformation)
@NonNull @CheckResult public <T> RequestOptions optionalTransform(@NonNull Class<T> resourceClass, @NonNull Transformation<T> transformation)
Transformation
for any decoded resource of
the given type and allows unknown resource types to be ignored.
Users can apply different transformations for each resource class. Applying a
Transformation
for a resource type that already has a
Transformation
will override the previous call.
If any calls are made to the non-optional transform methods, then attempting to transform an unknown resource class will throw an exception. To allow unknown types, users must always call the optional version of each method.
This will override previous calls to dontTransform()
.
resourceClass
- The type of resource to transform.transformation
- The Transformation
to apply.@NonNull @CheckResult public <T> RequestOptions transform(@NonNull Class<T> resourceClass, @NonNull Transformation<T> transformation)
Transformation
for any decoded resource of
the given type and throws if asked to transform an unknown resource type.
This will override previous calls to dontTransform()
.
resourceClass
- The type of resource to transform.transformation
- The Transformation
to apply.optionalTransform(Class, Transformation)
@NonNull @CheckResult public RequestOptions dontTransform()
Transformations
for all
resource classes and allows unknown resource types to be transformed without throwing an
exception.@NonNull @CheckResult public RequestOptions dontAnimate()
To disable transitions (fades etc) use
TransitionOptions.dontTransition()
@NonNull @CheckResult public RequestOptions apply(@NonNull RequestOptions other)
@NonNull public RequestOptions lock()
Once locked, the only way to unlock is to use clone()
@NonNull public RequestOptions autoClone()
lock()
except that mutations cause a clone()
operation to happen
before the mutation resulting in all methods returning a new Object and leaving the original
locked object unmodified.
Auto clone is not retained by cloned objects returned from mutations. The cloned objects are mutable and are not locked.
protected boolean isAutoCloneEnabled()
public final boolean isDiskCacheStrategySet()
public final boolean isSkipMemoryCacheSet()
@NonNull public final Map<Class<?>,Transformation<?>> getTransformations()
public final boolean isTransformationRequired()
@NonNull public final DiskCacheStrategy getDiskCacheStrategy()
public final int getErrorId()
public final int getPlaceholderId()
public final int getFallbackId()
@Nullable public final Resources.Theme getTheme()
public final boolean isMemoryCacheable()
public final boolean isPrioritySet()
public final int getOverrideWidth()
public final boolean isValidOverride()
public final int getOverrideHeight()
public final float getSizeMultiplier()
public final boolean getUseUnlimitedSourceGeneratorsPool()
public final boolean getUseAnimationPool()
public final boolean getOnlyRetrieveFromCache()