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

Jan Holesovsky kendy at collabora.com
Fri Apr 24 01:26:27 PDT 2015


 android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java |    4 ++-
 android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java         |   13 +++++-----
 2 files changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 02432d6ef24c4af957ab0d52307fef8ba6428306
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Apr 20 09:58:06 2015 +0200

    viewer: Enable taps to be able to handle hyperlinks.
    
    Change-Id: I0b735d8db3204dc826c2b5fa9a568a5b425353e4

diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
index a58e2dd..a22c5fd 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
@@ -41,7 +41,9 @@ public class InvalidationHandler implements Document.MessageCallback {
     @Override
     public void messageRetrieved(int messageID, String payload) {
         if (!LOKitShell.isEditingEnabled()) {
-            return;
+            // enable handling of hyperlinks even in the Viewer
+            if (messageID != Document.CALLBACK_INVALIDATE_TILES && messageID != Document.CALLBACK_HYPERLINK_CLICKED)
+                return;
         }
         switch (messageID) {
             case Document.CALLBACK_INVALIDATE_TILES:
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
index cc21840..0da9681 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
@@ -293,13 +293,14 @@ public class LOKitThread extends Thread {
      * Processes touch events.
      */
     private void touch(String touchType, PointF documentCoordinate) {
-        if (!LOKitShell.isEditingEnabled()) {
-            return;
-        }
         if (mTileProvider == null) {
             return;
         }
-        if (touchType.equals("LongPress")) {
+
+        // to handle hyperlinks, enable single tap even in the Viewer
+        boolean editing = LOKitShell.isEditingEnabled();
+
+        if (touchType.equals("LongPress") && editing) {
             mInvalidationHandler.changeStateTo(InvalidationHandler.OverlayState.TRANSITION);
             mTileProvider.mouseButtonDown(documentCoordinate, 1);
             mTileProvider.mouseButtonUp(documentCoordinate, 1);
@@ -309,9 +310,9 @@ public class LOKitThread extends Thread {
             mInvalidationHandler.changeStateTo(InvalidationHandler.OverlayState.TRANSITION);
             mTileProvider.mouseButtonDown(documentCoordinate, 1);
             mTileProvider.mouseButtonUp(documentCoordinate, 1);
-        } else if (touchType.equals("GraphicSelectionStart")) {
+        } else if (touchType.equals("GraphicSelectionStart") && editing) {
             mTileProvider.setGraphicSelectionStart(documentCoordinate);
-        } else if (touchType.equals("GraphicSelectionEnd")) {
+        } else if (touchType.equals("GraphicSelectionEnd") && editing) {
             mTileProvider.setGraphicSelectionEnd(documentCoordinate);
         }
     }


More information about the Libreoffice-commits mailing list