Move processing MotionEvent out from PointerTracker
Bug: 4768084 Change-Id: Idfbc9706f9daeaa979edeee9064cb69326bd3bbc
This commit is contained in:
parent
d719fe1f5c
commit
3fdae97417
2 changed files with 19 additions and 34 deletions
|
@ -557,7 +557,7 @@ public class LatinKeyboardBaseView extends KeyboardView {
|
|||
mOldKeyIndex = tracker.getKeyIndexOn(lastX, lastY);
|
||||
tracker.onUpEvent(lastX, lastY, eventTime);
|
||||
} else if (pointerCount == 1 && oldPointerCount == 1) {
|
||||
tracker.onTouchEvent(action, x, y, eventTime);
|
||||
processMotionEvent(tracker, action, x, y, eventTime);
|
||||
} else {
|
||||
Log.w(TAG, "Unknown touch panel behavior: pointer count is " + pointerCount
|
||||
+ " (old " + oldPointerCount + ")");
|
||||
|
@ -571,25 +571,29 @@ public class LatinKeyboardBaseView extends KeyboardView {
|
|||
tracker.onMoveEvent((int)me.getX(i), (int)me.getY(i), eventTime);
|
||||
}
|
||||
} else {
|
||||
final PointerTracker tracker = getPointerTracker(id);
|
||||
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;
|
||||
}
|
||||
processMotionEvent(getPointerTracker(id), action, x, y, eventTime);
|
||||
}
|
||||
|
||||
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
|
||||
public void closing() {
|
||||
super.closing();
|
||||
|
|
|
@ -330,25 +330,6 @@ public class PointerTracker {
|
|||
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) {
|
||||
if (DEBUG_EVENT)
|
||||
printTouchEvent("onDownEvent:", x, y, eventTime);
|
||||
|
|
Loading…
Reference in a new issue