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 06:01:00 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-02 06:01:00 -0700
commit7f67c211e7ec4bdf148c9dd468cc8e73ffeb66e3 (patch)
treeca3016d2c33cc19720e4d3a637df83b71325b84e /java/src/com/android/inputmethod/latin/ProximityKeyDetector.java
parenta4397ce38af2e1ac3a8284bc078bd1e9cb4fecf4 (diff)
parent400046d62e22899e28efd2a62321c637c7831f81 (diff)
downloadlatinime-7f67c211e7ec4bdf148c9dd468cc8e73ffeb66e3.tar.gz
latinime-7f67c211e7ec4bdf148c9dd468cc8e73ffeb66e3.tar.xz
latinime-7f67c211e7ec4bdf148c9dd468cc8e73ffeb66e3.zip
am 400046d6: Encapsulate vertical and horizontal correction values into KeyDetector.
Merge commit '400046d62e22899e28efd2a62321c637c7831f81' into gingerbread-plus-aosp * commit '400046d62e22899e28efd2a62321c637c7831f81': Encapsulate vertical and horizontal correction values into KeyDetector.
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