Make the ".com" key input smarter if there's already '.' at the end of the previous text.
Bug: 2306114main
parent
8600725789
commit
41a5197295
|
@ -867,6 +867,19 @@ public class LatinIME extends InputMethodService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void maybeRemovePreviousPeriod(CharSequence text) {
|
||||||
|
final InputConnection ic = getCurrentInputConnection();
|
||||||
|
if (ic == null) return;
|
||||||
|
|
||||||
|
// When the text's first character is '.', remove the previous period
|
||||||
|
// if there is one.
|
||||||
|
CharSequence lastOne = ic.getTextBeforeCursor(1, 0);
|
||||||
|
if (lastOne != null && lastOne.length() == 1 && lastOne.charAt(0) == '.'
|
||||||
|
&& text.charAt(0) == '.') {
|
||||||
|
ic.deleteSurroundingText(1, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean addWordToDictionary(String word) {
|
public boolean addWordToDictionary(String word) {
|
||||||
mUserDictionary.addWord(word, 128);
|
mUserDictionary.addWord(word, 128);
|
||||||
return true;
|
return true;
|
||||||
|
@ -947,6 +960,7 @@ public class LatinIME extends InputMethodService
|
||||||
if (mPredicting) {
|
if (mPredicting) {
|
||||||
commitTyped(ic);
|
commitTyped(ic);
|
||||||
}
|
}
|
||||||
|
maybeRemovePreviousPeriod(text);
|
||||||
ic.commitText(text, 1);
|
ic.commitText(text, 1);
|
||||||
ic.endBatchEdit();
|
ic.endBatchEdit();
|
||||||
updateShiftKeyState(getCurrentInputEditorInfo());
|
updateShiftKeyState(getCurrentInputEditorInfo());
|
||||||
|
|
Loading…
Reference in New Issue