Reset the IME if requested by the app.
Specifically, reset the KeyboardState to the main Alphabet layout in LatinIME.onStartInputViewInternal() if a keyboard layout set doesn't get reloaded in the method. Please note TextView.setText() calls up resetInput(), then the IME should reset with it. bug: 7482086 Note that bug: 6851364 needs to be revisited. Change-Id: I5d448c10963d3dd952dd13cb587085ec7b014e69main
parent
60dea36daf
commit
5d2556b932
|
@ -200,6 +200,12 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
|||
mState.onUpdateShiftState(mLatinIME.getCurrentAutoCapsState());
|
||||
}
|
||||
|
||||
// TODO: Remove this method. Come up with a more comprehensive way to reset the keyboard layout
|
||||
// when a keyboard layout set doesn't get reloaded in LatinIME.onStartInputViewInternal().
|
||||
public void resetKeyboardStateToAlphabet() {
|
||||
mState.onResetKeyboardStateToAlphabet();
|
||||
}
|
||||
|
||||
public void onPressKey(int code) {
|
||||
if (isVibrateAndSoundFeedbackRequired()) {
|
||||
mLatinIME.hapticAndAudioFeedback(code);
|
||||
|
|
|
@ -254,6 +254,22 @@ public final class KeyboardState {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Remove this method. Come up with a more comprehensive way to reset the keyboard layout
|
||||
// when a keyboard layout set doesn't get reloaded in LatinIME.onStartInputViewInternal().
|
||||
private void resetKeyboardStateToAlphabet() {
|
||||
if (DEBUG_ACTION) {
|
||||
Log.d(TAG, "resetKeyboardStateToAlphabet: " + this);
|
||||
}
|
||||
if (mIsAlphabetMode) return;
|
||||
|
||||
mPrevSymbolsKeyboardWasShifted = mIsSymbolShifted;
|
||||
setAlphabetKeyboard();
|
||||
if (mPrevMainKeyboardWasShiftLocked) {
|
||||
setShiftLocked(true);
|
||||
}
|
||||
mPrevMainKeyboardWasShiftLocked = false;
|
||||
}
|
||||
|
||||
private void toggleShiftInSymbols() {
|
||||
if (mIsSymbolShifted) {
|
||||
setSymbolsKeyboard();
|
||||
|
@ -380,6 +396,15 @@ public final class KeyboardState {
|
|||
updateAlphabetShiftState(autoCaps);
|
||||
}
|
||||
|
||||
// TODO: Remove this method. Come up with a more comprehensive way to reset the keyboard layout
|
||||
// when a keyboard layout set doesn't get reloaded in LatinIME.onStartInputViewInternal().
|
||||
public void onResetKeyboardStateToAlphabet() {
|
||||
if (DEBUG_EVENT) {
|
||||
Log.d(TAG, "onResetKeyboardStateToAlphabet: " + this);
|
||||
}
|
||||
resetKeyboardStateToAlphabet();
|
||||
}
|
||||
|
||||
private void updateAlphabetShiftState(int autoCaps) {
|
||||
if (!mIsAlphabetMode) return;
|
||||
if (!mShiftKeyState.isReleasing()) {
|
||||
|
|
|
@ -732,6 +732,10 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
|||
}
|
||||
|
||||
switcher.loadKeyboard(editorInfo, mCurrentSettings);
|
||||
} else if (restarting) {
|
||||
// TODO: Come up with a more comprehensive way to reset the keyboard layout when
|
||||
// a keyboard layout set doesn't get reloaded in this method.
|
||||
switcher.resetKeyboardStateToAlphabet();
|
||||
}
|
||||
setSuggestionStripShownInternal(
|
||||
isSuggestionsStripVisible(), /* needsInputViewShown */ false);
|
||||
|
|
Loading…
Reference in New Issue