mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 05:35:39 +03:00
Fix. [BUG] Some storages do not work when uploading content from other apps Drive
This commit is contained in:
parent
e34d76a126
commit
7225b9f631
4 changed files with 29 additions and 7 deletions
|
@ -189,6 +189,16 @@ public class FileDisplayActivity extends HookActivity
|
|||
//getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
|
||||
// Init Fragment without UI to retain AsyncTask across configuration changes
|
||||
FragmentManager fm = getSupportFragmentManager();
|
||||
TaskRetainerFragment taskRetainerFragment =
|
||||
(TaskRetainerFragment) fm.findFragmentByTag(TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT);
|
||||
if (taskRetainerFragment == null) {
|
||||
taskRetainerFragment = new TaskRetainerFragment();
|
||||
fm.beginTransaction()
|
||||
.add(taskRetainerFragment, TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT).commit();
|
||||
} // else, Fragment already created and retained across configuration change
|
||||
|
||||
Log_OC.v(TAG, "onCreate() end");
|
||||
}
|
||||
|
||||
|
|
|
@ -145,6 +145,16 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
mSyncBroadcastReceiver = new SyncBroadcastReceiver();
|
||||
registerReceiver(mSyncBroadcastReceiver, syncIntentFilter);
|
||||
|
||||
// Init Fragment without UI to retain AsyncTask across configuration changes
|
||||
FragmentManager fm = getSupportFragmentManager();
|
||||
TaskRetainerFragment taskRetainerFragment =
|
||||
(TaskRetainerFragment) fm.findFragmentByTag(TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT);
|
||||
if (taskRetainerFragment == null) {
|
||||
taskRetainerFragment = new TaskRetainerFragment();
|
||||
fm.beginTransaction()
|
||||
.add(taskRetainerFragment, TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT).commit();
|
||||
} // else, Fragment already created and retained across configuration change
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -45,7 +45,11 @@ public class TaskRetainerFragment extends Fragment {
|
|||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
if (mTask != null) {
|
||||
mTask.setListener((CopyAndUploadContentUrisTask.OnCopyTmpFilesTaskListener) context);
|
||||
if (context instanceof ReceiveExternalFilesActivity) {
|
||||
mTask.setListener((CopyAndUploadContentUrisTask.OnCopyTmpFilesTaskListener) context);
|
||||
} else {
|
||||
mTask.setListener(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -189,12 +189,10 @@ public class UriUploader {
|
|||
// Init Fragment without UI to retain AsyncTask across configuration changes
|
||||
TaskRetainerFragment taskRetainerFragment =
|
||||
(TaskRetainerFragment) fm.findFragmentByTag(TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT);
|
||||
if (taskRetainerFragment == null) {
|
||||
taskRetainerFragment = new TaskRetainerFragment();
|
||||
fm.beginTransaction()
|
||||
.add(taskRetainerFragment, TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT).commit();
|
||||
} // else, Fragment was created before
|
||||
taskRetainerFragment.setTask(copyTask);
|
||||
|
||||
if (taskRetainerFragment != null) {
|
||||
taskRetainerFragment.setTask(copyTask);
|
||||
}
|
||||
|
||||
copyTask.execute(
|
||||
CopyAndUploadContentUrisTask.makeParamsToExecute(
|
||||
|
|
Loading…
Reference in a new issue