[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - android/experimental
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Thu Jan 29 20:49:01 PST 2015
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java | 37 +++++-----
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java | 10 +-
2 files changed, 27 insertions(+), 20 deletions(-)
New commits:
commit 14fe82c911554d4e4feb1145e8b0b71c6140da2c
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Fri Jan 30 13:42:58 2015 +0900
android: mute invalid. if not editing, don't show handle on touch
Change-Id: I551af3849f9b0a10106bf02fff220fa4600eb07f
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
index 354404c..7e99da3 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 c5f31b3..0bf9f1f 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;
More information about the Libreoffice-commits
mailing list