diff options
author | 2010-12-27 20:13:16 +0900 | |
---|---|---|
committer | 2010-12-27 20:13:16 +0900 | |
commit | d12def6dc8ba3a2f47b90e6d5d442f315152c6d4 (patch) | |
tree | 7274b29f518f94d31cd5c995d1b46bfc323de818 /java/src/com/android/inputmethod/latin/ProximityKeyDetector.java | |
parent | b80f171623a11bceb99b563594162d0034b9bde8 (diff) | |
parent | bfe2b534457d946645d483e311249787ba4fc3ae (diff) | |
download | latinime-d12def6dc8ba3a2f47b90e6d5d442f315152c6d4.tar.gz latinime-d12def6dc8ba3a2f47b90e6d5d442f315152c6d4.tar.xz latinime-d12def6dc8ba3a2f47b90e6d5d442f315152c6d4.zip |
Merge remote branch 'goog/master' into merge
Conflicts:
java/res/values-cs/strings.xml
java/res/values-da/strings.xml
java/res/values-de/strings.xml
java/res/values-el/strings.xml
java/res/values-es-rUS/strings.xml
java/res/values-es/strings.xml
java/res/values-fr/strings.xml
java/res/values-it/strings.xml
java/res/values-ja/strings.xml
java/res/values-ko/strings.xml
java/res/values-nb/strings.xml
java/res/values-nl/strings.xml
java/res/values-pl/strings.xml
java/res/values-pt-rPT/strings.xml
java/res/values-pt/strings.xml
java/res/values-ru/strings.xml
java/res/values-sv/strings.xml
java/res/values-tr/strings.xml
java/res/values-xlarge/dimens.xml
java/res/values-zh-rCN/strings.xml
java/res/values-zh-rTW/strings.xml
java/res/values/bools.xml
java/res/xml/kbd_qwerty_rows.xml
java/res/xml/method.xml
java/res/xml/prefs.xml
Change-Id: I8768d16965e6e82c14ee742b9ada56438497eb86
Diffstat (limited to 'java/src/com/android/inputmethod/latin/ProximityKeyDetector.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/ProximityKeyDetector.java | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java b/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java deleted file mode 100644 index d17bedb56..000000000 --- a/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.android.inputmethod.latin; - -import android.inputmethodservice.Keyboard.Key; - -import java.util.Arrays; - -class ProximityKeyDetector extends KeyDetector { - private static final int MAX_NEARBY_KEYS = 12; - - // working area - private int[] mDistances = new int[MAX_NEARBY_KEYS]; - - @Override - protected int getMaxNearbyKeys() { - return MAX_NEARBY_KEYS; - } - - @Override - public int getKeyIndexAndNearbyCodes(int x, int y, int[] allKeys) { - final Key[] keys = getKeys(); - final int touchX = getTouchX(x); - final int touchY = getTouchY(y); - int primaryIndex = LatinKeyboardBaseView.NOT_A_KEY; - int closestKey = LatinKeyboardBaseView.NOT_A_KEY; - int closestKeyDist = mProximityThresholdSquare + 1; - int[] distances = mDistances; - Arrays.fill(distances, Integer.MAX_VALUE); - 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(touchX, touchY); - if (isInside) { - primaryIndex = nearestKeyIndices[i]; - } - - if (((mProximityCorrectOn - && (dist = key.squaredDistanceFrom(touchX, touchY)) < mProximityThresholdSquare) - || isInside) - && key.codes[0] > 32) { - // Find insertion point - final int nCodes = key.codes.length; - if (dist < closestKeyDist) { - closestKeyDist = dist; - closestKey = nearestKeyIndices[i]; - } - - if (allKeys == null) continue; - - for (int j = 0; j < distances.length; j++) { - if (distances[j] > dist) { - // Make space for nCodes codes - System.arraycopy(distances, j, distances, j + nCodes, - distances.length - j - nCodes); - System.arraycopy(allKeys, j, allKeys, j + nCodes, - allKeys.length - j - nCodes); - System.arraycopy(key.codes, 0, allKeys, j, nCodes); - Arrays.fill(distances, j, j + nCodes, dist); - break; - } - } - } - } - if (primaryIndex == LatinKeyboardBaseView.NOT_A_KEY) { - primaryIndex = closestKey; - } - return primaryIndex; - } -}
\ No newline at end of file |