Use additional proximity chars even when no key is detected.

Change-Id: I06a8c66421fcdd43066934ec31d0a38a7cf12bf2
main
Tadashi G. Takaoka 2012-02-16 18:28:22 -08:00
parent 25ff89a75c
commit 9025c55e9f
1 changed files with 36 additions and 27 deletions

View File

@ -180,9 +180,12 @@ public class KeyDetector {
if (maxCodesSize <= numCodes) {
return;
}
if (primaryCode != NOT_A_CODE) {
final List<Integer> additionalChars =
mKeyboard.getAdditionalProximityChars().get(primaryCode);
final int code = (primaryCode == NOT_A_CODE) ? allCodes[0] : primaryCode;
if (code == NOT_A_CODE) {
return;
}
final List<Integer> additionalChars = mKeyboard.getAdditionalProximityChars().get(code);
if (additionalChars == null || additionalChars.size() == 0) {
return;
}
@ -209,7 +212,6 @@ public class KeyDetector {
}
}
}
}
/**
* Finds all possible nearby key codes around a touch event point and returns the nearest key.
@ -257,10 +259,17 @@ public class KeyDetector {
public static String printableCodes(int[] codes) {
final StringBuilder sb = new StringBuilder();
boolean addDelimiter = false;
for (final int code : codes) {
if (code == NOT_A_CODE) break;
if (sb.length() > 0) sb.append(", ");
if (code == ADDITIONAL_PROXIMITY_CHAR_DELIMITER_CODE) {
sb.append(" | ");
addDelimiter = false;
} else {
if (addDelimiter) sb.append(", ");
sb.append(code);
addDelimiter = true;
}
}
return "[" + sb + "]";
}