summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2015-04-20 09:58:06 +0200
committerJan Holesovsky <kendy@collabora.com>2015-04-24 10:25:02 +0200
commit02432d6ef24c4af957ab0d52307fef8ba6428306 (patch)
treeb074a5ccbba494a92019af93ffd5c18e693fea5c /android
parent0ffbbe0694fe7d817f4c120a79ce28d77fcbe958 (diff)
viewer: Enable taps to be able to handle hyperlinks.
Change-Id: I0b735d8db3204dc826c2b5fa9a568a5b425353e4
Diffstat (limited to 'android')
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java4
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java13
2 files changed, 10 insertions, 7 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
index a58e2ddd3252..a22c5fd6f437 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 cc21840b41ea..0da9681b93c1 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);
}
}