Google is committed to advancing racial equity for Black communities. See how.

LoadBundleTask

public class LoadBundleTask extends Task<LoadBundleTaskProgress>

Represents the task of loading a Firestore bundle. It provides progress of bundle loading, as well as task completion and error events.

Public Method Summary

Task<LoadBundleTaskProgress>
addOnCanceledListener(OnCanceledListener onCanceledListener)
Adds a listener that is called if the Task is canceled.
Task<LoadBundleTaskProgress>
addOnCanceledListener(Executor executor, OnCanceledListener onCanceledListener)
Adds a listener that is called if the Task is canceled.
Task<LoadBundleTaskProgress>
addOnCanceledListener(Activity activity, OnCanceledListener onCanceledListener)
Adds an Activity-scoped listener that is called if the Task is canceled.
Task<LoadBundleTaskProgress>
addOnCompleteListener(Executor executor, OnCompleteListener<LoadBundleTaskProgress> onCompleteListener)
Adds a listener that is called when the Task succeeds or fails.
Task<LoadBundleTaskProgress>
addOnCompleteListener(Activity activity, OnCompleteListener<LoadBundleTaskProgress> onCompleteListener)
Adds a listener that is called when the Task succeeds or fails.
Task<LoadBundleTaskProgress>
addOnCompleteListener(OnCompleteListener<LoadBundleTaskProgress> onCompleteListener)
Adds a listener that is called when the Task succeeds or fails.
Task<LoadBundleTaskProgress>
addOnFailureListener(Activity activity, OnFailureListener onFailureListener)
Adds a listener that is called if the Task fails.
Task<LoadBundleTaskProgress>
addOnFailureListener(OnFailureListener onFailureListener)
Adds a listener that is called if the Task fails.
Task<LoadBundleTaskProgress>
addOnFailureListener(Executor executor, OnFailureListener onFailureListener)
Adds a listener that is called if the Task fails.
LoadBundleTask
addOnProgressListener(OnProgressListener<LoadBundleTaskProgress> listener)
Adds a listener that is called periodically while the LoadBundleTask executes.
LoadBundleTask
addOnProgressListener(Executor executor, OnProgressListener<LoadBundleTaskProgress> listener)
Adds a listener that is called periodically while the LoadBundleTask executes.
LoadBundleTask
addOnProgressListener(Activity activity, OnProgressListener<LoadBundleTaskProgress> listener)
Adds a listener that is called periodically while the LoadBundleTask executes.
Task<LoadBundleTaskProgress>
addOnSuccessListener(OnSuccessListener<? super LoadBundleTaskProgress> onSuccessListener)
Adds a listener that is called if the Task completes successfully.
Task<LoadBundleTaskProgress>
addOnSuccessListener(Executor executor, OnSuccessListener<? super LoadBundleTaskProgress> onSuccessListener)
Adds a listener that is called if the Task completes successfully.
Task<LoadBundleTaskProgress>
addOnSuccessListener(Activity activity, OnSuccessListener<? super LoadBundleTaskProgress> onSuccessListener)
Adds a listener that is called if the Task completes successfully.
<TContinuationResult> Task<TContinuationResult>
continueWith(Executor executor, Continuation<LoadBundleTaskProgress, TContinuationResult> continuation)
Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.
<TContinuationResult> Task<TContinuationResult>
continueWith(Continuation<LoadBundleTaskProgress, TContinuationResult> continuation)
Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.
<TContinuationResult> Task<TContinuationResult>
continueWithTask(Executor executor, Continuation<LoadBundleTaskProgressTask<TContinuationResult>> continuation)
Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.
<TContinuationResult> Task<TContinuationResult>
continueWithTask(Continuation<LoadBundleTaskProgressTask<TContinuationResult>> continuation)
Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.
Exception
getException()
Returns the exception that caused the Task to fail.
LoadBundleTaskProgress
getResult()
Gets the result of the Task, if it has already completed.
<X extends Throwable> LoadBundleTaskProgress
getResult(Class<X> exceptionType)
Gets the result of the Task, if it has already completed.
boolean
isCanceled()
Returns true if the task has been canceled.
boolean
isComplete()
Returns true if the Task is complete; false otherwise.
boolean
isSuccessful()
Returns true if the Task has completed successfully; false otherwise.
<TContinuationResult> Task<TContinuationResult>
onSuccessTask(Executor executor, SuccessContinuation<LoadBundleTaskProgress, TContinuationResult> successContinuation)
Returns a new Task that will be completed with the result of applying the specified SuccessContinuation to this Task when this Task completes successfully.
<TContinuationResult> Task<TContinuationResult>
onSuccessTask(SuccessContinuation<LoadBundleTaskProgress, TContinuationResult> successContinuation)
Returns a new Task that will be completed with the result of applying the specified SuccessContinuation to this Task when this Task completes successfully.

Inherited Method Summary

Public Methods

public Task<LoadBundleTaskProgress> addOnCanceledListener (OnCanceledListener onCanceledListener)

Adds a listener that is called if the Task is canceled.

The listener will be called on main application thread. If the Task has already been canceled, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.

Returns
  • this Task

public Task<LoadBundleTaskProgress> addOnCanceledListener (Executor executor, OnCanceledListener onCanceledListener)

Adds a listener that is called if the Task is canceled.

If the task has already been canceled, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.

Parameters
executor the executor to use to call the listener
onCanceledListener
Returns
  • this Task

public Task<LoadBundleTaskProgress> addOnCanceledListener (Activity activity, OnCanceledListener onCanceledListener)

Adds an Activity-scoped listener that is called if the Task is canceled.

The listener will be called on main application thread. If the task has already been canceled, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.

The listener will be automatically removed during onStop().

Returns
  • this Task

public Task<LoadBundleTaskProgress> addOnCompleteListener (Executor executor, OnCompleteListener<LoadBundleTaskProgress> onCompleteListener)

Adds a listener that is called when the Task succeeds or fails.

If the task has already failed, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.

Parameters
executor the executor to use to call the listener
onCompleteListener
Returns
  • this Task

public Task<LoadBundleTaskProgress> addOnCompleteListener (Activity activity, OnCompleteListener<LoadBundleTaskProgress> onCompleteListener)

Adds a listener that is called when the Task succeeds or fails.

If the task has already failed, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.

Parameters
activity When the supplied Activity stops, this listener will automatically be removed.
onCompleteListener
Returns
  • this Task

public Task<LoadBundleTaskProgress> addOnCompleteListener (OnCompleteListener<LoadBundleTaskProgress> onCompleteListener)

Adds a listener that is called when the Task succeeds or fails.

The listener will be called on main application thread. If the task has already failed, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.

Returns
  • this Task

public Task<LoadBundleTaskProgress> addOnFailureListener (Activity activity, OnFailureListener onFailureListener)

Adds a listener that is called if the Task fails.

If the task has already failed, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.

Parameters
activity When the supplied Activity stops, this listener will automatically be removed.
onFailureListener
Returns
  • this Task

public Task<LoadBundleTaskProgress> addOnFailureListener (OnFailureListener onFailureListener)

Adds a listener that is called if the Task fails.

The listener will be called on main application thread. If the task has already failed, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.

Returns
  • this Task

public Task<LoadBundleTaskProgress> addOnFailureListener (Executor executor, OnFailureListener onFailureListener)

Adds a listener that is called if the Task fails.

If the task has already failed, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.

Parameters
executor the executor to use to call the listener
onFailureListener
Returns
  • this Task

public LoadBundleTask addOnProgressListener (OnProgressListener<LoadBundleTaskProgress> listener)

Adds a listener that is called periodically while the LoadBundleTask executes.

The listener will be called on main application thread. If multiple listeners are added, they will be called in the order in which they were added.

The listener will be automatically removed during onStop().

Returns
  • this Task

public LoadBundleTask addOnProgressListener (Executor executor, OnProgressListener<LoadBundleTaskProgress> listener)

Adds a listener that is called periodically while the LoadBundleTask executes.

If multiple listeners are added, they will be called in the order in which they were added.

Parameters
executor the executor to use to call the listener
listener
Returns
  • this Task

public LoadBundleTask addOnProgressListener (Activity activity, OnProgressListener<LoadBundleTaskProgress> listener)

Adds a listener that is called periodically while the LoadBundleTask executes.

The listener will be called on main application thread. If multiple listeners are added, they will be called in the order in which they were added.

The listener will be automatically removed during onStop().

Parameters
activity When the supplied Activity stops, this listener will automatically be removed.
listener
Returns
  • this Task

public Task<LoadBundleTaskProgress> addOnSuccessListener (OnSuccessListener<? super LoadBundleTaskProgress> onSuccessListener)

Adds a listener that is called if the Task completes successfully. The listener will be called on the main application thread. If the task has already completed successfully, a call to the listener will be immediately scheduled. If multiple listeners are added, they will be called in the order in which they were added.

Returns
  • this Task

public Task<LoadBundleTaskProgress> addOnSuccessListener (Executor executor, OnSuccessListener<? super LoadBundleTaskProgress> onSuccessListener)

Adds a listener that is called if the Task completes successfully.

If multiple listeners are added, they will be called in the order in which they were added. If the task has already completed successfully, a call to the listener will be immediately scheduled.

Parameters
executor the executor to use to call the listener
onSuccessListener
Returns
  • this Task

public Task<LoadBundleTaskProgress> addOnSuccessListener (Activity activity, OnSuccessListener<? super LoadBundleTaskProgress> onSuccessListener)

Adds a listener that is called if the Task completes successfully.

If multiple listeners are added, they will be called in the order in which they were added. If the task has already completed successfully, a call to the listener will be immediately scheduled.

Parameters
activity When the supplied Activity stops, this listener will automatically be removed.
onSuccessListener
Returns
  • this Task

public Task<TContinuationResult> continueWith (Executor executor, Continuation<LoadBundleTaskProgress, TContinuationResult> continuation)

Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.

Parameters
executor the executor to use to call the Continuation
continuation
See Also

public Task<TContinuationResult> continueWith (Continuation<LoadBundleTaskProgress, TContinuationResult> continuation)

Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.

The Continuation will be called on the main application thread.

See Also

public Task<TContinuationResult> continueWithTask (Executor executor, Continuation<LoadBundleTaskProgressTask<TContinuationResult>> continuation)

Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.

Parameters
executor the executor to use to call the Continuation
continuation
See Also

public Task<TContinuationResult> continueWithTask (Continuation<LoadBundleTaskProgressTask<TContinuationResult>> continuation)

Returns a new Task that will be completed with the result of applying the specified Continuation to this Task.

The Continuation will be called on the main application thread.

See Also

public Exception getException ()

Returns the exception that caused the Task to fail. Returns null if the Task is not yet complete, or completed successfully.

public LoadBundleTaskProgress getResult ()

Gets the result of the Task, if it has already completed.

Throws
IllegalStateException if the Task is not yet complete
RuntimeExecutionException if the Task failed with an exception

public LoadBundleTaskProgress getResult (Class<X> exceptionType)

Gets the result of the Task, if it has already completed.

Throws
IllegalStateException if the Task is not yet complete
if the Task failed with an exception of type X
RuntimeExecutionException if the Task failed with an exception that was not of type X
Throwable

public boolean isCanceled ()

Returns true if the task has been canceled.

public boolean isComplete ()

Returns true if the Task is complete; false otherwise.

public boolean isSuccessful ()

Returns true if the Task has completed successfully; false otherwise.

public Task<TContinuationResult> onSuccessTask (Executor executor, SuccessContinuation<LoadBundleTaskProgress, TContinuationResult> successContinuation)

Returns a new Task that will be completed with the result of applying the specified SuccessContinuation to this Task when this Task completes successfully. If the previous Task fails, the onSuccessTask completion will be skipped and failure listeners will be invoked.

If the previous Task is canceled, the returned Task will also be canceled and the SuccessContinuation would not execute.

Parameters
executor the executor to use to call the SuccessContinuation
successContinuation

public Task<TContinuationResult> onSuccessTask (SuccessContinuation<LoadBundleTaskProgress, TContinuationResult> successContinuation)

Returns a new Task that will be completed with the result of applying the specified SuccessContinuation to this Task when this Task completes successfully. If the previous Task fails, the onSuccessTask completion will be skipped and failure listeners will be invoked.

The SuccessContinuation will be called on the main application thread.

If the previous Task is canceled, the returned Task will also be canceled and the SuccessContinuation would not execute.