FutureTarget

interface FutureTarget<R> : Future<V> , Target<R>

An interface for an object that is both a com.bumptech.glide.request.target.Target and a java.util.concurrent.Future. For example:


FutureTarget<Bitmap> futureTarget = Glide.with(fragment)
                                      .load("http://goo.gl/1asf12")
                                      .asBitmap()
                                      .into(250, 250);
Bitmap myBitmap = futureTarget.get();
... // do things with bitmap and then release when finished:
futureTarget.cancel(false);

Note - get and get must be called off of the main thread or they will block forever.

Parameters

<R>

The type of resource this FutureTarget will retrieve.

Functions

Link copied to clipboard
abstract fun cancel(p: Boolean): Boolean
Link copied to clipboard
abstract fun get(): V
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 isCancelled(): Boolean
Link copied to clipboard
abstract fun isDone(): Boolean
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