[Libreoffice-commits] core.git: android/source

Ximeng Zu uznomis at yahoo.com
Tue Apr 18 12:28:02 UTC 2017


 android/source/src/java/org/libreoffice/InvalidationHandler.java |    6 ++--
 android/source/src/java/org/libreoffice/ToolbarController.java   |   15 +++++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

New commits:
commit 1a748066b49ceaa8cdd3477556756336d6dfb8b3
Author: Ximeng Zu <uznomis at yahoo.com>
Date:   Thu Apr 13 18:22:36 2017 -0500

    tdf#96799 android: does not switch edit mode to view
    
    Added a checking of whether edit mode is on or off
    before making a switch between edit and view modes.
    
    Change-Id: I69043bc8694b605a517e16385abfa91d86d34d30
    Reviewed-on: https://gerrit.libreoffice.org/36541
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/android/source/src/java/org/libreoffice/InvalidationHandler.java b/android/source/src/java/org/libreoffice/InvalidationHandler.java
index af42cb131ff7..5edc6c7dcb19 100644
--- a/android/source/src/java/org/libreoffice/InvalidationHandler.java
+++ b/android/source/src/java/org/libreoffice/InvalidationHandler.java
@@ -455,9 +455,11 @@ public class InvalidationHandler implements Document.MessageCallback {
      * Handle a general transition - executed for all transitions.
      */
     private void handleGeneralChangeState(OverlayState previous, OverlayState next) {
-        if (previous == OverlayState.NONE) {
+        if (previous == OverlayState.NONE &&
+                !mContext.getToolbarController().getEditModeStatus()) {
             mContext.getToolbarController().switchToEditMode();
-        } else if (next == OverlayState.NONE) {
+        } else if (next == OverlayState.NONE &&
+                mContext.getToolbarController().getEditModeStatus()) {
             mContext.getToolbarController().switchToViewMode();
         }
     }
diff --git a/android/source/src/java/org/libreoffice/ToolbarController.java b/android/source/src/java/org/libreoffice/ToolbarController.java
index 0012fdbeae06..0191c924446c 100644
--- a/android/source/src/java/org/libreoffice/ToolbarController.java
+++ b/android/source/src/java/org/libreoffice/ToolbarController.java
@@ -24,6 +24,8 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
     private final LibreOfficeMainActivity mContext;
     private final Menu mMainMenu;
 
+    private boolean isEditModeOn = false;
+
     public ToolbarController(LibreOfficeMainActivity context, Toolbar toolbarTop) {
         mToolbarTop = toolbarTop;
         mContext = context;
@@ -48,6 +50,14 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
         });
     }
 
+    public void setEditModeOn(boolean enabled) {
+        isEditModeOn = enabled;
+    }
+
+    public boolean getEditModeStatus() {
+        return isEditModeOn;
+    }
+
     /**
      * Change the toolbar to edit mode.
      */
@@ -62,7 +72,7 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
                 mMainMenu.setGroupVisible(R.id.group_edit_actions, true);
                 mToolbarTop.setNavigationIcon(R.drawable.ic_check);
                 mToolbarTop.setLogo(null);
-
+                setEditModeOn(true);
             }
         });
     }
@@ -81,6 +91,9 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
                 mMainMenu.setGroupVisible(R.id.group_edit_actions, false);
                 mToolbarTop.setNavigationIcon(R.drawable.lo_icon);
                 mToolbarTop.setLogo(null);
+                setEditModeOn(false);
+                mContext.hideBottomToolbar();
+                mContext.hideSoftKeyboard();
             }
         });
     }


More information about the Libreoffice-commits mailing list