Merge "Handle correctly the restarting argument"

main
Jean Chalard 2012-07-26 06:47:58 -07:00 committed by Android (Google) Code Review
commit 7677a0ee7f
1 changed files with 30 additions and 16 deletions

View File

@ -659,35 +659,49 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
accessUtils.onStartInputViewInternal(editorInfo, restarting); accessUtils.onStartInputViewInternal(editorInfo, restarting);
} }
mSubtypeSwitcher.updateParametersOnStartInputView(); if (!restarting) {
mSubtypeSwitcher.updateParametersOnStartInputView();
}
// The EditorInfo might have a flag that affects fullscreen mode. // The EditorInfo might have a flag that affects fullscreen mode.
// Note: This call should be done by InputMethodService? // Note: This call should be done by InputMethodService?
updateFullscreenMode(); updateFullscreenMode();
mLastSelectionStart = editorInfo.initialSelStart;
mLastSelectionEnd = editorInfo.initialSelEnd;
mApplicationSpecifiedCompletions = null; mApplicationSpecifiedCompletions = null;
inputView.closing(); final boolean selectionChanged = mLastSelectionStart != editorInfo.initialSelStart
mEnteredText = null; || mLastSelectionEnd != editorInfo.initialSelEnd;
resetComposingState(true /* alsoResetLastComposedWord */); if (!restarting || selectionChanged) {
mDeleteCount = 0; // If the selection changed, we reset the input state. Essentially, we come here with
mSpaceState = SPACE_STATE_NONE; // 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;
loadSettings(); if (mSuggestionStripView != null) {
mSuggestionStripView.clear();
if (mSuggest != null && mCurrentSettings.mCorrectionEnabled) { }
mSuggest.setAutoCorrectionThreshold(mCurrentSettings.mAutoCorrectionThreshold);
} }
switcher.loadKeyboard(editorInfo, mCurrentSettings); if (!restarting) {
updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability(); inputView.closing();
loadSettings();
if (mSuggestionStripView != null) if (mSuggest != null && mCurrentSettings.mCorrectionEnabled) {
mSuggestionStripView.clear(); mSuggest.setAutoCorrectionThreshold(mCurrentSettings.mAutoCorrectionThreshold);
}
switcher.loadKeyboard(editorInfo, mCurrentSettings);
updateKeyboardViewGestureHandlingModeByMainDictionaryAvailability();
}
setSuggestionStripShownInternal( setSuggestionStripShownInternal(
isSuggestionsStripVisible(), /* needsInputViewShown */ false); isSuggestionsStripVisible(), /* needsInputViewShown */ false);
mLastSelectionStart = editorInfo.initialSelStart;
mLastSelectionEnd = editorInfo.initialSelEnd;
mHandler.cancelUpdateSuggestionStrip(); mHandler.cancelUpdateSuggestionStrip();
mHandler.cancelDoubleSpacesTimer(); mHandler.cancelDoubleSpacesTimer();