Skip to content

Commit

Permalink
Merge pull request #4257 from TeamAmaze/fix/save-as-issue
Browse files Browse the repository at this point in the history
fix: save as issue (unsupported URI)
  • Loading branch information
VishalNehra authored Oct 8, 2024
2 parents 0ee6b54 + 923c7d5 commit 8fdda5d
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Uri> uris = new ArrayList<>();
if (uri != null && uri.getScheme() != null) {
List<Uri> 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();
}
Expand All @@ -665,7 +663,7 @@ private void checkForExternalIntent(Intent intent) {
// save multiple files to filesystem

ArrayList<Uri> 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
Expand All @@ -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<Uri> uris) {
private void showSaveSnackbar(final List<Uri> uris) {
Utils.showThemedSnackbar(
this,
getString(R.string.select_save_location),
Expand Down

0 comments on commit 8fdda5d

Please sign in to comment.