Kaydet (Commit) cb08fbbd authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Miklos Vajna

android: no need for MotionEvent when sending TOUCH LOEvent

Change-Id: I9173f50fb60680de1bb9744d3f351c44f8175d0c
üst 5fef3a0c
...@@ -29,7 +29,6 @@ public class LOEvent implements Comparable<LOEvent> { ...@@ -29,7 +29,6 @@ public class LOEvent implements Comparable<LOEvent> {
public String mFilename; public String mFilename;
public ComposedTileLayer mComposedTileLayer; public ComposedTileLayer mComposedTileLayer;
public String mTouchType; public String mTouchType;
public MotionEvent mMotionEvent;
public PointF mDocumentTouchCoordinate; public PointF mDocumentTouchCoordinate;
public KeyEvent mKeyEvent; public KeyEvent mKeyEvent;
public RectF mInvalidationRect; public RectF mInvalidationRect;
...@@ -62,11 +61,10 @@ public class LOEvent implements Comparable<LOEvent> { ...@@ -62,11 +61,10 @@ public class LOEvent implements Comparable<LOEvent> {
mTypeString = "Thumbnail"; mTypeString = "Thumbnail";
} }
public LOEvent(int type, String touchType, MotionEvent motionEvent, PointF documentTouchCoordinate) { public LOEvent(int type, String touchType, PointF documentTouchCoordinate) {
mType = type; mType = type;
mTypeString = "Touch"; mTypeString = "Touch";
mTouchType = touchType; mTouchType = touchType;
mMotionEvent = motionEvent;
mDocumentTouchCoordinate = documentTouchCoordinate; mDocumentTouchCoordinate = documentTouchCoordinate;
} }
......
...@@ -86,8 +86,8 @@ public class LOKitShell { ...@@ -86,8 +86,8 @@ public class LOKitShell {
/** /**
* Send touch event to LOKitThread. * Send touch event to LOKitThread.
*/ */
public static void sendTouchEvent(String touchType, MotionEvent motionEvent, PointF pointF) { public static void sendTouchEvent(String touchType, PointF documentTouchCoordinate) {
LOKitShell.sendEvent(new LOEvent(LOEvent.TOUCH, touchType, motionEvent, pointF)); LOKitShell.sendEvent(new LOEvent(LOEvent.TOUCH, touchType, documentTouchCoordinate));
} }
/** /**
......
...@@ -196,7 +196,7 @@ public class LOKitThread extends Thread { ...@@ -196,7 +196,7 @@ public class LOKitThread extends Thread {
createThumbnail(event.mTask); createThumbnail(event.mTask);
break; break;
case LOEvent.TOUCH: case LOEvent.TOUCH:
touch(event.mTouchType, event.mMotionEvent, event.mDocumentTouchCoordinate); touch(event.mTouchType, event.mDocumentTouchCoordinate);
break; break;
case LOEvent.KEY_EVENT: case LOEvent.KEY_EVENT:
keyEvent(event.mKeyEvent); keyEvent(event.mKeyEvent);
...@@ -223,7 +223,7 @@ public class LOKitThread extends Thread { ...@@ -223,7 +223,7 @@ public class LOKitThread extends Thread {
/** /**
* Processes touch events. * Processes touch events.
*/ */
private void touch(String touchType, MotionEvent motionEvent, PointF mDocumentTouchCoordinate) { private void touch(String touchType, PointF mDocumentTouchCoordinate) {
if (!LOKitShell.isEditingEnabled()) { if (!LOKitShell.isEditingEnabled()) {
return; return;
} }
......
...@@ -941,7 +941,7 @@ public class JavaPanZoomController ...@@ -941,7 +941,7 @@ public class JavaPanZoomController
@Override @Override
public void onLongPress(MotionEvent motionEvent) { public void onLongPress(MotionEvent motionEvent) {
LOKitShell.sendTouchEvent("LongPress", motionEvent, getMotionInDocumentCoordinates(motionEvent)); LOKitShell.sendTouchEvent("LongPress", getMotionInDocumentCoordinates(motionEvent));
} }
@Override @Override
...@@ -949,7 +949,7 @@ public class JavaPanZoomController ...@@ -949,7 +949,7 @@ public class JavaPanZoomController
// When double-tapping is allowed, we have to wait to see if this is // When double-tapping is allowed, we have to wait to see if this is
// going to be a double-tap. // going to be a double-tap.
if (!mWaitForDoubleTap) { if (!mWaitForDoubleTap) {
LOKitShell.sendTouchEvent("SingleTap", motionEvent, getMotionInDocumentCoordinates(motionEvent)); LOKitShell.sendTouchEvent("SingleTap", getMotionInDocumentCoordinates(motionEvent));
} }
// return false because we still want to get the ACTION_UP event that triggers this // return false because we still want to get the ACTION_UP event that triggers this
return false; return false;
...@@ -959,14 +959,14 @@ public class JavaPanZoomController ...@@ -959,14 +959,14 @@ public class JavaPanZoomController
public boolean onSingleTapConfirmed(MotionEvent motionEvent) { public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
// In cases where we don't wait for double-tap, we handle this in onSingleTapUp. // In cases where we don't wait for double-tap, we handle this in onSingleTapUp.
if (mWaitForDoubleTap) { if (mWaitForDoubleTap) {
LOKitShell.sendTouchEvent("SingleTap", motionEvent, getMotionInDocumentCoordinates(motionEvent)); LOKitShell.sendTouchEvent("SingleTap", getMotionInDocumentCoordinates(motionEvent));
} }
return true; return true;
} }
@Override @Override
public boolean onDoubleTap(MotionEvent motionEvent) { public boolean onDoubleTap(MotionEvent motionEvent) {
LOKitShell.sendTouchEvent("DoubleTap", motionEvent, getMotionInDocumentCoordinates(motionEvent)); LOKitShell.sendTouchEvent("DoubleTap", getMotionInDocumentCoordinates(motionEvent));
return true; return true;
} }
......
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