diff options
author | 2010-09-14 09:43:48 -0700 | |
---|---|---|
committer | 2010-09-14 09:43:48 -0700 | |
commit | b2835ef2e506b7d1b3db1c810b7dae349d2461d2 (patch) | |
tree | d2b2a8a3656fc12c816a5efb966576aea3983477 /java/src/com/android/inputmethod/latin/PointerTracker.java | |
parent | 2c42492224a2c4d9533fe9a8f4b994bc3f3a90e0 (diff) | |
parent | eb68036798f53763768e4ab37c7bfab9a2f36025 (diff) | |
download | latinime-b2835ef2e506b7d1b3db1c810b7dae349d2461d2.tar.gz latinime-b2835ef2e506b7d1b3db1c810b7dae349d2461d2.tar.xz latinime-b2835ef2e506b7d1b3db1c810b7dae349d2461d2.zip |
am eb680367: Add keyHysteresisDistance xml attribute
Merge commit 'eb68036798f53763768e4ab37c7bfab9a2f36025' into gingerbread-plus-aosp
* commit 'eb68036798f53763768e4ab37c7bfab9a2f36025':
Add keyHysteresisDistance xml attribute
Diffstat (limited to 'java/src/com/android/inputmethod/latin/PointerTracker.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/PointerTracker.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/PointerTracker.java b/java/src/com/android/inputmethod/latin/PointerTracker.java index e10c9b862..958e57618 100644 --- a/java/src/com/android/inputmethod/latin/PointerTracker.java +++ b/java/src/com/android/inputmethod/latin/PointerTracker.java @@ -55,7 +55,7 @@ public class PointerTracker { private final boolean mHasDistinctMultitouch; private Key[] mKeys; - private int mKeyDebounceThresholdSquared = -1; + private int mKeyHysteresisDistanceSquared = -1; private int mCurrentKey = NOT_A_KEY; private int mStartX; @@ -106,11 +106,11 @@ public class PointerTracker { mListener = listener; } - public void setKeyboard(Key[] keys, float hysteresisPixel) { - if (keys == null || hysteresisPixel < 1.0f) + public void setKeyboard(Key[] keys, float keyHysteresisDistance) { + if (keys == null || keyHysteresisDistance < 0) throw new IllegalArgumentException(); mKeys = keys; - mKeyDebounceThresholdSquared = (int)(hysteresisPixel * hysteresisPixel); + mKeyHysteresisDistanceSquared = (int)(keyHysteresisDistance * keyHysteresisDistance); // Update current key index because keyboard layout has been changed. mCurrentKey = mKeyDetector.getKeyIndexAndNearbyCodes(mStartX, mStartY, null); } @@ -335,13 +335,12 @@ public class PointerTracker { } private boolean isMinorMoveBounce(int x, int y, int newKey, int curKey) { - if (mKeys == null || mKeyDebounceThresholdSquared < 0) + if (mKeys == null || mKeyHysteresisDistanceSquared < 0) throw new IllegalStateException("keyboard and/or hysteresis not set"); if (newKey == curKey) { return true; } else if (isValidKeyIndex(curKey)) { - return getSquareDistanceToKeyEdge(x, y, mKeys[curKey]) - < mKeyDebounceThresholdSquared; + return getSquareDistanceToKeyEdge(x, y, mKeys[curKey]) < mKeyHysteresisDistanceSquared; } else { return false; } |