android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java | 18 +++++++--- android/lib/src/main/res/values/strings.xml | 1 2 files changed, 14 insertions(+), 5 deletions(-)
New commits: commit 95d683f6ab84132c11f41bf4873b50327b32ba05 Author: Jan Holesovsky <[email protected]> AuthorDate: Fri Jul 17 09:56:25 2020 +0200 Commit: Jan Holesovsky <[email protected]> CommitDate: Fri Jul 17 11:29:47 2020 +0200 android: One more location that fails to save on Chrome OS. Turns out that saving directly to "My files" is problematic in some cases too; suggest to use the "Play files" location. Change-Id: Ifb88fc048685596f85e7cf39a57c60864da12d83 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98955 Tested-by: Jenkins Reviewed-by: Jan Holesovsky <[email protected]> diff --git a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java index e904c6d74..221c83174 100644 --- a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java +++ b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java @@ -267,15 +267,23 @@ public class LOActivity extends AppCompatActivity { if (getIntent().getData() != null) { if (getIntent().getData().getScheme().equals(ContentResolver.SCHEME_CONTENT)) { - isDocEditable = (getIntent().getFlags() & Intent.FLAG_GRANT_WRITE_URI_PERMISSION) != 0; + isDocEditable = true; + + // is it read-only? + if ((getIntent().getFlags() & Intent.FLAG_GRANT_WRITE_URI_PERMISSION) == 0) { + isDocEditable = false; + Toast.makeText(this, getResources().getString(R.string.temp_file_saving_disabled), Toast.LENGTH_SHORT).show(); + } // turns out that on ChromeOS, it is not possible to save back // to Google Drive; detect it already here to avoid disappointment - if (getIntent().getData().toString().startsWith("content://org.chromium.arc.chromecontentprovider/externalfile")) + // also the volumeprovider does not work for saving back, + // which is much more serious :-( + if (isDocEditable && (getIntent().getData().toString().startsWith("content://org.chromium.arc.chromecontentprovider/externalfile") || + getIntent().getData().toString().startsWith("content://org.chromium.arc.volumeprovider/"))) { isDocEditable = false; - - if (!isDocEditable) - Toast.makeText(this, getResources().getString(R.string.temp_file_saving_disabled), Toast.LENGTH_SHORT).show(); + Toast.makeText(this, getResources().getString(R.string.file_chromeos_read_only), Toast.LENGTH_LONG).show(); + } if (copyFileToTemp() && mTempFile != null) { documentUri = mTempFile.toURI(); diff --git a/android/lib/src/main/res/values/strings.xml b/android/lib/src/main/res/values/strings.xml index dff5fb931..5fcb5e742 100644 --- a/android/lib/src/main/res/values/strings.xml +++ b/android/lib/src/main/res/values/strings.xml @@ -1,5 +1,6 @@ <resources> <string name="temp_file_saving_disabled">This file is read-only, saving is disabled.</string> + <string name="file_chromeos_read_only">This file cannot be saved in this location, opening it read-only. Move it to the "Play files" for full read/write access.</string> <string name="storage_permission_required">Storage permission is required</string> <string name="failed_to_load_file">Failed to determine the file to load</string> <string name="failed_to_insert_image">Failed to insert image</string> _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
