Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: save as issue (unsupported URI) #4257

Open
wants to merge 1 commit into
base: release/4.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading