summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2010-02-01 01:34:55 +0900
committerKen Wakasa <kwakasa@google.com>2010-02-01 01:40:59 +0900
commit41a519729505a877844f2c57a33509c302dddbce (patch)
tree1e63b76a4723e1efa714d80364206c13720cb585 /src
parent8600725789ca0d7a3525c763d7d2af7f9c37b6b9 (diff)
downloadandroid_packages_inputmethods_LatinIME-41a519729505a877844f2c57a33509c302dddbce.tar.gz
android_packages_inputmethods_LatinIME-41a519729505a877844f2c57a33509c302dddbce.tar.bz2
android_packages_inputmethods_LatinIME-41a519729505a877844f2c57a33509c302dddbce.zip
Make the ".com" key input smarter if there's already '.' at the end of the previous text.
Bug: 2306114
Diffstat (limited to 'src')
-rw-r--r--src/com/android/inputmethod/latin/LatinIME.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/com/android/inputmethod/latin/LatinIME.java b/src/com/android/inputmethod/latin/LatinIME.java
index c24268dd7..8056030f6 100644
--- a/src/com/android/inputmethod/latin/LatinIME.java
+++ b/src/com/android/inputmethod/latin/LatinIME.java
@@ -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) {
mUserDictionary.addWord(word, 128);
return true;
@@ -947,6 +960,7 @@ public class LatinIME extends InputMethodService
if (mPredicting) {
commitTyped(ic);
}
+ maybeRemovePreviousPeriod(text);
ic.commitText(text, 1);
ic.endBatchEdit();
updateShiftKeyState(getCurrentInputEditorInfo());