aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-12-25 20:08:52 +0900
committerJean Chalard <jchalard@google.com>2013-12-27 16:50:08 +0900
commitc654fe57b1686dde764ea31b0e510885b75b14a1 (patch)
tree55b96a21d565a53af84cf06c5911a05a95f39470 /java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
parent4a144b9b4d9e78bff7662001c97430491f9747a0 (diff)
downloadlatinime-c654fe57b1686dde764ea31b0e510885b75b14a1.tar.gz
latinime-c654fe57b1686dde764ea31b0e510885b75b14a1.tar.xz
latinime-c654fe57b1686dde764ea31b0e510885b75b14a1.zip
[IL48] Move onEndBatchInputAsyncInternal to InputLogic.
Bug: 8636060 Change-Id: Idfabf7231a80e21786ce1910b5140bb3dddcac7d
Diffstat (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java')
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index 5613fe6a3..34377e955 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -1509,6 +1509,47 @@ public final class InputLogic {
}
/**
+ * Do the final processing after a batch input has ended. This commits the word to the editor.
+ * @param settingsValues the current values of the settings.
+ * @param suggestedWords suggestedWords to use.
+ */
+ public void onEndBatchInputAsyncInternal(final SettingsValues settingsValues,
+ final SuggestedWords suggestedWords,
+ // TODO: remove this argument
+ final KeyboardSwitcher keyboardSwitcher) {
+ final String batchInputText = suggestedWords.isEmpty() ? null : suggestedWords.getWord(0);
+ if (TextUtils.isEmpty(batchInputText)) {
+ return;
+ }
+ mConnection.beginBatchEdit();
+ if (SpaceState.PHANTOM == mSpaceState) {
+ promotePhantomSpace(settingsValues);
+ }
+ if (settingsValues.mPhraseGestureEnabled) {
+ // Find the last space
+ final int indexOfLastSpace = batchInputText.lastIndexOf(Constants.CODE_SPACE) + 1;
+ if (0 != indexOfLastSpace) {
+ mConnection.commitText(batchInputText.substring(0, indexOfLastSpace), 1);
+ mLatinIME.showSuggestionStrip(
+ suggestedWords.getSuggestedWordsForLastWordOfPhraseGesture());
+ }
+ final String lastWord = batchInputText.substring(indexOfLastSpace);
+ mWordComposer.setBatchInputWord(lastWord);
+ mConnection.setComposingText(lastWord, 1);
+ } else {
+ mWordComposer.setBatchInputWord(batchInputText);
+ mConnection.setComposingText(batchInputText, 1);
+ }
+ mConnection.endBatchEdit();
+ if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
+ ResearchLogger.latinIME_onEndBatchInput(batchInputText, 0, suggestedWords);
+ }
+ // Space state must be updated before calling updateShiftState
+ mSpaceState = SpaceState.PHANTOM;
+ keyboardSwitcher.updateShiftState();
+ }
+
+ /**
* Commit the typed string to the editor.
*
* This is typically called when we should commit the currently composing word without applying