diff options
author | 2012-07-26 06:47:58 -0700 | |
---|---|---|
committer | 2012-07-26 06:47:59 -0700 | |
commit | 7677a0ee7f6555a8dc58813c9bf5eb7aca8b18ef (patch) | |
tree | 8ac2530c1f04736f04671bc93f63b5ca0705f69e /java/src | |
parent | 97c8d288a8cdef93dbc9301e4f33e008345ae717 (diff) | |
parent | aa906c36aa31f51a38083e337f4307b49f133054 (diff) | |
download | latinime-7677a0ee7f6555a8dc58813c9bf5eb7aca8b18ef.tar.gz latinime-7677a0ee7f6555a8dc58813c9bf5eb7aca8b18ef.tar.xz latinime-7677a0ee7f6555a8dc58813c9bf5eb7aca8b18ef.zip |
Merge "Handle correctly the restarting argument"
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index b390cc08c..6b5de486c 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -659,35 +659,49 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen accessUtils.onStartInputViewInternal(editorInfo, restarting); } - mSubtypeSwitcher.updateParametersOnStartInputView(); + if (!restarting) { + mSubtypeSwitcher.updateParametersOnStartInputView(); + } // The EditorInfo might have a flag that affects fullscreen mode. // Note: This call should be done by InputMethodService? updateFullscreenMode(); - mLastSelectionStart = editorInfo.initialSelStart; - mLastSelectionEnd = editorInfo.initialSelEnd; mApplicationSpecifiedCompletions = null; - inputView.closing(); - mEnteredText = null; - resetComposingState(true /* alsoResetLastComposedWord */); - mDeleteCount = 0; - mSpaceState = SPACE_STATE_NONE; - - loadSettings(); + final boolean selectionChanged = mLastSelectionStart != editorInfo.initialSelStart + || mLastSelectionEnd != editorInfo.initialSelEnd; + if (!restarting || selectionChanged) { + // If the selection changed, we reset the input state. Essentially, we come here with + // restarting == true when the app called setText() or similar. We should reset the + // state if the app set the text to something else, but keep it if it set a suggestion + // or something. + mEnteredText = null; + resetComposingState(true /* alsoResetLastComposedWord */); + mDeleteCount = 0; + mSpaceState = SPACE_STATE_NONE; - if (mSuggest != null && mCurrentSettings.mCorrectionEnabled) { - mSuggest.setAutoCorrectionThreshold(mCurrentSettings.mAutoCorrectionThreshold); + if (mSuggestionStripView != null) { + mSuggestionStripView.clear(); + } } - switcher.loadKeyboard(editorInfo, mCurrentSettings); - updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability(); + if (!restarting) { + inputView.closing(); + loadSettings(); - if (mSuggestionStripView != null) - mSuggestionStripView.clear(); + if (mSuggest != null && mCurrentSettings.mCorrectionEnabled) { + mSuggest.setAutoCorrectionThreshold(mCurrentSettings.mAutoCorrectionThreshold); + } + + switcher.loadKeyboard(editorInfo, mCurrentSettings); + updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability(); + } setSuggestionStripShownInternal( isSuggestionsStripVisible(), /* needsInputViewShown */ false); + mLastSelectionStart = editorInfo.initialSelStart; + mLastSelectionEnd = editorInfo.initialSelEnd; + mHandler.cancelUpdateSuggestionStrip(); mHandler.cancelDoubleSpacesTimer(); |