CustomViewTarget

abstract class CustomViewTarget<T : View?, Z> : Target<R>

A base Target for loading resources (android.graphics.Bitmap, Drawable etc) into Views that provides default implementations for most methods and can determine the size of views using a android.view.ViewTreeObserver.OnDrawListener.

Parameters

<T>

The specific subclass of view wrapped by this target (e.g. )

<Z>

The resource type this target will receive (e.g. android.graphics.Bitmap).

Constructors

Link copied to clipboard
open fun CustomViewTarget(view: T)
Constructor that defaults waitForLayout to false.

Functions

Link copied to clipboard
fun clearOnDetach(): CustomViewTarget<T, Z>
Clears the View's Request when the View is detached from its and restarts the Request when the View is re-attached from its android.view.
Link copied to clipboard
fun getRequest(): Request
Returns any stored request using getTag.
Link copied to clipboard
fun getSize(cb: SizeReadyCallback)
Determines the size of the view by first checking getWidth and getHeight.
Link copied to clipboard
fun getView(): T
Returns the wrapped android.view.
Link copied to clipboard
open fun onDestroy()
Callback for when onDestroy} or onDestroy is called.
Link copied to clipboard
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
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
open fun onStart()
Callback for when onStart} or onStart is called.
Link copied to clipboard
open fun onStop()
Callback for when onStop} or onStop} is called.
Link copied to clipboard
fun removeCallback(cb: SizeReadyCallback)
Removes the given callback from the pending set if it's still retained.
Link copied to clipboard
fun setRequest(request: Request)
Stores the request using setTag.
Link copied to clipboard
open fun toString(): String
Link copied to clipboard
fun useTagId(tagId: Int): CustomViewTarget<T, Z>
Override the android resource id to store temporary state allowing loads to be automatically cancelled and resources re-used in scrolling lists.
Link copied to clipboard
fun waitForLayout(): CustomViewTarget<T, Z>
Indicates that Glide should always wait for any pending layout pass before checking for the size an View.

Properties

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