[Libreoffice-commits] core.git: android/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Jul 31 11:38:26 UTC 2018
android/source/res/menu/main.xml | 6 +--
android/source/src/java/org/libreoffice/LOKitTileProvider.java | 8 ++--
android/source/src/java/org/libreoffice/ToolbarController.java | 20 ++++++++++
3 files changed, 27 insertions(+), 7 deletions(-)
New commits:
commit cc61683a0e1dd67e838538a432b961322e5832be
Author: Mert Tumer <merttumer at outlook.com>
AuthorDate: Sun Jul 29 09:04:14 2018 -0700
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Tue Jul 31 13:38:03 2018 +0200
Setting visibility of menu items instead of disabling or enabling them
On Android Viewer
Signed-off-by: Mert Tumer <merttumer at outlook.com>
Change-Id: I1fc21f84f5063afe3b91bf26401f9fcacc66b6c8
Reviewed-on: https://gerrit.libreoffice.org/58285
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/android/source/res/menu/main.xml b/android/source/res/menu/main.xml
index 92b40c250aaa..764e6e7f97c8 100644
--- a/android/source/res/menu/main.xml
+++ b/android/source/res/menu/main.xml
@@ -43,12 +43,12 @@
<item android:id="@+id/action_add_slide"
android:title="@string/action_add_slide"
android:orderInCategory="100"
- android:enabled="false" />
+ android:visible="false" />
<item android:id="@+id/action_add_worksheet"
android:title="@string/action_add_worksheet"
android:orderInCategory="100"
- android:enabled="false" />
+ android:visible="false" />
</group>
<group android:id="@+id/group_edit_clipboard"
@@ -90,7 +90,7 @@
<item android:id="@+id/action_presentation"
android:title="@string/action_presentation"
android:orderInCategory="100"
- android:enabled="false" />
+ android:visible="false" />
<item android:id="@+id/action_parts"
android:title="@string/action_parts"
diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
index f094e49f5a8f..e5c32dee64ed 100644
--- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java
@@ -123,11 +123,11 @@ class LOKitTileProvider implements TileProvider {
mContext.getDocumentPartView().clear();
if (mDocument.getDocumentType() == Document.DOCTYPE_PRESENTATION) {
- mContext.getToolbarController().disableMenuItem(R.id.action_presentation, false);
- mContext.getToolbarController().disableMenuItem(R.id.action_add_slide, false);
+ mContext.getToolbarController().showItem(R.id.action_presentation);
+ mContext.getToolbarController().showItem(R.id.action_add_slide);
}
if (mDocument.getDocumentType() == Document.DOCTYPE_SPREADSHEET) {
- mContext.getToolbarController().disableMenuItem(R.id.action_add_worksheet, false);
+ mContext.getToolbarController().showItem(R.id.action_add_worksheet);
}
// Writer documents always have one part, so hide the navigation drawer.
@@ -146,7 +146,7 @@ class LOKitTileProvider implements TileProvider {
}
} else {
mContext.disableNavigationDrawer();
- mContext.getToolbarController().disableMenuItem(R.id.action_parts, true);
+ mContext.getToolbarController().hideItem(R.id.action_parts);
}
// Enable headers for Calc documents
diff --git a/android/source/src/java/org/libreoffice/ToolbarController.java b/android/source/src/java/org/libreoffice/ToolbarController.java
index 146be9fdfd7c..204664d80004 100644
--- a/android/source/src/java/org/libreoffice/ToolbarController.java
+++ b/android/source/src/java/org/libreoffice/ToolbarController.java
@@ -227,6 +227,26 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
mMainMenu.findItem(R.id.action_parts).setVisible(mContext.isDrawerEnabled());
}
+ public void showItem(final int item){
+ LOKitShell.getMainHandler().post(new Runnable() {
+ @Override
+ public void run() {
+ mMainMenu.findItem(item).setVisible(true);
+
+ }
+ });
+ }
+
+ public void hideItem(final int item){
+ LOKitShell.getMainHandler().post(new Runnable() {
+ @Override
+ public void run() {
+ mMainMenu.findItem(item).setVisible(false);
+
+ }
+ });
+ }
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list