diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-01-30 13:42:58 +0900 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-09 08:12:07 +0100 |
commit | a6ae67d897550a52c8b2b4f710a8ef4a88cf45f0 (patch) | |
tree | 644f6539f758a764fdca1d9d6540cc005df81caa | |
parent | e71b15ccc55b8e4bc4b105a664abfd5eb72da2de (diff) |
android: mute invalid. if not editing, don't show handle on touch
Change-Id: I551af3849f9b0a10106bf02fff220fa4600eb07f
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java | 37 | ||||
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java | 10 |
2 files changed, 27 insertions, 20 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java index 354404c34203..7e99da3caed8 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java @@ -4,6 +4,7 @@ import android.graphics.Bitmap; import android.graphics.PointF; import android.graphics.RectF; import android.util.Log; +import android.view.KeyEvent; import android.view.MotionEvent; import org.mozilla.gecko.gfx.CairoImage; @@ -159,25 +160,35 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation createThumbnail(event.mTask); break; case LOEvent.TOUCH: - if (!LOKitShell.isEditingEnabled()) { - return; - } touch(event.mTouchType, event.mMotionEvent, event.mDocumentTouchCoordinate); break; case LOEvent.KEY_EVENT: - if (!LOKitShell.isEditingEnabled()) { - return; - } - if (event.mKeyEventType == "KeyPress") { - mTileProvider.keyPress(event.mKeyEvent); - } else if (event.mKeyEventType.equals("KeyRelease")) { - mTileProvider.keyRelease(event.mKeyEvent); - } + keyEvent(event.mKeyEventType, event.mKeyEvent); break; } } + /** + * Processes key events. + */ + private void keyEvent(String keyEventType, KeyEvent keyEvent) { + if (!LOKitShell.isEditingEnabled()) { + return; + } + if (keyEventType == "KeyPress") { + mTileProvider.keyPress(keyEvent); + } else if (keyEventType.equals("KeyRelease")) { + mTileProvider.keyRelease(keyEvent); + } + } + + /** + * Processes touch events. + */ private void touch(String touchType, MotionEvent motionEvent, PointF mDocumentTouchCoordinate) { + if (!LOKitShell.isEditingEnabled()) { + return; + } LibreOfficeMainActivity.mAppContext.showSoftKeyboard(); mTileProvider.mouseButtonDown(mDocumentTouchCoordinate); } @@ -197,10 +208,6 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation @Override public void invalidate(RectF rect) { - if (!LOKitShell.isEditingEnabled()) { - return; - } - Log.i(LOGTAG, "Invalidate request: " + rect); mLayerClient = mApplication.getLayerClient(); diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index c5f31b37a03a..0bf9f1fad3fc 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -310,10 +310,6 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback int x = (int) pixelToTwip(inDocument.x, mDPI); int y = (int) pixelToTwip(inDocument.y, mDPI); - TextSelection textSelection = LibreOfficeMainActivity.mAppContext.getTextSelection(); - textSelection.positionHandle("MIDDLE", new RectF(inDocument.x, inDocument.y, inDocument.x, inDocument.y)); - textSelection.showHandle("MIDDLE"); - mDocument.postMouseEvent(type, x, y); } @@ -378,6 +374,10 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback */ @Override public void messageRetrieved(int signalNumber, String payload) { + if (!LOKitShell.isEditingEnabled()) { + return; + } + switch (signalNumber) { case Document.CALLBACK_INVALIDATE_TILES: { RectF rect = convertCallbackMessageStringToRectF(payload); @@ -391,7 +391,7 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback RectF rect = convertCallbackMessageStringToRectF(payload); if (rect != null) { TextSelection textSelection = LibreOfficeMainActivity.mAppContext.getTextSelection(); - textSelection.positionHandle("MIDDLE", rect); + textSelection.positionHandle("MIDDLE", new RectF(rect.right,rect.bottom, rect.right, rect.bottom)); textSelection.showHandle("MIDDLE"); } break; |