diff options
| author | Tadashi G. Takaoka <takaoka@google.com> | 2012-10-06 23:22:36 +0900 |
|---|---|---|
| committer | Tadashi G. Takaoka <takaoka@google.com> | 2012-10-07 01:19:01 +0900 |
| commit | f731eb1760a5693492a34bc11aa755053aa65c19 (patch) | |
| tree | d193997beffe5114f7f8f5e464ec9449d76d0be6 /java/src/com/android/inputmethod/keyboard/KeyDetector.java | |
| parent | 448e732272bb3e55d649d2d5dd6a0acb9efdaec3 (diff) | |
Add separate key hysteresis distance for sliding modifier input
Bug: 7294402
Change-Id: I78c8be9e1a7b2d49d86bfe1e3a46d1785bfe5d48
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/KeyDetector.java')
| -rw-r--r-- | java/src/com/android/inputmethod/keyboard/KeyDetector.java | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyDetector.java b/java/src/com/android/inputmethod/keyboard/KeyDetector.java index f5686dcda..aa683c1d7 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyDetector.java +++ b/java/src/com/android/inputmethod/keyboard/KeyDetector.java @@ -21,6 +21,7 @@ import com.android.inputmethod.latin.Constants; public class KeyDetector { private final int mKeyHysteresisDistanceSquared; + private final int mKeyHysteresisDistanceForSlidingModifierSquared; private Keyboard mKeyboard; private int mCorrectionX; @@ -30,10 +31,24 @@ public class KeyDetector { * This class handles key detection. * * @param keyHysteresisDistance if the pointer movement distance is smaller than this, the - * movement will not been handled as meaningful movement. The unit is pixel. + * movement will not be handled as meaningful movement. The unit is pixel. */ public KeyDetector(float keyHysteresisDistance) { + this(keyHysteresisDistance, keyHysteresisDistance); + } + + /** + * This class handles key detection. + * + * @param keyHysteresisDistance if the pointer movement distance is smaller than this, the + * movement will not be handled as meaningful movement. The unit is pixel. + * @param keyHysteresisDistanceForSlidingModifier the same parameter for sliding input that + * starts from a modifier key such as shift and symbols key. + */ + public KeyDetector(float keyHysteresisDistance, float keyHysteresisDistanceForSlidingModifier) { mKeyHysteresisDistanceSquared = (int)(keyHysteresisDistance * keyHysteresisDistance); + mKeyHysteresisDistanceForSlidingModifierSquared = (int)( + keyHysteresisDistanceForSlidingModifier * keyHysteresisDistanceForSlidingModifier); } public void setKeyboard(Keyboard keyboard, float correctionX, float correctionY) { @@ -45,8 +60,9 @@ public class KeyDetector { mKeyboard = keyboard; } - public int getKeyHysteresisDistanceSquared() { - return mKeyHysteresisDistanceSquared; + public int getKeyHysteresisDistanceSquared(boolean isSlidingFromModifier) { + return isSlidingFromModifier + ? mKeyHysteresisDistanceForSlidingModifierSquared : mKeyHysteresisDistanceSquared; } public int getTouchX(int x) { |
