Skip to content

Commit

Permalink
fix: save as issue (unsupported URI)
Browse files Browse the repository at this point in the history
  • Loading branch information
VishnuSanal committed Sep 22, 2024
1 parent 4612942 commit 923c7d5
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 923c7d5

Please sign in to comment.