Search in sources :

Example 1 with CloudLoaderAsyncTask

use of com.amaze.filemanager.asynchronous.asynctasks.CloudLoaderAsyncTask in project AmazeFileManager by TeamAmaze.

the class MainActivity method onLoadFinished.

@Override
public void onLoadFinished(Loader<Cursor> loader, final Cursor data) {
    if (data == null) {
        Toast.makeText(this, getResources().getString(R.string.cloud_error_failed_restart), Toast.LENGTH_LONG).show();
        return;
    }
    /*
     * This is hack for repeated calls to onLoadFinished(),
     * we take the Cursor provided to check if the function
     * has already been called on it.
     *
     * TODO: find a fix for repeated callbacks to onLoadFinished()
     */
    if (cloudCursorData != null && cloudCursorData == data)
        return;
    cloudCursorData = data;
    if (cloudLoaderAsyncTask != null && cloudLoaderAsyncTask.getStatus() == AsyncTask.Status.RUNNING) {
        return;
    }
    cloudLoaderAsyncTask = new CloudLoaderAsyncTask(this, cloudHandler, cloudCursorData);
    cloudLoaderAsyncTask.execute();
}
Also used : CloudLoaderAsyncTask(com.amaze.filemanager.asynchronous.asynctasks.CloudLoaderAsyncTask)

Aggregations

CloudLoaderAsyncTask (com.amaze.filemanager.asynchronous.asynctasks.CloudLoaderAsyncTask)1