Merge "Move processing MotionEvent out from PointerTracker"
This commit is contained in:
commit
952266674a
2 changed files with 19 additions and 34 deletions
|
@ -557,7 +557,7 @@ public class LatinKeyboardBaseView extends KeyboardView {
|
||||||
mOldKeyIndex = tracker.getKeyIndexOn(lastX, lastY);
|
mOldKeyIndex = tracker.getKeyIndexOn(lastX, lastY);
|
||||||
tracker.onUpEvent(lastX, lastY, eventTime);
|
tracker.onUpEvent(lastX, lastY, eventTime);
|
||||||
} else if (pointerCount == 1 && oldPointerCount == 1) {
|
} else if (pointerCount == 1 && oldPointerCount == 1) {
|
||||||
tracker.onTouchEvent(action, x, y, eventTime);
|
processMotionEvent(tracker, action, x, y, eventTime);
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "Unknown touch panel behavior: pointer count is " + pointerCount
|
Log.w(TAG, "Unknown touch panel behavior: pointer count is " + pointerCount
|
||||||
+ " (old " + oldPointerCount + ")");
|
+ " (old " + oldPointerCount + ")");
|
||||||
|
@ -571,25 +571,29 @@ public class LatinKeyboardBaseView extends KeyboardView {
|
||||||
tracker.onMoveEvent((int)me.getX(i), (int)me.getY(i), eventTime);
|
tracker.onMoveEvent((int)me.getX(i), (int)me.getY(i), eventTime);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final PointerTracker tracker = getPointerTracker(id);
|
processMotionEvent(getPointerTracker(id), action, x, y, eventTime);
|
||||||
switch (action) {
|
|
||||||
case MotionEvent.ACTION_DOWN:
|
|
||||||
case MotionEvent.ACTION_POINTER_DOWN:
|
|
||||||
tracker.onDownEvent(x, y, eventTime);
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_UP:
|
|
||||||
case MotionEvent.ACTION_POINTER_UP:
|
|
||||||
tracker.onUpEvent(x, y, eventTime);
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_CANCEL:
|
|
||||||
tracker.onCancelEvent(x, y, eventTime);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void processMotionEvent(PointerTracker tracker, int action, int x, int y,
|
||||||
|
long eventTime) {
|
||||||
|
switch (action) {
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
case MotionEvent.ACTION_POINTER_DOWN:
|
||||||
|
tracker.onDownEvent(x, y, eventTime);
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_UP:
|
||||||
|
case MotionEvent.ACTION_POINTER_UP:
|
||||||
|
tracker.onUpEvent(x, y, eventTime);
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_CANCEL:
|
||||||
|
tracker.onCancelEvent(x, y, eventTime);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closing() {
|
public void closing() {
|
||||||
super.closing();
|
super.closing();
|
||||||
|
|
|
@ -330,25 +330,6 @@ public class PointerTracker {
|
||||||
return onMoveKeyInternal(x, y);
|
return onMoveKeyInternal(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTouchEvent(int action, int x, int y, long eventTime) {
|
|
||||||
switch (action) {
|
|
||||||
case MotionEvent.ACTION_MOVE:
|
|
||||||
onMoveEvent(x, y, eventTime);
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_DOWN:
|
|
||||||
case MotionEvent.ACTION_POINTER_DOWN:
|
|
||||||
onDownEvent(x, y, eventTime);
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_UP:
|
|
||||||
case MotionEvent.ACTION_POINTER_UP:
|
|
||||||
onUpEvent(x, y, eventTime);
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_CANCEL:
|
|
||||||
onCancelEvent(x, y, eventTime);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onDownEvent(int x, int y, long eventTime) {
|
public void onDownEvent(int x, int y, long eventTime) {
|
||||||
if (DEBUG_EVENT)
|
if (DEBUG_EVENT)
|
||||||
printTouchEvent("onDownEvent:", x, y, eventTime);
|
printTouchEvent("onDownEvent:", x, y, eventTime);
|
||||||
|
|
Loading…
Reference in a new issue