public final class GlideBuilder extends Object
Constructor and Description |
---|
GlideBuilder() |
Modifier and Type | Method and Description |
---|---|
Glide |
build(Context context) |
GlideBuilder |
setArrayPool(ArrayPool arrayPool)
Sets the
ArrayPool implementation to allow variable sized arrays to be stored
and retrieved as needed. |
GlideBuilder |
setBitmapPool(BitmapPool bitmapPool)
Sets the
BitmapPool implementation to use
to store and retrieve reused Bitmap s. |
GlideBuilder |
setConnectivityMonitorFactory(ConnectivityMonitorFactory factory)
Sets the
ConnectivityMonitorFactory
to use to notify RequestManager of connectivity events. |
GlideBuilder |
setDecodeFormat(DecodeFormat decodeFormat)
Deprecated.
Use
setDefaultRequestOptions(RequestOptions) instead. |
GlideBuilder |
setDefaultRequestOptions(RequestOptions requestOptions)
Sets the default
RequestOptions to use for all loads across the app. |
GlideBuilder |
setDiskCache(DiskCache.Factory diskCacheFactory)
Sets the
DiskCache.Factory implementation to use
to construct the DiskCache to use to store Resource data on disk. |
GlideBuilder |
setDiskCache(DiskCache diskCache)
Deprecated.
Creating a disk cache directory on the main thread causes strict mode violations,
use
setDiskCache(com.bumptech.glide.load.engine.cache.DiskCache.Factory) instead.
Scheduled to be removed in Glide 4.0. |
GlideBuilder |
setDiskCacheExecutor(GlideExecutor service)
Sets the
ExecutorService implementation to use when retrieving
Resource s that are currently in cache. |
GlideBuilder |
setLogLevel(int logLevel)
Sets a log level constant from those in
Log to indicate the desired log verbosity. |
GlideBuilder |
setMemoryCache(MemoryCache memoryCache)
Sets the
MemoryCache implementation to store
Resource s that are not currently in use. |
GlideBuilder |
setMemorySizeCalculator(MemorySizeCalculator.Builder builder)
Sets the
MemorySizeCalculator to use to calculate maximum sizes for default
MemoryCaches and/or default BitmapPools . |
GlideBuilder |
setMemorySizeCalculator(MemorySizeCalculator calculator)
Sets the
MemorySizeCalculator to use to calculate maximum sizes for default
MemoryCaches and/or default BitmapPools . |
GlideBuilder |
setResizeExecutor(GlideExecutor service)
Sets the
ExecutorService implementation to use when retrieving
Resource s that are not already in the cache. |
public GlideBuilder setBitmapPool(BitmapPool bitmapPool)
BitmapPool
implementation to use
to store and retrieve reused Bitmap
s.bitmapPool
- The pool to use.public GlideBuilder setArrayPool(ArrayPool arrayPool)
ArrayPool
implementation to allow variable sized arrays to be stored
and retrieved as needed.arrayPool
- The pool to use.public GlideBuilder setMemoryCache(MemoryCache memoryCache)
MemoryCache
implementation to store
Resource
s that are not currently in use.memoryCache
- The cache to use.@Deprecated public GlideBuilder setDiskCache(DiskCache diskCache)
setDiskCache(com.bumptech.glide.load.engine.cache.DiskCache.Factory)
instead.
Scheduled to be removed in Glide 4.0.diskCache
- The disk cache to use.public GlideBuilder setDiskCache(DiskCache.Factory diskCacheFactory)
DiskCache.Factory
implementation to use
to construct the DiskCache
to use to store Resource
data on disk.diskCacheFactory
- The disk cache factory to use.public GlideBuilder setResizeExecutor(GlideExecutor service)
ExecutorService
implementation to use when retrieving
Resource
s that are not already in the cache.
Any implementation must order requests based on their Priority
for thumbnail requests to work properly.
service
- The ExecutorService to use.setDiskCacheExecutor(GlideExecutor)
,
GlideExecutor
public GlideBuilder setDiskCacheExecutor(GlideExecutor service)
ExecutorService
implementation to use when retrieving
Resource
s that are currently in cache.
Any implementation must order requests based on their Priority
for thumbnail requests to work properly.
service
- The ExecutorService to use.setResizeExecutor(GlideExecutor)
,
GlideExecutor
public GlideBuilder setDefaultRequestOptions(RequestOptions requestOptions)
RequestOptions
to use for all loads across the app.
Applying additional options with RequestBuilder.apply(RequestOptions)
will override defaults
set here.
requestOptions
- The options to use by default.@Deprecated public GlideBuilder setDecodeFormat(DecodeFormat decodeFormat)
setDefaultRequestOptions(RequestOptions)
instead.DecodeFormat
that will be the default format for all
the default decoders that can change the Bitmap.Config
of the Bitmap
s they decode.
Decode format is always a suggestion, not a requirement. See DecodeFormat
for more details.
decodeFormat
- The format to use.public GlideBuilder setMemorySizeCalculator(MemorySizeCalculator.Builder builder)
MemorySizeCalculator
to use to calculate maximum sizes for default
MemoryCaches
and/or default BitmapPools
.builder
- The builder to use (will not be modified).setMemorySizeCalculator(MemorySizeCalculator)
public GlideBuilder setMemorySizeCalculator(MemorySizeCalculator calculator)
MemorySizeCalculator
to use to calculate maximum sizes for default
MemoryCaches
and/or default BitmapPools
.
The given MemorySizeCalculator
will not affect custom pools or caches provided
via setBitmapPool(BitmapPool)
or setMemoryCache(MemoryCache)
.
calculator
- The calculator to use.public GlideBuilder setConnectivityMonitorFactory(ConnectivityMonitorFactory factory)
ConnectivityMonitorFactory
to use to notify RequestManager
of connectivity events.
If not set DefaultConnectivityMonitorFactory
would be used.factory
- The factory to usepublic GlideBuilder setLogLevel(int logLevel)
Log
to indicate the desired log verbosity.
The level must be one of Log.VERBOSE
, Log.DEBUG
, Log.INFO
,
Log.WARN
, or Log.ERROR
.
Log.VERBOSE
means one or more lines will be logged per request, including
timing logs and failures. Log.DEBUG
means at most one line will be logged
per successful request, including timing logs, although many lines may be logged for
failures including multiple complete stack traces. Log.INFO
means
failed loads will be logged including multiple complete stack traces, but successful loads
will not be logged at all. Log.WARN
means only summaries of failed loads will be
logged. Log.ERROR
means only exceptional cases will be logged.
All logs will be logged using the 'Glide' tag.
Many other debugging logs are available in individual classes. The log level supplied here
only controls a small set of informative and well formatted logs. Users wishing to debug
certain aspects of the library can look for individual TAG
variables at the tops
of classes and use adb shell setprop log.tag.TAG
to enable or disable any relevant
tags.
logLevel
- The log level to use from Log
.