RequestManager
A class for managing and starting requests for Glide. Can use activity, fragment and connectivity lifecycle events to intelligently stop, start, and restart requests. Retrieve either by instantiating a new object, or to take advantage built in Activity and Fragment lifecycle handling, use the static Glide.load methods with your Fragment or Activity.
See also
Constructors
Link copied to clipboard
open fun RequestManager( glide: Glide, lifecycle: Lifecycle, treeNode: RequestManagerTreeNode, context: Context)
Content copied to clipboard
Functions
Link copied to clipboard
open fun addDefaultRequestListener(requestListener: RequestListener<Any>): RequestManager
Content copied to clipboard
Adds a default RequestListener that will be added to every request started with this RequestManager.
Link copied to clipboard
open fun applyDefaultRequestOptions(requestOptions: RequestOptions): RequestManager
Content copied to clipboard
Updates the default RequestOptions for all loads started with this request manager with the given RequestOptions.
Link copied to clipboard
open fun <ResourceType> as(resourceClass: Class<ResourceType>): RequestBuilder<ResourceType>
Content copied to clipboard
Attempts to load the resource using any registered s that can decode the given resource class or any subclass of the given resource class.
Link copied to clipboard
Attempts to always load the resource as a android.graphics.
Link copied to clipboard
Attempts to always load the resource using any registered s that can decode any subclass of Drawable.
Link copied to clipboard
Attempts to always load a File containing the resource, either using a file path obtained from the media store (for local images/videos), or using Glide's disk cache (for remote images/videos).
Link copied to clipboard
Attempts to always load the resource as a .
Link copied to clipboard
Cancel any pending loads Glide may have for the view and free any resources that may have been loaded for the view.
Cancel any pending loads Glide may have for the target and free any resources (such as s) that may have been loaded for the target so they may be reused.
Link copied to clipboard
A helper method equivalent to calling downloadOnly ()} and then load with the given model.
Link copied to clipboard
Attempts always load the resource into the cache and return the File containing the cached source data.
Link copied to clipboard
Returns true if loads for this RequestManager are currently paused.
Link copied to clipboard
Equivalent to calling asDrawable and then load.
A helper method equivalent to calling asDrawable and then load with the given model.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Cancels any in progress loads and clears resources of completed loads.
Link copied to clipboard
Performs pauseAllRequests recursively for all managers that are contextually descendant to this manager based on the Activity/Fragment hierarchy.
Link copied to clipboard
Cancels any in progress loads, but does not clear resources of completed loads.
Link copied to clipboard
Performs pauseRequests recursively for all managers that are contextually descendant to this manager based on the Activity/Fragment hierarchy:
- When pausing on an Activity all attached fragments will also get paused.
- When pausing on an attached Fragment all descendant fragments will also get paused.
- When pausing on a detached Fragment or the application context only the current RequestManager is paused.
Link copied to clipboard
Restarts any loads that have not yet completed.
Link copied to clipboard
Performs resumeRequests recursively for all managers that are contextually descendant to this manager based on the Activity/Fragment hierarchy.
Link copied to clipboard
open fun setDefaultRequestOptions(requestOptions: RequestOptions): RequestManager
Content copied to clipboard
Replaces the default RequestOptions for all loads started with this request manager with the given RequestOptions.
Link copied to clipboard
open fun setPauseAllRequestsOnTrimMemoryModerate(pauseAllOnTrim: Boolean)
Content copied to clipboard
If
true
then clear all in-progress and completed requests when the platform sends onTrimMemory
with level = TRIM_MEMORY_MODERATE
.