aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2010-09-02 21:54:26 +0900
committerTadashi G. Takaoka <takaoka@google.com>2010-09-02 21:54:26 +0900
commit400046d62e22899e28efd2a62321c637c7831f81 (patch)
treeca3016d2c33cc19720e4d3a637df83b71325b84e /java/src/com/android/inputmethod/latin/ProximityKeyDetector.java
parent6b4d521fb486f2762eee1a7ebf3c5e285d3aa83e (diff)
downloadlatinime-400046d62e22899e28efd2a62321c637c7831f81.tar.gz
latinime-400046d62e22899e28efd2a62321c637c7831f81.tar.xz
latinime-400046d62e22899e28efd2a62321c637c7831f81.zip
Encapsulate vertical and horizontal correction values into KeyDetector.
Bug: 2959169 Change-Id: Id2b0b974fffdf6f09ee1828e957b973d2ce1c315
Diffstat (limited to 'java/src/com/android/inputmethod/latin/ProximityKeyDetector.java')
-rw-r--r--java/src/com/android/inputmethod/latin/ProximityKeyDetector.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java b/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java
index 6ee005510..eaaed91aa 100644
--- a/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java
+++ b/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java
@@ -35,6 +35,8 @@ class ProximityKeyDetector extends KeyDetector {
@Override
public int getKeyIndexAndNearbyCodes(int x, int y, int[] allKeys) {
+ int touchX = getTouchX(x);
+ int touchY = getTouchY(y);
final Key[] keys = mKeys;
if (keys == null)
throw new IllegalStateException("keyboard isn't set");
@@ -44,18 +46,18 @@ class ProximityKeyDetector extends KeyDetector {
int closestKeyDist = mProximityThresholdSquare + 1;
int[] distances = mDistances;
Arrays.fill(distances, Integer.MAX_VALUE);
- int [] nearestKeyIndices = mKeyboard.getNearestKeys(x, y);
+ int [] nearestKeyIndices = mKeyboard.getNearestKeys(touchX, touchY);
final int keyCount = nearestKeyIndices.length;
for (int i = 0; i < keyCount; i++) {
final Key key = keys[nearestKeyIndices[i]];
int dist = 0;
- boolean isInside = key.isInside(x,y);
+ boolean isInside = key.isInside(touchX, touchY);
if (isInside) {
primaryIndex = nearestKeyIndices[i];
}
if (((mProximityCorrectOn
- && (dist = key.squaredDistanceFrom(x, y)) < mProximityThresholdSquare)
+ && (dist = key.squaredDistanceFrom(touchX, touchY)) < mProximityThresholdSquare)
|| isInside)
&& key.codes[0] > 32) {
// Find insertion point