diff options
author | Mert Tumer <merttumer@outlook.com> | 2018-08-18 06:22:57 -0700 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-08-21 00:09:55 +0200 |
commit | 1c08deed080e46478d6aac198e0b2f8f1ff54fe5 (patch) | |
tree | c5cf845a5ee75e46e1b2f6465e01258560f63c8c /android/source | |
parent | b262e4e691d71defa5aa45e6bd647f112e1513c4 (diff) |
Fix listing all options (presentation and spreadsheet) on all documents
Change-Id: I2f43818dbf490de10a54da7f36c6bae3d4d62e39
Signed-off-by: Mert Tumer <merttumer@outlook.com>
Reviewed-on: https://gerrit.libreoffice.org/59289
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'android/source')
-rw-r--r-- | android/source/res/menu/main.xml | 18 | ||||
-rw-r--r-- | android/source/src/java/org/libreoffice/LOKitTileProvider.java | 11 | ||||
-rw-r--r-- | android/source/src/java/org/libreoffice/ToolbarController.java | 10 |
3 files changed, 24 insertions, 15 deletions
diff --git a/android/source/res/menu/main.xml b/android/source/res/menu/main.xml index d5f1ae8e4274..b442878cbf51 100644 --- a/android/source/res/menu/main.xml +++ b/android/source/res/menu/main.xml @@ -50,11 +50,11 @@ <item android:id="@+id/action_UNO_commands" android:title="@string/action_UNO_commands" android:orderInCategory="100" /> + </group> - <item android:id="@+id/action_add_slide" - android:title="@string/action_add_slide" - android:orderInCategory="100" - android:visible="false" /> + <group android:id="@+id/group_spreadsheet_options" + android:visible="false" + tools:visible="true"> <item android:id="@+id/action_add_worksheet" android:title="@string/action_add_worksheet" @@ -69,6 +69,16 @@ android:title="@string/action_delete_worksheet" android:orderInCategory="100" android:visible="false"/> + </group> + + <group android:id="@+id/group_presentation_options" + android:visible="false" + tools:visible="true"> + + <item android:id="@+id/action_add_slide" + android:title="@string/action_add_slide" + android:orderInCategory="100" + android:visible="false" /> <item android:id="@+id/action_delete_slide" android:title="@string/action_delete_slide" diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java b/android/source/src/java/org/libreoffice/LOKitTileProvider.java index 7464f152698d..36075b05e025 100644 --- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java @@ -146,17 +146,6 @@ class LOKitTileProvider implements TileProvider { Log.i(LOGTAG, "Document parts: " + parts); mContext.getDocumentPartView().clear(); - if (mDocument.getDocumentType() == Document.DOCTYPE_PRESENTATION) { - mContext.getToolbarController().showItem(R.id.action_presentation); - mContext.getToolbarController().showItem(R.id.action_add_slide); - mContext.getToolbarController().showItem(R.id.action_delete_slide); - } - if (mDocument.getDocumentType() == Document.DOCTYPE_SPREADSHEET) { - mContext.getToolbarController().showItem(R.id.action_add_worksheet); - mContext.getToolbarController().showItem(R.id.action_rename_worksheet); - mContext.getToolbarController().showItem(R.id.action_delete_worksheet); - } - // Writer documents always have one part, so hide the navigation drawer. if (mDocument.getDocumentType() != Document.DOCTYPE_TEXT) { for (int i = 0; i < parts; i++) { diff --git a/android/source/src/java/org/libreoffice/ToolbarController.java b/android/source/src/java/org/libreoffice/ToolbarController.java index 29d5433df057..9c7566e10f2d 100644 --- a/android/source/src/java/org/libreoffice/ToolbarController.java +++ b/android/source/src/java/org/libreoffice/ToolbarController.java @@ -82,6 +82,11 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener { } else { mMainMenu.findItem(R.id.action_UNO_commands).setVisible(true); } + if(mContext.getTileProvider() != null && mContext.getTileProvider().isSpreadsheet()){ + mMainMenu.setGroupVisible(R.id.group_spreadsheet_options, true); + } else if(mContext.getTileProvider() != null && mContext.getTileProvider().isPresentation()){ + mMainMenu.setGroupVisible(R.id.group_presentation_options, true); + } mToolbarTop.setNavigationIcon(R.drawable.ic_check); mToolbarTop.setLogo(null); setEditModeOn(true); @@ -145,6 +150,11 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener { setEditModeOn(false); mContext.hideBottomToolbar(); mContext.hideSoftKeyboard(); + if(mContext.getTileProvider() != null && mContext.getTileProvider().isSpreadsheet()){ + mMainMenu.setGroupVisible(R.id.group_spreadsheet_options, false); + } else if(mContext.getTileProvider() != null && mContext.getTileProvider().isPresentation()){ + mMainMenu.setGroupVisible(R.id.group_presentation_options, false); + } } }); } |