public class PhotoBitmapLoader extends AsyncTaskLoader<PhotoBitmapLoaderInterface.BitmapResult> implements PhotoBitmapLoaderInterface
Loader.ForceLoadContentObserver, Loader.OnLoadCanceledListener<D>, Loader.OnLoadCompleteListener<D>
PhotoBitmapLoaderInterface.BitmapResult
Constructor and Description |
---|
PhotoBitmapLoader(Context context,
String photoUri) |
Modifier and Type | Method and Description |
---|---|
void |
deliverResult(PhotoBitmapLoaderInterface.BitmapResult result)
Called when there is new data to deliver to the client.
|
PhotoBitmapLoaderInterface.BitmapResult |
loadInBackground()
Called on a worker thread to perform the actual load and to return
the result of the load operation.
|
void |
onCanceled(PhotoBitmapLoaderInterface.BitmapResult result)
Handles a request to cancel a load.
|
protected void |
onReleaseResources(Bitmap bitmap)
Helper function to take care of releasing resources associated
with an actively loaded data set.
|
protected void |
onReset()
Handles a request to completely reset the Loader.
|
protected void |
onStartLoading()
Handles a request to start the Loader.
|
protected void |
onStopLoading()
Handles a request to stop the Loader.
|
void |
setPhotoUri(String photoUri) |
cancelLoadInBackground, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forceLoad
public void setPhotoUri(String photoUri)
setPhotoUri
in interface PhotoBitmapLoaderInterface
public PhotoBitmapLoaderInterface.BitmapResult 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<PhotoBitmapLoaderInterface.BitmapResult>
AsyncTaskLoader.isLoadInBackgroundCanceled()
,
AsyncTaskLoader.cancelLoadInBackground()
,
AsyncTaskLoader.onCanceled(D)
public void deliverResult(PhotoBitmapLoaderInterface.BitmapResult result)
deliverResult
in class Loader<PhotoBitmapLoaderInterface.BitmapResult>
result
- the result of the loadprotected void onStartLoading()
onStartLoading
in class Loader<PhotoBitmapLoaderInterface.BitmapResult>
protected void onStopLoading()
onStopLoading
in class Loader<PhotoBitmapLoaderInterface.BitmapResult>
public void onCanceled(PhotoBitmapLoaderInterface.BitmapResult result)
onCanceled
in class AsyncTaskLoader<PhotoBitmapLoaderInterface.BitmapResult>
result
- The value that was returned by AsyncTaskLoader.loadInBackground()
, or null
if the task threw OperationCanceledException
.protected void onReset()
onReset
in class Loader<PhotoBitmapLoaderInterface.BitmapResult>
protected void onReleaseResources(Bitmap bitmap)