diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-03-10 17:59:59 +0900 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-16 09:38:02 +0100 |
commit | c08069f2d764c86533c6ea1a17e7437efe6471ac (patch) | |
tree | 20e322d81ec967e62a6cc83d0b5ba4c03e38c67c /android | |
parent | 1771f21e2b24f111cacdd38b5d10328e230e3569 (diff) |
android: clicking on toolbar icon exits edit mode
Change-Id: Idc8c94629bd7a23be1e3a13e88debc478d6ab880
Diffstat (limited to 'android')
5 files changed, 23 insertions, 2 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java index 0f9b9970b675..4c3a2baef0a6 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java @@ -315,6 +315,10 @@ public class InvalidationHandler implements Document.MessageCallback { mTextCursorLayer.showGraphicSelection(); } + public OverlayState getCurrentState() { + return mState; + } + public enum OverlayState { NONE, TRANSITION, diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java index 18b821ec5902..c162c22ceaeb 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java @@ -23,6 +23,7 @@ public class LOEvent implements Comparable<LOEvent> { public static final int CHANGE_HANDLE_POSITION = 10; public static final int SWIPE_RIGHT = 11; public static final int SWIPE_LEFT = 12; + public static final int NAVIGATION_CLICK = 13; public final int mType; public int mPriority = 0; diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java index 84123a575aee..6c2e92177e83 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java @@ -142,4 +142,8 @@ public class LOKitShell { public static void sendChangeHandlePositionEvent(TextSelectionHandle.HandleType handleType, PointF documentCoordinate) { LOKitShell.sendEvent(new LOEvent(LOEvent.CHANGE_HANDLE_POSITION, handleType, documentCoordinate)); } + + public static void sendNavigationClickEvent() { + LOKitShell.sendEvent(new LOEvent(LOEvent.NAVIGATION_CLICK)); + } } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java index 3d36d935aa09..a5fe244aee09 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java @@ -213,6 +213,18 @@ public class LOKitThread extends Thread { case LOEvent.SWIPE_RIGHT: onSwipeRight(); break; + case LOEvent.NAVIGATION_CLICK: + if (mInvalidationHandler.getCurrentState() == InvalidationHandler.OverlayState.NONE) { + LOKitShell.getMainHandler().post(new Runnable() { + @Override + public void run() { + LibreOfficeMainActivity.mAppContext.onBackPressed(); + } + }); + } else { + mInvalidationHandler.changeStateTo(InvalidationHandler.OverlayState.NONE); + } + break; } } diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java index cd69c1d6b016..bf1a1b725d42 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java @@ -126,8 +126,8 @@ public class LibreOfficeMainActivity extends ActionBarActivity { toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override - public void onClick(View v) { - onBackPressed(); + public void onClick(View view) { + LOKitShell.sendNavigationClickEvent(); } }); |