mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 15:15:51 +03:00
Merge pull request #12406 from nextcloud/fix/externalfiles-intent
Fix ReceiveExternalFilesActivity intent
This commit is contained in:
commit
4e2a472364
1 changed files with 7 additions and 7 deletions
|
@ -174,8 +174,6 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
prepareStreamsToUpload();
|
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
String parentPath = savedInstanceState.getString(KEY_PARENTS);
|
String parentPath = savedInstanceState.getString(KEY_PARENTS);
|
||||||
|
|
||||||
|
@ -191,6 +189,8 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
||||||
binding = ReceiveExternalFilesBinding.inflate(getLayoutInflater());
|
binding = ReceiveExternalFilesBinding.inflate(getLayoutInflater());
|
||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
|
|
||||||
|
prepareStreamsToUpload();
|
||||||
|
|
||||||
// Listen for sync messages
|
// Listen for sync messages
|
||||||
IntentFilter syncIntentFilter = new IntentFilter(RefreshFolderOperation.
|
IntentFilter syncIntentFilter = new IntentFilter(RefreshFolderOperation.
|
||||||
EVENT_SINGLE_FOLDER_CONTENTS_SYNCED);
|
EVENT_SINGLE_FOLDER_CONTENTS_SYNCED);
|
||||||
|
@ -850,16 +850,16 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
||||||
private void prepareStreamsToUpload() {
|
private void prepareStreamsToUpload() {
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
|
|
||||||
if (Intent.ACTION_SEND.equals(intent.getAction())) {
|
if (intent.hasExtra(Intent.EXTRA_STREAM) && Intent.ACTION_SEND.equals(intent.getAction())) {
|
||||||
mStreamsToUpload = new ArrayList<>();
|
mStreamsToUpload = new ArrayList<>();
|
||||||
mStreamsToUpload.add(IntentExtensionsKt.getParcelableArgument(intent, Intent.EXTRA_STREAM, Parcelable.class));
|
mStreamsToUpload.add(IntentExtensionsKt.getParcelableArgument(intent, Intent.EXTRA_STREAM, Parcelable.class));
|
||||||
} else if (Intent.ACTION_SEND_MULTIPLE.equals(intent.getAction())) {
|
} else if (intent.hasExtra(Intent.EXTRA_STREAM) && Intent.ACTION_SEND_MULTIPLE.equals(intent.getAction())) {
|
||||||
mStreamsToUpload = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
|
mStreamsToUpload = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
|
||||||
}
|
} else if (intent.hasExtra(Intent.EXTRA_TEXT) && Intent.ACTION_SEND.equals(intent.getAction())) {
|
||||||
|
|
||||||
if (mStreamsToUpload == null || mStreamsToUpload.isEmpty() || mStreamsToUpload.get(0) == null) {
|
|
||||||
mStreamsToUpload = null;
|
mStreamsToUpload = null;
|
||||||
saveTextsFromIntent(intent);
|
saveTextsFromIntent(intent);
|
||||||
|
} else {
|
||||||
|
showErrorDialog(R.string.uploader_error_message_no_file_to_upload, R.string.uploader_error_title_file_cannot_be_uploaded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue