diff options
author | 2011-10-02 23:12:41 -0700 | |
---|---|---|
committer | 2011-10-02 23:12:41 -0700 | |
commit | 397f6f8299a8acd645e4cc88eead7a345c198044 (patch) | |
tree | d7fbf35cf43645e29a698da850f7372b27c56268 /java/src | |
parent | 25f339fd23fea22036318c47badff1b43d635a46 (diff) | |
parent | 4c0fe5719853325e51a8ff0652318e2afdaca97f (diff) | |
download | latinime-397f6f8299a8acd645e4cc88eead7a345c198044.tar.gz latinime-397f6f8299a8acd645e4cc88eead7a345c198044.tar.xz latinime-397f6f8299a8acd645e4cc88eead7a345c198044.zip |
Merge "Small refactoring"
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 777881ca1..83b79f74c 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -882,35 +882,34 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar final boolean selectionChanged = (newSelStart != candidatesEnd || newSelEnd != candidatesEnd) && mLastSelectionStart != newSelStart; final boolean candidatesCleared = candidatesStart == -1 && candidatesEnd == -1; - if (!mExpectingUpdateSelection - && ((mComposingStringBuilder.length() > 0 && mHasUncommittedTypedChars) - || mVoiceProxy.isVoiceInputHighlighted()) - && (selectionChanged || candidatesCleared)) { - if (candidatesCleared) { - // If the composing span has been cleared, save the typed word in the history for - // recorrection before we reset the suggestions strip. Then, we'll be able to show - // suggestions for recorrection right away. - mRecorrection.saveRecorrectionSuggestion(mWordComposer, mComposingStringBuilder); - } - mComposingStringBuilder.setLength(0); - mHasUncommittedTypedChars = false; - if (isCursorTouchingWord()) { - mHandler.cancelUpdateBigramPredictions(); - mHandler.postUpdateSuggestions(); - } else { - setPunctuationSuggestions(); - } - TextEntryState.reset(); - final InputConnection ic = getCurrentInputConnection(); - if (ic != null) { - ic.finishComposingText(); - } - mVoiceProxy.setVoiceInputHighlighted(false); - } else if (!mHasUncommittedTypedChars && !mExpectingUpdateSelection - && TextEntryState.isAcceptedDefault()) { - TextEntryState.reset(); - } if (!mExpectingUpdateSelection) { + if (((mComposingStringBuilder.length() > 0 && mHasUncommittedTypedChars) + || mVoiceProxy.isVoiceInputHighlighted()) + && (selectionChanged || candidatesCleared)) { + if (candidatesCleared) { + // If the composing span has been cleared, save the typed word in the history + // for recorrection before we reset the suggestions strip. Then, we'll be able + // to show suggestions for recorrection right away. + mRecorrection.saveRecorrectionSuggestion(mWordComposer, + mComposingStringBuilder); + } + mComposingStringBuilder.setLength(0); + mHasUncommittedTypedChars = false; + if (isCursorTouchingWord()) { + mHandler.cancelUpdateBigramPredictions(); + mHandler.postUpdateSuggestions(); + } else { + setPunctuationSuggestions(); + } + TextEntryState.reset(); + final InputConnection ic = getCurrentInputConnection(); + if (ic != null) { + ic.finishComposingText(); + } + mVoiceProxy.setVoiceInputHighlighted(false); + } else if (!mHasUncommittedTypedChars && TextEntryState.isAcceptedDefault()) { + TextEntryState.reset(); + } mJustAddedMagicSpace = false; // The user moved the cursor. mJustReplacedDoubleSpace = false; } |