From 3fdae97417b8ca33ae199c7817de7a80a3aeddae Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 8 Jul 2011 19:36:52 -0700 Subject: [PATCH] Move processing MotionEvent out from PointerTracker Bug: 4768084 Change-Id: Idfbc9706f9daeaa979edeee9064cb69326bd3bbc --- .../keyboard/LatinKeyboardBaseView.java | 34 +++++++++++-------- .../inputmethod/keyboard/PointerTracker.java | 19 ----------- 2 files changed, 19 insertions(+), 34 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardBaseView.java index 06cd319de..33aa6c29c 100644 --- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardBaseView.java @@ -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(); diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java index c960c7613..154d37874 100644 --- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java +++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java @@ -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);