From 923c7d55a99cc4d59f7ee8b74fe1126a22ff10da Mon Sep 17 00:00:00 2001 From: VishnuSanal Date: Sun, 22 Sep 2024 17:36:34 +0530 Subject: [PATCH] fix: save as issue (unsupported URI) --- .../filemanager/ui/activities/MainActivity.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/amaze/filemanager/ui/activities/MainActivity.java b/app/src/main/java/com/amaze/filemanager/ui/activities/MainActivity.java index fe7dec1436..426789b8d1 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/activities/MainActivity.java +++ b/app/src/main/java/com/amaze/filemanager/ui/activities/MainActivity.java @@ -643,16 +643,14 @@ private void checkForExternalIntent(Intent intent) { } else if (actionIntent.equals(Intent.ACTION_SEND)) { if ("text/plain".equals(type)) { - initFabToSave(null); + showSaveSnackbar(null); } else { // save a single file to filesystem Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM); - if (uri != null - && uri.getScheme() != null - && uri.getScheme().startsWith(ContentResolver.SCHEME_FILE)) { - ArrayList uris = new ArrayList<>(); + if (uri != null && uri.getScheme() != null) { + List uris = new ArrayList<>(); uris.add(uri); - initFabToSave(uris); + showSaveSnackbar(uris); } else { Toast.makeText(this, R.string.error_unsupported_or_null_uri, Toast.LENGTH_LONG).show(); } @@ -665,7 +663,7 @@ private void checkForExternalIntent(Intent intent) { // save multiple files to filesystem ArrayList arrayList = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM); - initFabToSave(arrayList); + showSaveSnackbar(arrayList); // disable screen rotation just for convenience purpose // TODO: Support screen rotation when saving a file @@ -674,7 +672,7 @@ private void checkForExternalIntent(Intent intent) { } /** Initializes the floating action button to act as to save data from an external intent */ - private void initFabToSave(final List uris) { + private void showSaveSnackbar(final List uris) { Utils.showThemedSnackbar( this, getString(R.string.select_save_location),