aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/keyboard/KeyDetector.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/KeyDetector.java')
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyDetector.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyDetector.java b/java/src/com/android/inputmethod/keyboard/KeyDetector.java
index 3979fb53e..1a4f90195 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyDetector.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyDetector.java
@@ -22,6 +22,7 @@ import java.util.List;
public abstract class KeyDetector {
public static final int NOT_A_KEY = -1;
+ public static final int NOT_A_CODE = -1;
protected Keyboard mKeyboard;
@@ -105,10 +106,10 @@ public abstract class KeyDetector {
*
* @param x The x-coordinate of a touch point
* @param y The y-coordinate of a touch point
- * @param allKeys All nearby key indices are returned in this array
+ * @param allCodes All nearby key code except functional key are returned in this array
* @return The nearest key index
*/
- abstract public int getKeyIndexAndNearbyCodes(int x, int y, int[] allKeys);
+ abstract public int getKeyIndexAndNearbyCodes(int x, int y, final int[] allCodes);
/**
* Compute the most common key width in order to use it as proximity key detection threshold.
@@ -116,14 +117,14 @@ public abstract class KeyDetector {
* @param keyboard The keyboard to compute the most common key width
* @return The most common key width in the keyboard
*/
- public static int getMostCommonKeyWidth(Keyboard keyboard) {
+ public static int getMostCommonKeyWidth(final Keyboard keyboard) {
if (keyboard == null) return 0;
final List<Key> keys = keyboard.getKeys();
if (keys == null || keys.size() == 0) return 0;
final HashMap<Integer, Integer> histogram = new HashMap<Integer, Integer>();
int maxCount = 0;
int mostCommonWidth = 0;
- for (Key key : keys) {
+ for (final Key key : keys) {
final Integer width = key.mWidth + key.mGap;
Integer count = histogram.get(width);
if (count == null)