From c6cb2ec1f3264a7b626022bcfdc8da180b87920c Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 2 Sep 2010 01:07:11 +0900 Subject: [PATCH] Add new public attribute mPointerId to PointerTracker It is easier to track each pointer if a PointerTracker object keeps its pointer id. Bug: 2910379 Change-Id: If3e3b0cf3d834d22302598f4d85d54c9a4ce92ba --- .../com/android/inputmethod/latin/LatinKeyboardBaseView.java | 3 +-- java/src/com/android/inputmethod/latin/PointerTracker.java | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 9ebab256d..4daf6515f 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -774,7 +774,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener, if (DEBUG) { if (mShowTouchPoints) { for (PointerTracker tracker : mPointerTrackers) { - if (tracker == null) continue; int startX = tracker.getStartX(); int startY = tracker.getStartY(); int lastX = tracker.getLastX(); @@ -1047,7 +1046,7 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener, // Create pointer trackers until we can get 'id+1'-th tracker, if needed. for (int i = pointers.size(); i <= id; i++) { final PointerTracker tracker = - new PointerTracker(mHandler, mKeyDetector, this); + new PointerTracker(i, mHandler, mKeyDetector, this); if (keys != null) tracker.setKeyboard(keys, mDebounceHysteresis); if (listener != null) diff --git a/java/src/com/android/inputmethod/latin/PointerTracker.java b/java/src/com/android/inputmethod/latin/PointerTracker.java index 8c85e97f9..504c85784 100644 --- a/java/src/com/android/inputmethod/latin/PointerTracker.java +++ b/java/src/com/android/inputmethod/latin/PointerTracker.java @@ -32,6 +32,8 @@ public class PointerTracker { public boolean isMiniKeyboardOnScreen(); } + public final int mPointerId; + // Timing constants private static final int REPEAT_START_DELAY = 400; /* package */ static final int REPEAT_INTERVAL = 50; // ~20 keys per second @@ -77,9 +79,10 @@ public class PointerTracker { // pressed key private int mPreviousKey = NOT_A_KEY; - public PointerTracker(UIHandler handler, KeyDetector keyDetector, UIProxy proxy) { + public PointerTracker(int id, UIHandler handler, KeyDetector keyDetector, UIProxy proxy) { if (proxy == null || handler == null || keyDetector == null) throw new NullPointerException(); + mPointerId = id; mProxy = proxy; mHandler = handler; mKeyDetector = keyDetector;