-
public interface ImageLoaderA service class that loads images by executing ImageRequests. Image loaders handle caching, data fetching, image decoding, request management, memory management, and more.
Image loaders are designed to be shareable and work best when you create a single instance and share it throughout your app.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classImageLoader.Builder
-
Method Summary
Modifier and Type Method Description abstract Disposableenqueue(ImageRequest request)Enqueue the request to be executed asynchronously. abstract ImageResultexecute(ImageRequest request)Execute the request in the current coroutine scope. abstract Unitshutdown()Cancel any new and in progress requests, clear the MemoryCache, and close any open system resources. abstract ImageLoader.BuildernewBuilder()Create an ImageLoader.Builder that shares the same resources and configuration as this image loader. abstract DefaultRequestOptionsgetDefaults()The default options that are used to fill in unset ImageRequest values. abstract ComponentRegistrygetComponents()The components used to fulfil image requests. abstract MemoryCachegetMemoryCache()An in-memory cache of previously loaded images. abstract DiskCachegetDiskCache()An on-disk cache of previously loaded images. -
-
Method Detail
-
enqueue
abstract Disposable enqueue(ImageRequest request)
Enqueue the request to be executed asynchronously.
NOTE: The request will wait until ImageRequest.lifecycle is at least Lifecycle.State.STARTED before being executed.
- Parameters:
request- The request to execute.
-
execute
abstract ImageResult execute(ImageRequest request)
Execute the request in the current coroutine scope.
NOTE: If ImageRequest.target is a ViewTarget, the job will automatically be cancelled if its view is detached.
- Parameters:
request- The request to execute.
-
shutdown
abstract Unit shutdown()
Cancel any new and in progress requests, clear the MemoryCache, and close any open system resources.
Shutting down an image loader is optional. It will be shut down automatically if dereferenced.
-
newBuilder
abstract ImageLoader.Builder newBuilder()
Create an ImageLoader.Builder that shares the same resources and configuration as this image loader.
-
getDefaults
abstract DefaultRequestOptions getDefaults()
The default options that are used to fill in unset ImageRequest values.
-
getComponents
abstract ComponentRegistry getComponents()
The components used to fulfil image requests.
-
getMemoryCache
abstract MemoryCache getMemoryCache()
An in-memory cache of previously loaded images.
-
getDiskCache
abstract DiskCache getDiskCache()
An on-disk cache of previously loaded images.
-
-
-
-