|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bumptech.glide.request.RequestFutureTarget<T,R>
T
- The type of the data to load.R
- The type of the resource that will be loaded.public class RequestFutureTarget<T,R>
A Future
implementation for Glide that can be used to load resources in a blocking
manner on background threads.
Note - Unlike most targets, RequestFutureTargets can be used once and only once. Attempting to reuse a RequestFutureTarget will probably result in undesirable behavior or exceptions. Instead of reusing objects of this class, the pattern should be:
RequestFutureTarget target = Glide.load("")...
Object resource = target.get();
// Do something with resource, and when finished:
Glide.clear(target);
The Glide.clear(FutureTarget)
call will make sure any resources used are recycled.
Field Summary |
---|
Fields inherited from interface com.bumptech.glide.request.target.Target |
---|
SIZE_ORIGINAL |
Constructor Summary | |
---|---|
RequestFutureTarget(Handler mainHandler,
int width,
int height)
Constructor for a RequestFutureTarget. |
Method Summary | |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning)
|
void |
clear()
Can be safely called from either the main thread or a background thread to cleanup the resources used by this target. |
R |
get()
|
R |
get(long time,
TimeUnit timeUnit)
|
Request |
getRequest()
Retrieves the current request for this target, should not be called outside of Glide. |
void |
getSize(SizeReadyCallback cb)
A callback that should never be invoked directly. |
boolean |
isCancelled()
|
boolean |
isDone()
|
void |
onDestroy()
Callback for when Fragment.onDestroy() } or Activity.onDestroy() is
called. |
void |
onLoadCleared(Drawable placeholder)
A callback that should never be invoked directly. |
void |
onLoadFailed(Exception e,
Drawable errorDrawable)
A callback that should never be invoked directly. |
void |
onLoadStarted(Drawable placeholder)
A callback that should never be invoked directly. |
void |
onResourceReady(R resource,
GlideAnimation<? super R> glideAnimation)
A callback that should never be invoked directly. |
void |
onStart()
Callback for when Fragment.onStart() } or Activity.onStart() is called. |
void |
onStop()
Callback for when Fragment.onStop() } or Activity.onStop() } is called. |
void |
run()
A callback that should never be invoked directly. |
void |
setRequest(Request request)
Sets the current request for this target to retain, should not be called outside of Glide. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RequestFutureTarget(Handler mainHandler, int width, int height)
Method Detail |
---|
public boolean cancel(boolean mayInterruptIfRunning)
cancel
in interface Future<R>
public boolean isCancelled()
isCancelled
in interface Future<R>
public boolean isDone()
isDone
in interface Future<R>
public R get() throws InterruptedException, ExecutionException
get
in interface Future<R>
InterruptedException
ExecutionException
public R get(long time, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<R>
InterruptedException
ExecutionException
TimeoutException
public void getSize(SizeReadyCallback cb)
getSize
in interface Target<R>
cb
- The callback that must be called when the size of the target has been determinedpublic void setRequest(Request request)
Target
setRequest
in interface Target<R>
public Request getRequest()
Target
getRequest
in interface Target<R>
public void onLoadCleared(Drawable placeholder)
onLoadCleared
in interface Target<R>
placeholder
- The placeholder drawable to optionally show, or null.public void onLoadStarted(Drawable placeholder)
onLoadStarted
in interface Target<R>
placeholder
- The placeholder drawable to optionally show, or null.public void onLoadFailed(Exception e, Drawable errorDrawable)
onLoadFailed
in interface Target<R>
e
- The exception causing the load to fail, or null if no exception occurred (usually because a decoder
simply returned null).errorDrawable
- The error drawable to optionally show, or null.public void onResourceReady(R resource, GlideAnimation<? super R> glideAnimation)
onResourceReady
in interface Target<R>
resource
- the loaded resource.public void run()
run
in interface Runnable
public void clear()
clear
in interface FutureTarget<R>
public void onStart()
LifecycleListener
Fragment.onStart()
} or Activity.onStart()
is called.
onStart
in interface LifecycleListener
public void onStop()
LifecycleListener
Fragment.onStop()
} or Activity.onStop()
} is called.
onStop
in interface LifecycleListener
public void onDestroy()
LifecycleListener
Fragment.onDestroy()
} or Activity.onDestroy()
is
called.
onDestroy
in interface LifecycleListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |