Target

interface Target<R> : LifecycleListener

An interface that Glide can load a resource into and notify of relevant lifecycle events during a load.

The lifecycle events in this class are as follows:

  • onLoadStarted
  • onResourceReady
  • onLoadCleared
  • onLoadFailed
The typical lifecycle is onLoadStarted, then onResourceReady or onLoadFailed, then onLoadCleared. However, there are no guarantees. onLoadStarted may not be called if the resource is in memory or if the load will fail because of a null model object. onLoadCleared similarly may never be called if the target is never cleared. See the docs for the individual methods for details.

Parameters

<R>

The type of resource the target can display.

Functions

Link copied to clipboard
abstract fun getRequest(): Request
Retrieves the current request for this target, should not be called outside of Glide.
Link copied to clipboard
abstract fun getSize(cb: SizeReadyCallback)
A method to retrieve the size of this target.
Link copied to clipboard
abstract fun onDestroy()
Callback for when onDestroy} or onDestroy is called.
Link copied to clipboard
abstract fun onLoadCleared(placeholder: Drawable)
A mandatory lifecycle callback that is called when a load is cancelled and its resources are freed.
Link copied to clipboard
abstract fun onLoadFailed(errorDrawable: Drawable)
A mandatory lifecycle callback that is called when a load fails.
Link copied to clipboard
abstract fun onLoadStarted(placeholder: Drawable)
A lifecycle callback that is called when a load is started.
Link copied to clipboard
abstract fun onResourceReady(resource: R, transition: Transition<out Any>)
The method that will be called when the resource load has finished.
Link copied to clipboard
abstract fun onStart()
Callback for when onStart} or onStart is called.
Link copied to clipboard
abstract fun onStop()
Callback for when onStop} or onStop} is called.
Link copied to clipboard
abstract fun removeCallback(cb: SizeReadyCallback)
Removes the given callback from the pending set if it's still retained.
Link copied to clipboard
abstract fun setRequest(request: Request)
Sets the current request for this target to retain, should not be called outside of Glide.

Properties

Link copied to clipboard
val SIZE_ORIGINAL: Int
Indicates that we want the resource in its original unmodified width and/or height.

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard