aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-07-06 03:40:03 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-07-06 03:40:03 -0700
commit36311cacd68865f9705d8c62c24f7b007688b33b (patch)
treee7dc48b4f87cf9a7cad00969a2a40004bdc60127 /java/src/com/android/inputmethod/latin/LatinIME.java
parenta3dee0d06279054a1f18643e15bff94c74fdcfa0 (diff)
parent4be03befe3cf771a33448367f50c517dc01ced21 (diff)
downloadlatinime-36311cacd68865f9705d8c62c24f7b007688b33b.tar.gz
latinime-36311cacd68865f9705d8c62c24f7b007688b33b.tar.xz
latinime-36311cacd68865f9705d8c62c24f7b007688b33b.zip
Merge "Extend onTextInput to be able to inject suggestions"
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java35
1 files changed, 34 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index e36a5a795..243a5f64e 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1272,6 +1272,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (mCurrentSettings.isWordSeparator(primaryCode)) {
didAutoCorrect = handleSeparator(primaryCode, x, y, spaceState);
} else {
+ if (SPACE_STATE_PHANTOM == spaceState) {
+ commitTyped(LastComposedWord.NOT_A_SEPARATOR);
+ }
final Keyboard keyboard = mKeyboardSwitcher.getKeyboard();
if (keyboard != null && keyboard.hasProximityCharsCorrection(primaryCode)) {
handleCharacter(primaryCode, x, y, spaceState);
@@ -1313,6 +1316,31 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
resetComposingState(true /* alsoResetLastComposedWord */);
}
+ @Override
+ public void onStartBatchInput() {
+ mConnection.beginBatchEdit();
+ if (mWordComposer.isComposingWord()) {
+ commitTyped(LastComposedWord.NOT_A_SEPARATOR);
+ mExpectingUpdateSelection = true;
+ // TODO: Can we remove this?
+ mSpaceState = SPACE_STATE_PHANTOM;
+ }
+ mConnection.endBatchEdit();
+ }
+
+ @Override
+ public void onEndBatchInput(CharSequence text) {
+ mConnection.beginBatchEdit();
+ if (SPACE_STATE_PHANTOM == mSpaceState) {
+ sendKeyCodePoint(Keyboard.CODE_SPACE);
+ }
+ mConnection.setComposingText(text, 1);
+ mExpectingUpdateSelection = true;
+ mConnection.endBatchEdit();
+ mKeyboardSwitcher.updateShiftState();
+ mSpaceState = SPACE_STATE_PHANTOM;
+ }
+
private CharSequence specificTldProcessingOnTextInput(final CharSequence text) {
if (text.length() <= 1 || text.charAt(0) != Keyboard.CODE_PERIOD
|| !Character.isLetter(text.charAt(1))) {
@@ -1359,7 +1387,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (mWordComposer.isComposingWord()) {
final int length = mWordComposer.size();
if (length > 0) {
- mWordComposer.deleteLast();
+ // Immediately after a batch input.
+ if (SPACE_STATE_PHANTOM == spaceState) {
+ mWordComposer.reset();
+ } else {
+ mWordComposer.deleteLast();
+ }
mConnection.setComposingText(getTextWithUnderline(mWordComposer.getTypedWord()), 1);
// If we have deleted the last remaining character of a word, then we are not
// isComposingWord() any more.