Package com.airbnb.lottie
Class LottieTask<T>
- java.lang.Object
-
- com.airbnb.lottie.LottieTask<T>
-
public class LottieTask<T> extends java.lang.ObjectHelper to run asynchronous tasks with a result. Results can be obtained withaddListener(LottieListener). Failures can be obtained withaddFailureListener(LottieListener). A task will produce a single result or a single failure.
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.concurrent.ExecutorEXECUTORSet this to change the executor that LottieTasks are run on.
-
Constructor Summary
Constructors Constructor Description LottieTask(java.util.concurrent.Callable<LottieResult<T>> runnable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LottieTask<T>addFailureListener(LottieListener<java.lang.Throwable> listener)Add a task failure listener.LottieTask<T>addListener(LottieListener<T> listener)Add a task listener.LottieTask<T>removeFailureListener(LottieListener<java.lang.Throwable> listener)Remove a given task failure listener.LottieTask<T>removeListener(LottieListener<T> listener)Remove a given task listener.
-
-
-
Constructor Detail
-
LottieTask
public LottieTask(java.util.concurrent.Callable<LottieResult<T>> runnable)
-
-
Method Detail
-
addListener
public LottieTask<T> addListener(LottieListener<T> listener)
Add a task listener. If the task has completed, the listener will be called synchronously.- Returns:
- the task for call chaining.
-
removeListener
public LottieTask<T> removeListener(LottieListener<T> listener)
Remove a given task listener. The task will continue to execute so you can re-add a listener if neccesary.- Returns:
- the task for call chaining.
-
addFailureListener
public LottieTask<T> addFailureListener(LottieListener<java.lang.Throwable> listener)
Add a task failure listener. This will only be called in the even that an exception occurs. If an exception has already occurred, the listener will be called immediately.- Returns:
- the task for call chaining.
-
removeFailureListener
public LottieTask<T> removeFailureListener(LottieListener<java.lang.Throwable> listener)
Remove a given task failure listener. The task will continue to execute so you can re-add a listener if neccesary.- Returns:
- the task for call chaining.
-
-