[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2' - android/lib
Jan Holesovsky (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jul 17 14:04:45 UTC 2020
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 04f8a66c5d2f1e1870bc382f45e6eebbcda3949f
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Jul 17 09:56:25 2020 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Jul 17 16:04:26 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/+/98954
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
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>
More information about the Libreoffice-commits
mailing list