Methods Summary |
---|
public void | add(int primaryCode, int[] codes)Add a new keystroke, with codes[0] containing the pressed key's unicode and the rest of
the array containing unicode for adjacent keys, sorted by reducing probability/proximity.
mTypedWord.append((char) primaryCode);
mCodes.add(codes);
|
public void | deleteLast()Delete the last keystroke as a result of hitting backspace.
mCodes.remove(mCodes.size() - 1);
mTypedWord.deleteCharAt(mTypedWord.length() - 1);
|
public int[] | getCodesAt(int index)Returns the codes at a particular position in the word.
return mCodes.get(index);
|
public java.lang.CharSequence | getPreferredWord()Return the word chosen by the user, or the typed word if no other word was chosen.
return mPreferredWord != null ? mPreferredWord : getTypedWord();
|
public java.lang.CharSequence | getTypedWord()Returns the word as it was typed, without any correction applied.
int wordSize = mCodes.size();
if (wordSize == 0) {
return null;
}
// StringBuffer sb = new StringBuffer(wordSize);
// for (int i = 0; i < wordSize; i++) {
// char c = (char) mCodes.get(i)[0];
// if (i == 0 && mIsCapitalized) {
// c = Character.toUpperCase(c);
// }
// sb.append(c);
// }
// return sb;
return mTypedWord;
|
public boolean | isCapitalized()Whether or not the user typed a capital letter as the first letter in the word
return mIsCapitalized;
|
public void | reset()Clear out the keys registered so far.
mCodes.clear();
mIsCapitalized = false;
mPreferredWord = null;
mTypedWord.setLength(0);
|
public void | setCapitalized(boolean capitalized)
mIsCapitalized = capitalized;
|
public void | setPreferredWord(java.lang.String preferred)Stores the user's selected word, before it is actually committed to the text field.
mPreferredWord = preferred;
|
public int | size()Number of keystrokes in the composing word.
return mCodes.size();
|