Kaydet (Commit) 02432d6e authored tarafından Jan Holesovsky's avatar Jan Holesovsky

viewer: Enable taps to be able to handle hyperlinks.

Change-Id: I0b735d8db3204dc826c2b5fa9a568a5b425353e4
üst 0ffbbe06
...@@ -41,7 +41,9 @@ public class InvalidationHandler implements Document.MessageCallback { ...@@ -41,7 +41,9 @@ public class InvalidationHandler implements Document.MessageCallback {
@Override @Override
public void messageRetrieved(int messageID, String payload) { public void messageRetrieved(int messageID, String payload) {
if (!LOKitShell.isEditingEnabled()) { 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) { switch (messageID) {
case Document.CALLBACK_INVALIDATE_TILES: case Document.CALLBACK_INVALIDATE_TILES:
......
...@@ -293,13 +293,14 @@ public class LOKitThread extends Thread { ...@@ -293,13 +293,14 @@ public class LOKitThread extends Thread {
* Processes touch events. * Processes touch events.
*/ */
private void touch(String touchType, PointF documentCoordinate) { private void touch(String touchType, PointF documentCoordinate) {
if (!LOKitShell.isEditingEnabled()) {
return;
}
if (mTileProvider == null) { if (mTileProvider == null) {
return; 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); mInvalidationHandler.changeStateTo(InvalidationHandler.OverlayState.TRANSITION);
mTileProvider.mouseButtonDown(documentCoordinate, 1); mTileProvider.mouseButtonDown(documentCoordinate, 1);
mTileProvider.mouseButtonUp(documentCoordinate, 1); mTileProvider.mouseButtonUp(documentCoordinate, 1);
...@@ -309,9 +310,9 @@ public class LOKitThread extends Thread { ...@@ -309,9 +310,9 @@ public class LOKitThread extends Thread {
mInvalidationHandler.changeStateTo(InvalidationHandler.OverlayState.TRANSITION); mInvalidationHandler.changeStateTo(InvalidationHandler.OverlayState.TRANSITION);
mTileProvider.mouseButtonDown(documentCoordinate, 1); mTileProvider.mouseButtonDown(documentCoordinate, 1);
mTileProvider.mouseButtonUp(documentCoordinate, 1); mTileProvider.mouseButtonUp(documentCoordinate, 1);
} else if (touchType.equals("GraphicSelectionStart")) { } else if (touchType.equals("GraphicSelectionStart") && editing) {
mTileProvider.setGraphicSelectionStart(documentCoordinate); mTileProvider.setGraphicSelectionStart(documentCoordinate);
} else if (touchType.equals("GraphicSelectionEnd")) { } else if (touchType.equals("GraphicSelectionEnd") && editing) {
mTileProvider.setGraphicSelectionEnd(documentCoordinate); mTileProvider.setGraphicSelectionEnd(documentCoordinate);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment