use of com.owncloud.android.ui.asynctasks.CopyAndUploadContentUrisTask in project android by owncloud.
the class UriUploader method copyThenUpload.
/**
*
* @param sourceUris Array of content:// URIs to the files to upload
* @param remotePaths Array of absolute paths to set to the uploaded files
*/
private void copyThenUpload(Uri[] sourceUris, String[] remotePaths) {
if (mShowWaitingDialog) {
mActivity.showLoadingDialog(R.string.wait_for_tmp_copy_from_private_storage);
}
CopyAndUploadContentUrisTask copyTask = new CopyAndUploadContentUrisTask(mCopyTmpTaskListener, mActivity);
FragmentManager fm = mActivity.getSupportFragmentManager();
// Init Fragment without UI to retain AsyncTask across configuration changes
TaskRetainerFragment taskRetainerFragment = (TaskRetainerFragment) fm.findFragmentByTag(TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT);
if (taskRetainerFragment != null) {
taskRetainerFragment.setTask(copyTask);
}
copyTask.execute(CopyAndUploadContentUrisTask.makeParamsToExecute(mAccount, sourceUris, remotePaths, mBehaviour, mActivity.getContentResolver()));
}
use of com.owncloud.android.ui.asynctasks.CopyAndUploadContentUrisTask in project android by owncloud.
the class TaskRetainerFragment method setTask.
/**
* Sets the task to retain across configuration changes
*
* @param task Task to retain
*/
public void setTask(CopyAndUploadContentUrisTask task) {
if (mTask != null) {
mTask.setListener(null);
}
mTask = task;
Context context = getContext();
if (mTask != null && context != null) {
if (context instanceof ReceiveExternalFilesActivity) {
task.setListener((CopyAndUploadContentUrisTask.OnCopyTmpFilesTaskListener) context);
} else {
task.setListener(null);
}
}
}
Aggregations