public class RecentsLoader extends AsyncTaskLoader<DirectoryResult>
Modifier and Type | Class and Description |
---|---|
class |
RecentsLoader.RecentsTask |
Loader.ForceLoadContentObserver, Loader.OnLoadCanceledListener<D>, Loader.OnLoadCompleteListener<D>
Constructor and Description |
---|
RecentsLoader(Context context,
RootsCache roots,
State state) |
Modifier and Type | Method and Description |
---|---|
void |
cancelLoadInBackground()
Called on the main thread to abort a load in progress.
|
void |
deliverResult(DirectoryResult result)
Sends the result of the load to the registered listener.
|
DirectoryResult |
loadInBackground()
Called on a worker thread to perform the actual load and to return
the result of the load operation.
|
void |
onCanceled(DirectoryResult result)
Called if the task was canceled before it was completed.
|
protected void |
onReset()
Subclasses must implement this to take care of resetting their loader,
as per
Loader.reset() . |
protected void |
onStartLoading()
Subclasses must implement this to take care of loading their data,
as per
Loader.startLoading() . |
protected void |
onStopLoading()
Subclasses must implement this to take care of stopping their loader,
as per
Loader.stopLoading() . |
dump, isLoadInBackgroundCanceled, onCancelLoad, onForceLoad, onLoadInBackground, setUpdateThrottle, waitForLoader
abandon, cancelLoad, commitContentChanged, dataToString, deliverCancellation, forceLoad, getContext, getId, isAbandoned, isReset, isStarted, onAbandon, onContentChanged, registerListener, registerOnLoadCanceledListener, reset, rollbackContentChanged, startLoading, stopLoading, takeContentChanged, toString, unregisterListener, unregisterOnLoadCanceledListener
public RecentsLoader(Context context, RootsCache roots, State state)
public DirectoryResult loadInBackground()
AsyncTaskLoader
Loader.deliverResult(D)
on
the UI thread. If implementations need to process the results on the UI thread
they may override Loader.deliverResult(D)
and do so there.
To support cancellation, this method should periodically check the value of
AsyncTaskLoader.isLoadInBackgroundCanceled()
and terminate when it returns true.
Subclasses may also override AsyncTaskLoader.cancelLoadInBackground()
to interrupt the load
directly instead of polling AsyncTaskLoader.isLoadInBackgroundCanceled()
.
When the load is canceled, this method may either return normally or throw
OperationCanceledException
. In either case, the Loader
will
call AsyncTaskLoader.onCanceled(D)
to perform post-cancellation cleanup and to dispose of the
result object, if any.loadInBackground
in class AsyncTaskLoader<DirectoryResult>
AsyncTaskLoader.isLoadInBackgroundCanceled()
,
AsyncTaskLoader.cancelLoadInBackground()
,
AsyncTaskLoader.onCanceled(D)
public void cancelLoadInBackground()
AsyncTaskLoader
AsyncTaskLoader.loadInBackground()
that is running in the background on a worker thread.
This method should do nothing if AsyncTaskLoader.loadInBackground()
has not started
running or if it has already finished.cancelLoadInBackground
in class AsyncTaskLoader<DirectoryResult>
AsyncTaskLoader.loadInBackground()
public void deliverResult(DirectoryResult result)
Loader
deliverResult
in class Loader<DirectoryResult>
result
- the result of the loadprotected void onStartLoading()
Loader
Loader.startLoading()
. This is not called by clients directly,
but as a result of a call to Loader.startLoading()
.onStartLoading
in class Loader<DirectoryResult>
protected void onStopLoading()
Loader
Loader.stopLoading()
. This is not called by clients directly,
but as a result of a call to Loader.stopLoading()
.
This will always be called from the process's main thread.onStopLoading
in class Loader<DirectoryResult>
public void onCanceled(DirectoryResult result)
AsyncTaskLoader
onCanceled
in class AsyncTaskLoader<DirectoryResult>
result
- The value that was returned by AsyncTaskLoader.loadInBackground()
, or null
if the task threw OperationCanceledException
.protected void onReset()
Loader
Loader.reset()
. This is not called by clients directly,
but as a result of a call to Loader.reset()
.
This will always be called from the process's main thread.onReset
in class Loader<DirectoryResult>