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:02:53 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-02 06:02:53 -0700
commite9eda7ea9442300984f0f9510ee189e4b894166d (patch)
tree56acf5a676331f1bb5374bb1fa95c739aa8f18b5 /java/src/com/android/inputmethod/latin/ProximityKeyDetector.java
parent9b5867e3e6e20a691b3656212d567dd0c5215adb (diff)
parent7f67c211e7ec4bdf148c9dd468cc8e73ffeb66e3 (diff)
downloadlatinime-e9eda7ea9442300984f0f9510ee189e4b894166d.tar.gz
latinime-e9eda7ea9442300984f0f9510ee189e4b894166d.tar.xz
latinime-e9eda7ea9442300984f0f9510ee189e4b894166d.zip
am 7f67c211: am 400046d6: Encapsulate vertical and horizontal correction values into KeyDetector.
Merge commit '7f67c211e7ec4bdf148c9dd468cc8e73ffeb66e3' * commit '7f67c211e7ec4bdf148c9dd468cc8e73ffeb66e3': 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