summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2021-04-23 13:31:52 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2021-04-23 15:01:31 +0200
commit3199182588fecac8a1c1fe202ca55702a3aab6ab (patch)
tree0feb4b0af4f3f3479ffb6c7a27741eaa4b1af78a /android
parent95b6907d8e49729b4c47cf637049cc91b45c838e (diff)
android: Offer 'Save As' in readonly mode
Provide the "Save As..." menu entry in Android Viewer also if read-only mode is used, either because the experimental editing mode is disabled or there is no write access to the document. This way, a copy of the original document can be saved elsewhere. In case experimental mode is enabled, editing is allowed after saving the document. Call 'ToolbarController#setEditMode' in 'ToolbarController#switchToEditMode' right away instead of posting it to the main handler in a Runnable along with the other commands (that change the UI), so the new state is already taken into account in 'LibreOfficeMainActivity#onResume' and the toolbar isn't switched back to view mode there right away. Change-Id: I321e42d0833463b31c7b39336d66b29bd51d9890 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114539 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'android')
-rw-r--r--android/source/res/menu/main.xml9
-rw-r--r--android/source/res/values-de/strings.xml2
-rw-r--r--android/source/res/values-tr/strings.xml2
-rw-r--r--android/source/res/values/strings.xml2
-rw-r--r--android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java2
-rw-r--r--android/source/src/java/org/libreoffice/ToolbarController.java5
6 files changed, 12 insertions, 10 deletions
diff --git a/android/source/res/menu/main.xml b/android/source/res/menu/main.xml
index 0570a77fdd7b..168817f68c5f 100644
--- a/android/source/res/menu/main.xml
+++ b/android/source/res/menu/main.xml
@@ -38,16 +38,17 @@
<item android:id="@+id/action_save"
android:title="@string/action_save"
android:orderInCategory="100" />
-
- <item android:id="@+id/action_save_as"
- android:title="@string/action_save_as"
- android:orderInCategory="100" />
</group>
<group android:id="@+id/group_misc_actions"
tools:visible="true"
android:visible="false">
+ <item android:id="@+id/action_save_as"
+ android:title="@string/action_save_as"
+ android:orderInCategory="100"
+ android:visible="true" />
+
<item android:id="@+id/action_exportToPDF"
android:title="@string/action_exportToPDF"
android:orderInCategory="100"
diff --git a/android/source/res/values-de/strings.xml b/android/source/res/values-de/strings.xml
index 36effc9303f0..5342cf73ad7e 100644
--- a/android/source/res/values-de/strings.xml
+++ b/android/source/res/values-de/strings.xml
@@ -9,7 +9,7 @@
<string name="app_description">LibreOffice Viewer ist ein Dokumentenbetrachter, der auf LibreOffice basiert.</string>
<string name="app_credits">https://www.libreoffice.org</string>
<string name="app_vendor">Dieses Release wurde bereitgestellt durch $VENDOR.</string>
- <string name="temp_file_saving_disabled">Diese Datei ist schreibgeschützt, Speichern ist deaktiviert.</string>
+ <string name="readonly_file">Diese Datei ist schreibgeschützt.</string>
<string name="about_license">Lizenz anzeigen</string>
<string name="about_notice">Hinweise anzeigen</string>
diff --git a/android/source/res/values-tr/strings.xml b/android/source/res/values-tr/strings.xml
index a780a59fe165..ec7274c8cca6 100644
--- a/android/source/res/values-tr/strings.xml
+++ b/android/source/res/values-tr/strings.xml
@@ -9,7 +9,7 @@
<string name="app_description">LibreOffice Görüntüleyici LibreOffice tabanlı bir belge görüntüleyicisidir.</string>
<string name="app_credits">https://www.libreoffice.org</string>
<string name="app_vendor">Bu sürüm $VENDOR tarafından derlenmiştir.</string>
- <string name="temp_file_saving_disabled">Bu dosya salt okunabilir haldedir. Kaydetme devredışı.</string>
+ <string name="readonly_file">Bu dosya salt okunabilir haldedir.</string>
<string name="about_license">Lisansı Görüntüle</string>
<string name="about_notice">Bildiriyi Görüntüle</string>
diff --git a/android/source/res/values/strings.xml b/android/source/res/values/strings.xml
index 6b3db68e23b6..49eea9f3014c 100644
--- a/android/source/res/values/strings.xml
+++ b/android/source/res/values/strings.xml
@@ -9,7 +9,7 @@
<string name="app_description">LibreOffice Viewer is a document viewer based on LibreOffice.</string>
<string name="app_credits">https://www.libreoffice.org</string>
<string name="app_vendor">This release was supplied by $VENDOR.</string>
- <string name="temp_file_saving_disabled">This file is read-only, saving is disabled.</string>
+ <string name="readonly_file">This file is read-only.</string>
<string name="about_license">Show License</string>
<string name="about_notice">Show Notice</string>
diff --git a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
index f7f5f6ae0ed6..28427b51435b 100644
--- a/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/source/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -339,7 +339,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
String displayName = FileUtilities.retrieveDisplayNameForDocumentUri(getContentResolver(), mDocumentUri);
toolbarTop.setTitle(displayName);
- // make sure that "Save" menu item is enabled
+ mbISReadOnlyMode = !isExperimentalMode();
getToolbarController().setupToolbars();
}
diff --git a/android/source/src/java/org/libreoffice/ToolbarController.java b/android/source/src/java/org/libreoffice/ToolbarController.java
index d4985aee180e..c97d84f0f329 100644
--- a/android/source/src/java/org/libreoffice/ToolbarController.java
+++ b/android/source/src/java/org/libreoffice/ToolbarController.java
@@ -72,6 +72,8 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
void switchToEditMode() {
if (!LOKitShell.isEditingEnabled())
return;
+
+ setEditModeOn(true);
// Ensure the change is done on UI thread
LOKitShell.getMainHandler().post(new Runnable() {
@Override
@@ -89,7 +91,6 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
}
mToolbarTop.setNavigationIcon(R.drawable.ic_check);
mToolbarTop.setLogo(null);
- setEditModeOn(true);
}
});
}
@@ -251,7 +252,7 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
if (LibreOfficeMainActivity.isReadOnlyMode()) {
// show message in case experimental mode is enabled (i.e. editing is supported in general),
// but current document is readonly
- Toast.makeText(mContext, mContext.getString(R.string.temp_file_saving_disabled), Toast.LENGTH_LONG).show();
+ Toast.makeText(mContext, mContext.getString(R.string.readonly_file), Toast.LENGTH_LONG).show();
}
}
mMainMenu.findItem(R.id.action_parts).setVisible(mContext.isDrawerEnabled());