Loading java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +42 −3 Original line number Diff line number Diff line Loading @@ -39,6 +39,8 @@ import com.android.inputmethod.latin.WordComposer; import com.android.inputmethod.latin.define.ProductionFlags; import com.android.inputmethod.latin.settings.Settings; import com.android.inputmethod.latin.settings.SettingsValues; import com.android.inputmethod.latin.utils.CapsModeUtils; import com.android.inputmethod.latin.utils.RecapitalizeStatus; import com.android.inputmethod.latin.utils.ResourceUtils; import com.android.inputmethod.latin.utils.ScriptUtils; Loading Loading @@ -204,36 +206,54 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { // Implements {@link KeyboardState.SwitchActions}. @Override public void setAlphabetKeyboard() { if (DEBUG_ACTION) { Log.d(TAG, "setAlphabetKeyboard"); } setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET)); } // Implements {@link KeyboardState.SwitchActions}. @Override public void setAlphabetManualShiftedKeyboard() { if (DEBUG_ACTION) { Log.d(TAG, "setAlphabetManualShiftedKeyboard"); } setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED)); } // Implements {@link KeyboardState.SwitchActions}. @Override public void setAlphabetAutomaticShiftedKeyboard() { if (DEBUG_ACTION) { Log.d(TAG, "setAlphabetAutomaticShiftedKeyboard"); } setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED)); } // Implements {@link KeyboardState.SwitchActions}. @Override public void setAlphabetShiftLockedKeyboard() { if (DEBUG_ACTION) { Log.d(TAG, "setAlphabetShiftLockedKeyboard"); } setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED)); } // Implements {@link KeyboardState.SwitchActions}. @Override public void setAlphabetShiftLockShiftedKeyboard() { if (DEBUG_ACTION) { Log.d(TAG, "setAlphabetShiftLockShiftedKeyboard"); } setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED)); } // Implements {@link KeyboardState.SwitchActions}. @Override public void setSymbolsKeyboard() { if (DEBUG_ACTION) { Log.d(TAG, "setSymbolsKeyboard"); } setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_SYMBOLS)); } Loading @@ -247,6 +267,9 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { // Implements {@link KeyboardState.SwitchActions}. @Override public void setEmojiKeyboard() { if (DEBUG_ACTION) { Log.d(TAG, "setEmojiKeyboard"); } final Keyboard keyboard = mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET); mMainKeyboardFrame.setVisibility(View.GONE); mEmojiPalettesView.startEmojiPalettes( Loading @@ -269,19 +292,29 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { // Implements {@link KeyboardState.SwitchActions}. @Override public void setSymbolsShiftedKeyboard() { if (DEBUG_ACTION) { Log.d(TAG, "setSymbolsShiftedKeyboard"); } setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_SYMBOLS_SHIFTED)); } // Future method for requesting an updating to the shift state. @Override public void requestUpdatingShiftState(final int currentAutoCapsState, final int currentRecapitalizeState) { mState.onUpdateShiftState(currentAutoCapsState, currentRecapitalizeState); public void requestUpdatingShiftState(final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_ACTION) { Log.d(TAG, "requestUpdatingShiftState: " + " autoCapsFlags=" + CapsModeUtils.flagsToString(autoCapsFlags) + " recapitalizeMode=" + RecapitalizeStatus.modeToString(recapitalizeMode)); } mState.onUpdateShiftState(autoCapsFlags, recapitalizeMode); } // Implements {@link KeyboardState.SwitchActions}. @Override public void startDoubleTapShiftKeyTimer() { if (DEBUG_TIMER_ACTION) { Log.d(TAG, "startDoubleTapShiftKeyTimer"); } final MainKeyboardView keyboardView = getMainKeyboardView(); if (keyboardView != null) { keyboardView.startDoubleTapShiftKeyTimer(); Loading @@ -291,6 +324,9 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { // Implements {@link KeyboardState.SwitchActions}. @Override public void cancelDoubleTapShiftKeyTimer() { if (DEBUG_TIMER_ACTION) { Log.d(TAG, "setAlphabetKeyboard"); } final MainKeyboardView keyboardView = getMainKeyboardView(); if (keyboardView != null) { keyboardView.cancelDoubleTapShiftKeyTimer(); Loading @@ -300,6 +336,9 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { // Implements {@link KeyboardState.SwitchActions}. @Override public boolean isInDoubleTapShiftKeyTimeout() { if (DEBUG_TIMER_ACTION) { Log.d(TAG, "isInDoubleTapShiftKeyTimeout"); } final MainKeyboardView keyboardView = getMainKeyboardView(); return keyboardView != null && keyboardView.isInDoubleTapShiftKeyTimeout(); } Loading java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java +79 −73 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.util.Log; import com.android.inputmethod.event.Event; import com.android.inputmethod.latin.common.Constants; import com.android.inputmethod.latin.utils.CapsModeUtils; import com.android.inputmethod.latin.utils.RecapitalizeStatus; /** Loading @@ -38,9 +39,11 @@ import com.android.inputmethod.latin.utils.RecapitalizeStatus; public final class KeyboardState { private static final String TAG = KeyboardState.class.getSimpleName(); private static final boolean DEBUG_EVENT = false; private static final boolean DEBUG_ACTION = false; private static final boolean DEBUG_INTERNAL_ACTION = false; public interface SwitchActions { public static final boolean DEBUG_ACTION = false; public void setAlphabetKeyboard(); public void setAlphabetManualShiftedKeyboard(); public void setAlphabetAutomaticShiftedKeyboard(); Loading @@ -53,8 +56,9 @@ public final class KeyboardState { /** * Request to call back {@link KeyboardState#onUpdateShiftState(int, int)}. */ public void requestUpdatingShiftState(final int currentAutoCapsState, final int currentRecapitalizeState); public void requestUpdatingShiftState(final int autoCapsFlags, final int recapitalizeMode); public static final boolean DEBUG_TIMER_ACTION = false; public void startDoubleTapShiftKeyTimer(); public boolean isInDoubleTapShiftKeyTimeout(); Loading Loading @@ -119,10 +123,9 @@ public final class KeyboardState { mRecapitalizeMode = RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE; } public void onLoadKeyboard(final int currentAutoCapsState, final int currentRecapitalizeState) { public void onLoadKeyboard(final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_EVENT) { Log.d(TAG, "onLoadKeyboard: " + this); Log.d(TAG, "onLoadKeyboard: " + stateToString(autoCapsFlags, recapitalizeMode)); } // Reset alphabet shift state. mAlphabetShiftState.setShiftLocked(false); Loading @@ -130,7 +133,7 @@ public final class KeyboardState { mPrevSymbolsKeyboardWasShifted = false; mShiftKeyState.onRelease(); mSymbolKeyState.onRelease(); onRestoreKeyboardState(currentAutoCapsState, currentRecapitalizeState); onRestoreKeyboardState(autoCapsFlags, recapitalizeMode); } private static final int UNSHIFT = 0; Loading @@ -156,14 +159,14 @@ public final class KeyboardState { } } private void onRestoreKeyboardState(final int currentAutoCapsState, final int currentRecapitalizeState) { private void onRestoreKeyboardState(final int autoCapsFlags, final int recapitalizeMode) { final SavedKeyboardState state = mSavedKeyboardState; if (DEBUG_EVENT) { Log.d(TAG, "onRestoreKeyboardState: saved=" + state + " " + this); Log.d(TAG, "onRestoreKeyboardState: saved=" + state + " " + stateToString(autoCapsFlags, recapitalizeMode)); } if (!state.mIsValid || state.mIsAlphabetMode) { setAlphabetKeyboard(currentAutoCapsState, currentRecapitalizeState); setAlphabetKeyboard(autoCapsFlags, recapitalizeMode); } else if (state.mIsEmojiMode) { setEmojiKeyboard(); } else { Loading @@ -188,7 +191,7 @@ public final class KeyboardState { } private void setShifted(final int shiftMode) { if (DEBUG_ACTION) { if (DEBUG_INTERNAL_ACTION) { Log.d(TAG, "setShifted: shiftMode=" + shiftModeToString(shiftMode) + " " + this); } if (!mIsAlphabetMode) return; Loading Loading @@ -227,7 +230,7 @@ public final class KeyboardState { } private void setShiftLocked(final boolean shiftLocked) { if (DEBUG_ACTION) { if (DEBUG_INTERNAL_ACTION) { Log.d(TAG, "setShiftLocked: shiftLocked=" + shiftLocked + " " + this); } if (!mIsAlphabetMode) return; Loading @@ -241,10 +244,10 @@ public final class KeyboardState { mAlphabetShiftState.setShiftLocked(shiftLocked); } private void toggleAlphabetAndSymbols(final int currentAutoCapsState, final int currentRecapitalizeState) { if (DEBUG_ACTION) { Log.d(TAG, "toggleAlphabetAndSymbols: " + this); private void toggleAlphabetAndSymbols(final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_INTERNAL_ACTION) { Log.d(TAG, "toggleAlphabetAndSymbols: " + stateToString(autoCapsFlags, recapitalizeMode)); } if (mIsAlphabetMode) { mPrevMainKeyboardWasShiftLocked = mAlphabetShiftState.isShiftLocked(); Loading @@ -256,7 +259,7 @@ public final class KeyboardState { mPrevSymbolsKeyboardWasShifted = false; } else { mPrevSymbolsKeyboardWasShifted = mIsSymbolShifted; setAlphabetKeyboard(currentAutoCapsState, currentRecapitalizeState); setAlphabetKeyboard(autoCapsFlags, recapitalizeMode); if (mPrevMainKeyboardWasShiftLocked) { setShiftLocked(true); } Loading @@ -266,15 +269,15 @@ 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(final int currentAutoCapsState, final int currentRecapitalizeState) { if (DEBUG_ACTION) { Log.d(TAG, "resetKeyboardStateToAlphabet: " + this); private void resetKeyboardStateToAlphabet(final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_INTERNAL_ACTION) { Log.d(TAG, "resetKeyboardStateToAlphabet: " + stateToString(autoCapsFlags, recapitalizeMode)); } if (mIsAlphabetMode) return; mPrevSymbolsKeyboardWasShifted = mIsSymbolShifted; setAlphabetKeyboard(currentAutoCapsState, currentRecapitalizeState); setAlphabetKeyboard(autoCapsFlags, recapitalizeMode); if (mPrevMainKeyboardWasShiftLocked) { setShiftLocked(true); } Loading @@ -289,10 +292,9 @@ public final class KeyboardState { } } private void setAlphabetKeyboard(final int currentAutoCapsState, final int currentRecapitalizeState) { if (DEBUG_ACTION) { Log.d(TAG, "setAlphabetKeyboard"); private void setAlphabetKeyboard(final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_INTERNAL_ACTION) { Log.d(TAG, "setAlphabetKeyboard: " + stateToString(autoCapsFlags, recapitalizeMode)); } mSwitchActions.setAlphabetKeyboard(); Loading @@ -301,11 +303,11 @@ public final class KeyboardState { mIsSymbolShifted = false; mRecapitalizeMode = RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE; mSwitchState = SWITCH_STATE_ALPHA; mSwitchActions.requestUpdatingShiftState(currentAutoCapsState, currentRecapitalizeState); mSwitchActions.requestUpdatingShiftState(autoCapsFlags, recapitalizeMode); } private void setSymbolsKeyboard() { if (DEBUG_ACTION) { if (DEBUG_INTERNAL_ACTION) { Log.d(TAG, "setSymbolsKeyboard"); } mSwitchActions.setSymbolsKeyboard(); Loading @@ -318,7 +320,7 @@ public final class KeyboardState { } private void setSymbolsShiftedKeyboard() { if (DEBUG_ACTION) { if (DEBUG_INTERNAL_ACTION) { Log.d(TAG, "setSymbolsShiftedKeyboard"); } mSwitchActions.setSymbolsShiftedKeyboard(); Loading @@ -331,7 +333,7 @@ public final class KeyboardState { } private void setEmojiKeyboard() { if (DEBUG_ACTION) { if (DEBUG_INTERNAL_ACTION) { Log.d(TAG, "setEmojiKeyboard"); } mIsAlphabetMode = false; Loading @@ -343,11 +345,12 @@ public final class KeyboardState { mSwitchActions.setEmojiKeyboard(); } public void onPressKey(final int code, final boolean isSinglePointer, final int currentAutoCapsState, final int currentRecapitalizeState) { public void onPressKey(final int code, final boolean isSinglePointer, final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_EVENT) { Log.d(TAG, "onPressKey: code=" + Constants.printableCode(code) + " single=" + isSinglePointer + " autoCaps=" + currentAutoCapsState + " " + this); Log.d(TAG, "onPressKey: code=" + Constants.printableCode(code) + " single=" + isSinglePointer + " " + stateToString(autoCapsFlags, recapitalizeMode)); } if (code != Constants.CODE_SHIFT) { // Because the double tap shift key timer is to detect two consecutive shift key press, Loading @@ -359,7 +362,7 @@ public final class KeyboardState { } else if (code == Constants.CODE_CAPSLOCK) { // Nothing to do here. See {@link #onReleaseKey(int,boolean)}. } else if (code == Constants.CODE_SWITCH_ALPHA_SYMBOL) { onPressSymbol(currentAutoCapsState, currentRecapitalizeState); onPressSymbol(autoCapsFlags, recapitalizeMode); } else { mShiftKeyState.onOtherKeyPressed(); mSymbolKeyState.onOtherKeyPressed(); Loading @@ -372,7 +375,7 @@ public final class KeyboardState { // off because, for example, we may be in the #1 state within the manual temporary // shifted mode. if (!isSinglePointer && mIsAlphabetMode && currentAutoCapsState != TextUtils.CAP_MODE_CHARACTERS) { && autoCapsFlags != TextUtils.CAP_MODE_CHARACTERS) { final boolean needsToResetAutoCaps = mAlphabetShiftState.isAutomaticShifted() || (mAlphabetShiftState.isManualShifted() && mShiftKeyState.isReleasing()); if (needsToResetAutoCaps) { Loading @@ -382,34 +385,35 @@ public final class KeyboardState { } } public void onReleaseKey(final int code, final boolean withSliding, final int currentAutoCapsState, final int currentRecapitalizeState) { public void onReleaseKey(final int code, final boolean withSliding, final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_EVENT) { Log.d(TAG, "onReleaseKey: code=" + Constants.printableCode(code) + " sliding=" + withSliding + " " + this); + " sliding=" + withSliding + " " + stateToString(autoCapsFlags, recapitalizeMode)); } if (code == Constants.CODE_SHIFT) { onReleaseShift(withSliding, currentAutoCapsState, currentRecapitalizeState); onReleaseShift(withSliding, autoCapsFlags, recapitalizeMode); } else if (code == Constants.CODE_CAPSLOCK) { setShiftLocked(!mAlphabetShiftState.isShiftLocked()); } else if (code == Constants.CODE_SWITCH_ALPHA_SYMBOL) { onReleaseSymbol(withSliding, currentAutoCapsState, currentRecapitalizeState); onReleaseSymbol(withSliding, autoCapsFlags, recapitalizeMode); } } private void onPressSymbol(final int currentAutoCapsState, final int currentRecapitalizeState) { toggleAlphabetAndSymbols(currentAutoCapsState, currentRecapitalizeState); private void onPressSymbol(final int autoCapsFlags, final int recapitalizeMode) { toggleAlphabetAndSymbols(autoCapsFlags, recapitalizeMode); mSymbolKeyState.onPress(); mSwitchState = SWITCH_STATE_MOMENTARY_ALPHA_AND_SYMBOL; } private void onReleaseSymbol(final boolean withSliding, final int currentAutoCapsState, final int currentRecapitalizeState) { private void onReleaseSymbol(final boolean withSliding, final int autoCapsFlags, final int recapitalizeMode) { if (mSymbolKeyState.isChording()) { // Switch back to the previous keyboard mode if the user chords the mode change key and // another key, then releases the mode change key. toggleAlphabetAndSymbols(currentAutoCapsState, currentRecapitalizeState); toggleAlphabetAndSymbols(autoCapsFlags, recapitalizeMode); } else if (!withSliding) { // If the mode change key is being released without sliding, we should forget the // previous symbols keyboard shift state and simply switch back to symbols layout Loading @@ -419,23 +423,23 @@ public final class KeyboardState { mSymbolKeyState.onRelease(); } public void onUpdateShiftState(final int autoCaps, final int recapitalizeMode) { public void onUpdateShiftState(final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_EVENT) { Log.d(TAG, "onUpdateShiftState: autoCaps=" + autoCaps + ", recapitalizeMode=" + recapitalizeMode + " " + this); Log.d(TAG, "onUpdateShiftState: " + stateToString(autoCapsFlags, recapitalizeMode)); } mRecapitalizeMode = recapitalizeMode; updateAlphabetShiftState(autoCaps, recapitalizeMode); updateAlphabetShiftState(autoCapsFlags, recapitalizeMode); } // 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(final int currentAutoCapsState, final int currentRecapitalizeState) { public void onResetKeyboardStateToAlphabet(final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_EVENT) { Log.d(TAG, "onResetKeyboardStateToAlphabet: " + this); Log.d(TAG, "onResetKeyboardStateToAlphabet: " + stateToString(autoCapsFlags, recapitalizeMode)); } resetKeyboardStateToAlphabet(currentAutoCapsState, currentRecapitalizeState); resetKeyboardStateToAlphabet(autoCapsFlags, recapitalizeMode); } private void updateShiftStateForRecapitalize(final int recapitalizeMode) { Loading @@ -453,7 +457,7 @@ public final class KeyboardState { } } private void updateAlphabetShiftState(final int autoCaps, final int recapitalizeMode) { private void updateAlphabetShiftState(final int autoCapsFlags, final int recapitalizeMode) { if (!mIsAlphabetMode) return; if (RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE != recapitalizeMode) { // We are recapitalizing. Match the keyboard to the current recapitalize state. Loading @@ -466,7 +470,7 @@ public final class KeyboardState { return; } if (!mAlphabetShiftState.isShiftLocked() && !mShiftKeyState.isIgnoring()) { if (mShiftKeyState.isReleasing() && autoCaps != Constants.TextUtils.CAP_MODE_OFF) { if (mShiftKeyState.isReleasing() && autoCapsFlags != Constants.TextUtils.CAP_MODE_OFF) { // Only when shift key is releasing, automatic temporary upper case will be set. setShifted(AUTOMATIC_SHIFT); } else { Loading Loading @@ -526,8 +530,8 @@ public final class KeyboardState { } } private void onReleaseShift(final boolean withSliding, final int currentAutoCapsState, final int currentRecapitalizeState) { private void onReleaseShift(final boolean withSliding, final int autoCapsFlags, final int recapitalizeMode) { if (RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE != mRecapitalizeMode) { // We are recapitalizing. We should match the keyboard state to the recapitalize // state in priority. Loading @@ -550,8 +554,7 @@ public final class KeyboardState { // After chording input, automatic shift state may have been changed depending on // what characters were input. mShiftKeyState.onRelease(); mSwitchActions.requestUpdatingShiftState(currentAutoCapsState, currentRecapitalizeState); mSwitchActions.requestUpdatingShiftState(autoCapsFlags, recapitalizeMode); return; } else if (mAlphabetShiftState.isShiftLockShifted() && withSliding) { // In shift locked state, shift has been pressed and slid out to other key. Loading Loading @@ -588,21 +591,20 @@ public final class KeyboardState { mShiftKeyState.onRelease(); } public void onFinishSlidingInput(final int currentAutoCapsState, final int currentRecapitalizeState) { public void onFinishSlidingInput(final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_EVENT) { Log.d(TAG, "onFinishSlidingInput: " + this); Log.d(TAG, "onFinishSlidingInput: " + stateToString(autoCapsFlags, recapitalizeMode)); } // Switch back to the previous keyboard mode if the user cancels sliding input. switch (mSwitchState) { case SWITCH_STATE_MOMENTARY_ALPHA_AND_SYMBOL: toggleAlphabetAndSymbols(currentAutoCapsState, currentRecapitalizeState); toggleAlphabetAndSymbols(autoCapsFlags, recapitalizeMode); break; case SWITCH_STATE_MOMENTARY_SYMBOL_AND_MORE: toggleShiftInSymbols(); break; case SWITCH_STATE_MOMENTARY_ALPHA_SHIFT: setAlphabetKeyboard(currentAutoCapsState, currentRecapitalizeState); setAlphabetKeyboard(autoCapsFlags, recapitalizeMode); break; } } Loading @@ -611,12 +613,11 @@ public final class KeyboardState { return c == Constants.CODE_SPACE || c == Constants.CODE_ENTER; } public void onEvent(final Event event, final int currentAutoCapsState, final int currentRecapitalizeState) { public void onEvent(final Event event, final int autoCapsFlags, final int recapitalizeMode) { final int code = event.isFunctionalKeyEvent() ? event.mKeyCode : event.mCodePoint; if (DEBUG_EVENT) { Log.d(TAG, "onEvent: code=" + Constants.printableCode(code) + " autoCaps=" + currentAutoCapsState + " " + this); + " " + stateToString(autoCapsFlags, recapitalizeMode)); } switch (mSwitchState) { Loading Loading @@ -652,7 +653,7 @@ public final class KeyboardState { // Switch back to alpha keyboard mode if user types one or more non-space/enter // characters followed by a space/enter. if (isSpaceOrEnter(code)) { toggleAlphabetAndSymbols(currentAutoCapsState, currentRecapitalizeState); toggleAlphabetAndSymbols(autoCapsFlags, recapitalizeMode); mPrevSymbolsKeyboardWasShifted = false; } break; Loading @@ -660,11 +661,11 @@ public final class KeyboardState { // If the code is a letter, update keyboard shift state. if (Constants.isLetterCode(code)) { updateAlphabetShiftState(currentAutoCapsState, currentRecapitalizeState); updateAlphabetShiftState(autoCapsFlags, recapitalizeMode); } else if (code == Constants.CODE_EMOJI) { setEmojiKeyboard(); } else if (code == Constants.CODE_ALPHA_FROM_EMOJI) { setAlphabetKeyboard(currentAutoCapsState, currentRecapitalizeState); setAlphabetKeyboard(autoCapsFlags, recapitalizeMode); } } Loading Loading @@ -697,4 +698,9 @@ public final class KeyboardState { + " symbol=" + mSymbolKeyState + " switch=" + switchStateToString(mSwitchState) + "]"; } private String stateToString(final int autoCapsFlags, final int recapitalizeMode) { return this + " autoCapsFlags=" + CapsModeUtils.flagsToString(autoCapsFlags) + " recapitalizeMode=" + RecapitalizeStatus.modeToString(recapitalizeMode); } } Loading
java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +42 −3 Original line number Diff line number Diff line Loading @@ -39,6 +39,8 @@ import com.android.inputmethod.latin.WordComposer; import com.android.inputmethod.latin.define.ProductionFlags; import com.android.inputmethod.latin.settings.Settings; import com.android.inputmethod.latin.settings.SettingsValues; import com.android.inputmethod.latin.utils.CapsModeUtils; import com.android.inputmethod.latin.utils.RecapitalizeStatus; import com.android.inputmethod.latin.utils.ResourceUtils; import com.android.inputmethod.latin.utils.ScriptUtils; Loading Loading @@ -204,36 +206,54 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { // Implements {@link KeyboardState.SwitchActions}. @Override public void setAlphabetKeyboard() { if (DEBUG_ACTION) { Log.d(TAG, "setAlphabetKeyboard"); } setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET)); } // Implements {@link KeyboardState.SwitchActions}. @Override public void setAlphabetManualShiftedKeyboard() { if (DEBUG_ACTION) { Log.d(TAG, "setAlphabetManualShiftedKeyboard"); } setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED)); } // Implements {@link KeyboardState.SwitchActions}. @Override public void setAlphabetAutomaticShiftedKeyboard() { if (DEBUG_ACTION) { Log.d(TAG, "setAlphabetAutomaticShiftedKeyboard"); } setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED)); } // Implements {@link KeyboardState.SwitchActions}. @Override public void setAlphabetShiftLockedKeyboard() { if (DEBUG_ACTION) { Log.d(TAG, "setAlphabetShiftLockedKeyboard"); } setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED)); } // Implements {@link KeyboardState.SwitchActions}. @Override public void setAlphabetShiftLockShiftedKeyboard() { if (DEBUG_ACTION) { Log.d(TAG, "setAlphabetShiftLockShiftedKeyboard"); } setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED)); } // Implements {@link KeyboardState.SwitchActions}. @Override public void setSymbolsKeyboard() { if (DEBUG_ACTION) { Log.d(TAG, "setSymbolsKeyboard"); } setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_SYMBOLS)); } Loading @@ -247,6 +267,9 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { // Implements {@link KeyboardState.SwitchActions}. @Override public void setEmojiKeyboard() { if (DEBUG_ACTION) { Log.d(TAG, "setEmojiKeyboard"); } final Keyboard keyboard = mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_ALPHABET); mMainKeyboardFrame.setVisibility(View.GONE); mEmojiPalettesView.startEmojiPalettes( Loading @@ -269,19 +292,29 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { // Implements {@link KeyboardState.SwitchActions}. @Override public void setSymbolsShiftedKeyboard() { if (DEBUG_ACTION) { Log.d(TAG, "setSymbolsShiftedKeyboard"); } setKeyboard(mKeyboardLayoutSet.getKeyboard(KeyboardId.ELEMENT_SYMBOLS_SHIFTED)); } // Future method for requesting an updating to the shift state. @Override public void requestUpdatingShiftState(final int currentAutoCapsState, final int currentRecapitalizeState) { mState.onUpdateShiftState(currentAutoCapsState, currentRecapitalizeState); public void requestUpdatingShiftState(final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_ACTION) { Log.d(TAG, "requestUpdatingShiftState: " + " autoCapsFlags=" + CapsModeUtils.flagsToString(autoCapsFlags) + " recapitalizeMode=" + RecapitalizeStatus.modeToString(recapitalizeMode)); } mState.onUpdateShiftState(autoCapsFlags, recapitalizeMode); } // Implements {@link KeyboardState.SwitchActions}. @Override public void startDoubleTapShiftKeyTimer() { if (DEBUG_TIMER_ACTION) { Log.d(TAG, "startDoubleTapShiftKeyTimer"); } final MainKeyboardView keyboardView = getMainKeyboardView(); if (keyboardView != null) { keyboardView.startDoubleTapShiftKeyTimer(); Loading @@ -291,6 +324,9 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { // Implements {@link KeyboardState.SwitchActions}. @Override public void cancelDoubleTapShiftKeyTimer() { if (DEBUG_TIMER_ACTION) { Log.d(TAG, "setAlphabetKeyboard"); } final MainKeyboardView keyboardView = getMainKeyboardView(); if (keyboardView != null) { keyboardView.cancelDoubleTapShiftKeyTimer(); Loading @@ -300,6 +336,9 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { // Implements {@link KeyboardState.SwitchActions}. @Override public boolean isInDoubleTapShiftKeyTimeout() { if (DEBUG_TIMER_ACTION) { Log.d(TAG, "isInDoubleTapShiftKeyTimeout"); } final MainKeyboardView keyboardView = getMainKeyboardView(); return keyboardView != null && keyboardView.isInDoubleTapShiftKeyTimeout(); } Loading
java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java +79 −73 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.util.Log; import com.android.inputmethod.event.Event; import com.android.inputmethod.latin.common.Constants; import com.android.inputmethod.latin.utils.CapsModeUtils; import com.android.inputmethod.latin.utils.RecapitalizeStatus; /** Loading @@ -38,9 +39,11 @@ import com.android.inputmethod.latin.utils.RecapitalizeStatus; public final class KeyboardState { private static final String TAG = KeyboardState.class.getSimpleName(); private static final boolean DEBUG_EVENT = false; private static final boolean DEBUG_ACTION = false; private static final boolean DEBUG_INTERNAL_ACTION = false; public interface SwitchActions { public static final boolean DEBUG_ACTION = false; public void setAlphabetKeyboard(); public void setAlphabetManualShiftedKeyboard(); public void setAlphabetAutomaticShiftedKeyboard(); Loading @@ -53,8 +56,9 @@ public final class KeyboardState { /** * Request to call back {@link KeyboardState#onUpdateShiftState(int, int)}. */ public void requestUpdatingShiftState(final int currentAutoCapsState, final int currentRecapitalizeState); public void requestUpdatingShiftState(final int autoCapsFlags, final int recapitalizeMode); public static final boolean DEBUG_TIMER_ACTION = false; public void startDoubleTapShiftKeyTimer(); public boolean isInDoubleTapShiftKeyTimeout(); Loading Loading @@ -119,10 +123,9 @@ public final class KeyboardState { mRecapitalizeMode = RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE; } public void onLoadKeyboard(final int currentAutoCapsState, final int currentRecapitalizeState) { public void onLoadKeyboard(final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_EVENT) { Log.d(TAG, "onLoadKeyboard: " + this); Log.d(TAG, "onLoadKeyboard: " + stateToString(autoCapsFlags, recapitalizeMode)); } // Reset alphabet shift state. mAlphabetShiftState.setShiftLocked(false); Loading @@ -130,7 +133,7 @@ public final class KeyboardState { mPrevSymbolsKeyboardWasShifted = false; mShiftKeyState.onRelease(); mSymbolKeyState.onRelease(); onRestoreKeyboardState(currentAutoCapsState, currentRecapitalizeState); onRestoreKeyboardState(autoCapsFlags, recapitalizeMode); } private static final int UNSHIFT = 0; Loading @@ -156,14 +159,14 @@ public final class KeyboardState { } } private void onRestoreKeyboardState(final int currentAutoCapsState, final int currentRecapitalizeState) { private void onRestoreKeyboardState(final int autoCapsFlags, final int recapitalizeMode) { final SavedKeyboardState state = mSavedKeyboardState; if (DEBUG_EVENT) { Log.d(TAG, "onRestoreKeyboardState: saved=" + state + " " + this); Log.d(TAG, "onRestoreKeyboardState: saved=" + state + " " + stateToString(autoCapsFlags, recapitalizeMode)); } if (!state.mIsValid || state.mIsAlphabetMode) { setAlphabetKeyboard(currentAutoCapsState, currentRecapitalizeState); setAlphabetKeyboard(autoCapsFlags, recapitalizeMode); } else if (state.mIsEmojiMode) { setEmojiKeyboard(); } else { Loading @@ -188,7 +191,7 @@ public final class KeyboardState { } private void setShifted(final int shiftMode) { if (DEBUG_ACTION) { if (DEBUG_INTERNAL_ACTION) { Log.d(TAG, "setShifted: shiftMode=" + shiftModeToString(shiftMode) + " " + this); } if (!mIsAlphabetMode) return; Loading Loading @@ -227,7 +230,7 @@ public final class KeyboardState { } private void setShiftLocked(final boolean shiftLocked) { if (DEBUG_ACTION) { if (DEBUG_INTERNAL_ACTION) { Log.d(TAG, "setShiftLocked: shiftLocked=" + shiftLocked + " " + this); } if (!mIsAlphabetMode) return; Loading @@ -241,10 +244,10 @@ public final class KeyboardState { mAlphabetShiftState.setShiftLocked(shiftLocked); } private void toggleAlphabetAndSymbols(final int currentAutoCapsState, final int currentRecapitalizeState) { if (DEBUG_ACTION) { Log.d(TAG, "toggleAlphabetAndSymbols: " + this); private void toggleAlphabetAndSymbols(final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_INTERNAL_ACTION) { Log.d(TAG, "toggleAlphabetAndSymbols: " + stateToString(autoCapsFlags, recapitalizeMode)); } if (mIsAlphabetMode) { mPrevMainKeyboardWasShiftLocked = mAlphabetShiftState.isShiftLocked(); Loading @@ -256,7 +259,7 @@ public final class KeyboardState { mPrevSymbolsKeyboardWasShifted = false; } else { mPrevSymbolsKeyboardWasShifted = mIsSymbolShifted; setAlphabetKeyboard(currentAutoCapsState, currentRecapitalizeState); setAlphabetKeyboard(autoCapsFlags, recapitalizeMode); if (mPrevMainKeyboardWasShiftLocked) { setShiftLocked(true); } Loading @@ -266,15 +269,15 @@ 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(final int currentAutoCapsState, final int currentRecapitalizeState) { if (DEBUG_ACTION) { Log.d(TAG, "resetKeyboardStateToAlphabet: " + this); private void resetKeyboardStateToAlphabet(final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_INTERNAL_ACTION) { Log.d(TAG, "resetKeyboardStateToAlphabet: " + stateToString(autoCapsFlags, recapitalizeMode)); } if (mIsAlphabetMode) return; mPrevSymbolsKeyboardWasShifted = mIsSymbolShifted; setAlphabetKeyboard(currentAutoCapsState, currentRecapitalizeState); setAlphabetKeyboard(autoCapsFlags, recapitalizeMode); if (mPrevMainKeyboardWasShiftLocked) { setShiftLocked(true); } Loading @@ -289,10 +292,9 @@ public final class KeyboardState { } } private void setAlphabetKeyboard(final int currentAutoCapsState, final int currentRecapitalizeState) { if (DEBUG_ACTION) { Log.d(TAG, "setAlphabetKeyboard"); private void setAlphabetKeyboard(final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_INTERNAL_ACTION) { Log.d(TAG, "setAlphabetKeyboard: " + stateToString(autoCapsFlags, recapitalizeMode)); } mSwitchActions.setAlphabetKeyboard(); Loading @@ -301,11 +303,11 @@ public final class KeyboardState { mIsSymbolShifted = false; mRecapitalizeMode = RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE; mSwitchState = SWITCH_STATE_ALPHA; mSwitchActions.requestUpdatingShiftState(currentAutoCapsState, currentRecapitalizeState); mSwitchActions.requestUpdatingShiftState(autoCapsFlags, recapitalizeMode); } private void setSymbolsKeyboard() { if (DEBUG_ACTION) { if (DEBUG_INTERNAL_ACTION) { Log.d(TAG, "setSymbolsKeyboard"); } mSwitchActions.setSymbolsKeyboard(); Loading @@ -318,7 +320,7 @@ public final class KeyboardState { } private void setSymbolsShiftedKeyboard() { if (DEBUG_ACTION) { if (DEBUG_INTERNAL_ACTION) { Log.d(TAG, "setSymbolsShiftedKeyboard"); } mSwitchActions.setSymbolsShiftedKeyboard(); Loading @@ -331,7 +333,7 @@ public final class KeyboardState { } private void setEmojiKeyboard() { if (DEBUG_ACTION) { if (DEBUG_INTERNAL_ACTION) { Log.d(TAG, "setEmojiKeyboard"); } mIsAlphabetMode = false; Loading @@ -343,11 +345,12 @@ public final class KeyboardState { mSwitchActions.setEmojiKeyboard(); } public void onPressKey(final int code, final boolean isSinglePointer, final int currentAutoCapsState, final int currentRecapitalizeState) { public void onPressKey(final int code, final boolean isSinglePointer, final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_EVENT) { Log.d(TAG, "onPressKey: code=" + Constants.printableCode(code) + " single=" + isSinglePointer + " autoCaps=" + currentAutoCapsState + " " + this); Log.d(TAG, "onPressKey: code=" + Constants.printableCode(code) + " single=" + isSinglePointer + " " + stateToString(autoCapsFlags, recapitalizeMode)); } if (code != Constants.CODE_SHIFT) { // Because the double tap shift key timer is to detect two consecutive shift key press, Loading @@ -359,7 +362,7 @@ public final class KeyboardState { } else if (code == Constants.CODE_CAPSLOCK) { // Nothing to do here. See {@link #onReleaseKey(int,boolean)}. } else if (code == Constants.CODE_SWITCH_ALPHA_SYMBOL) { onPressSymbol(currentAutoCapsState, currentRecapitalizeState); onPressSymbol(autoCapsFlags, recapitalizeMode); } else { mShiftKeyState.onOtherKeyPressed(); mSymbolKeyState.onOtherKeyPressed(); Loading @@ -372,7 +375,7 @@ public final class KeyboardState { // off because, for example, we may be in the #1 state within the manual temporary // shifted mode. if (!isSinglePointer && mIsAlphabetMode && currentAutoCapsState != TextUtils.CAP_MODE_CHARACTERS) { && autoCapsFlags != TextUtils.CAP_MODE_CHARACTERS) { final boolean needsToResetAutoCaps = mAlphabetShiftState.isAutomaticShifted() || (mAlphabetShiftState.isManualShifted() && mShiftKeyState.isReleasing()); if (needsToResetAutoCaps) { Loading @@ -382,34 +385,35 @@ public final class KeyboardState { } } public void onReleaseKey(final int code, final boolean withSliding, final int currentAutoCapsState, final int currentRecapitalizeState) { public void onReleaseKey(final int code, final boolean withSliding, final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_EVENT) { Log.d(TAG, "onReleaseKey: code=" + Constants.printableCode(code) + " sliding=" + withSliding + " " + this); + " sliding=" + withSliding + " " + stateToString(autoCapsFlags, recapitalizeMode)); } if (code == Constants.CODE_SHIFT) { onReleaseShift(withSliding, currentAutoCapsState, currentRecapitalizeState); onReleaseShift(withSliding, autoCapsFlags, recapitalizeMode); } else if (code == Constants.CODE_CAPSLOCK) { setShiftLocked(!mAlphabetShiftState.isShiftLocked()); } else if (code == Constants.CODE_SWITCH_ALPHA_SYMBOL) { onReleaseSymbol(withSliding, currentAutoCapsState, currentRecapitalizeState); onReleaseSymbol(withSliding, autoCapsFlags, recapitalizeMode); } } private void onPressSymbol(final int currentAutoCapsState, final int currentRecapitalizeState) { toggleAlphabetAndSymbols(currentAutoCapsState, currentRecapitalizeState); private void onPressSymbol(final int autoCapsFlags, final int recapitalizeMode) { toggleAlphabetAndSymbols(autoCapsFlags, recapitalizeMode); mSymbolKeyState.onPress(); mSwitchState = SWITCH_STATE_MOMENTARY_ALPHA_AND_SYMBOL; } private void onReleaseSymbol(final boolean withSliding, final int currentAutoCapsState, final int currentRecapitalizeState) { private void onReleaseSymbol(final boolean withSliding, final int autoCapsFlags, final int recapitalizeMode) { if (mSymbolKeyState.isChording()) { // Switch back to the previous keyboard mode if the user chords the mode change key and // another key, then releases the mode change key. toggleAlphabetAndSymbols(currentAutoCapsState, currentRecapitalizeState); toggleAlphabetAndSymbols(autoCapsFlags, recapitalizeMode); } else if (!withSliding) { // If the mode change key is being released without sliding, we should forget the // previous symbols keyboard shift state and simply switch back to symbols layout Loading @@ -419,23 +423,23 @@ public final class KeyboardState { mSymbolKeyState.onRelease(); } public void onUpdateShiftState(final int autoCaps, final int recapitalizeMode) { public void onUpdateShiftState(final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_EVENT) { Log.d(TAG, "onUpdateShiftState: autoCaps=" + autoCaps + ", recapitalizeMode=" + recapitalizeMode + " " + this); Log.d(TAG, "onUpdateShiftState: " + stateToString(autoCapsFlags, recapitalizeMode)); } mRecapitalizeMode = recapitalizeMode; updateAlphabetShiftState(autoCaps, recapitalizeMode); updateAlphabetShiftState(autoCapsFlags, recapitalizeMode); } // 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(final int currentAutoCapsState, final int currentRecapitalizeState) { public void onResetKeyboardStateToAlphabet(final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_EVENT) { Log.d(TAG, "onResetKeyboardStateToAlphabet: " + this); Log.d(TAG, "onResetKeyboardStateToAlphabet: " + stateToString(autoCapsFlags, recapitalizeMode)); } resetKeyboardStateToAlphabet(currentAutoCapsState, currentRecapitalizeState); resetKeyboardStateToAlphabet(autoCapsFlags, recapitalizeMode); } private void updateShiftStateForRecapitalize(final int recapitalizeMode) { Loading @@ -453,7 +457,7 @@ public final class KeyboardState { } } private void updateAlphabetShiftState(final int autoCaps, final int recapitalizeMode) { private void updateAlphabetShiftState(final int autoCapsFlags, final int recapitalizeMode) { if (!mIsAlphabetMode) return; if (RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE != recapitalizeMode) { // We are recapitalizing. Match the keyboard to the current recapitalize state. Loading @@ -466,7 +470,7 @@ public final class KeyboardState { return; } if (!mAlphabetShiftState.isShiftLocked() && !mShiftKeyState.isIgnoring()) { if (mShiftKeyState.isReleasing() && autoCaps != Constants.TextUtils.CAP_MODE_OFF) { if (mShiftKeyState.isReleasing() && autoCapsFlags != Constants.TextUtils.CAP_MODE_OFF) { // Only when shift key is releasing, automatic temporary upper case will be set. setShifted(AUTOMATIC_SHIFT); } else { Loading Loading @@ -526,8 +530,8 @@ public final class KeyboardState { } } private void onReleaseShift(final boolean withSliding, final int currentAutoCapsState, final int currentRecapitalizeState) { private void onReleaseShift(final boolean withSliding, final int autoCapsFlags, final int recapitalizeMode) { if (RecapitalizeStatus.NOT_A_RECAPITALIZE_MODE != mRecapitalizeMode) { // We are recapitalizing. We should match the keyboard state to the recapitalize // state in priority. Loading @@ -550,8 +554,7 @@ public final class KeyboardState { // After chording input, automatic shift state may have been changed depending on // what characters were input. mShiftKeyState.onRelease(); mSwitchActions.requestUpdatingShiftState(currentAutoCapsState, currentRecapitalizeState); mSwitchActions.requestUpdatingShiftState(autoCapsFlags, recapitalizeMode); return; } else if (mAlphabetShiftState.isShiftLockShifted() && withSliding) { // In shift locked state, shift has been pressed and slid out to other key. Loading Loading @@ -588,21 +591,20 @@ public final class KeyboardState { mShiftKeyState.onRelease(); } public void onFinishSlidingInput(final int currentAutoCapsState, final int currentRecapitalizeState) { public void onFinishSlidingInput(final int autoCapsFlags, final int recapitalizeMode) { if (DEBUG_EVENT) { Log.d(TAG, "onFinishSlidingInput: " + this); Log.d(TAG, "onFinishSlidingInput: " + stateToString(autoCapsFlags, recapitalizeMode)); } // Switch back to the previous keyboard mode if the user cancels sliding input. switch (mSwitchState) { case SWITCH_STATE_MOMENTARY_ALPHA_AND_SYMBOL: toggleAlphabetAndSymbols(currentAutoCapsState, currentRecapitalizeState); toggleAlphabetAndSymbols(autoCapsFlags, recapitalizeMode); break; case SWITCH_STATE_MOMENTARY_SYMBOL_AND_MORE: toggleShiftInSymbols(); break; case SWITCH_STATE_MOMENTARY_ALPHA_SHIFT: setAlphabetKeyboard(currentAutoCapsState, currentRecapitalizeState); setAlphabetKeyboard(autoCapsFlags, recapitalizeMode); break; } } Loading @@ -611,12 +613,11 @@ public final class KeyboardState { return c == Constants.CODE_SPACE || c == Constants.CODE_ENTER; } public void onEvent(final Event event, final int currentAutoCapsState, final int currentRecapitalizeState) { public void onEvent(final Event event, final int autoCapsFlags, final int recapitalizeMode) { final int code = event.isFunctionalKeyEvent() ? event.mKeyCode : event.mCodePoint; if (DEBUG_EVENT) { Log.d(TAG, "onEvent: code=" + Constants.printableCode(code) + " autoCaps=" + currentAutoCapsState + " " + this); + " " + stateToString(autoCapsFlags, recapitalizeMode)); } switch (mSwitchState) { Loading Loading @@ -652,7 +653,7 @@ public final class KeyboardState { // Switch back to alpha keyboard mode if user types one or more non-space/enter // characters followed by a space/enter. if (isSpaceOrEnter(code)) { toggleAlphabetAndSymbols(currentAutoCapsState, currentRecapitalizeState); toggleAlphabetAndSymbols(autoCapsFlags, recapitalizeMode); mPrevSymbolsKeyboardWasShifted = false; } break; Loading @@ -660,11 +661,11 @@ public final class KeyboardState { // If the code is a letter, update keyboard shift state. if (Constants.isLetterCode(code)) { updateAlphabetShiftState(currentAutoCapsState, currentRecapitalizeState); updateAlphabetShiftState(autoCapsFlags, recapitalizeMode); } else if (code == Constants.CODE_EMOJI) { setEmojiKeyboard(); } else if (code == Constants.CODE_ALPHA_FROM_EMOJI) { setAlphabetKeyboard(currentAutoCapsState, currentRecapitalizeState); setAlphabetKeyboard(autoCapsFlags, recapitalizeMode); } } Loading Loading @@ -697,4 +698,9 @@ public final class KeyboardState { + " symbol=" + mSymbolKeyState + " switch=" + switchStateToString(mSwitchState) + "]"; } private String stateToString(final int autoCapsFlags, final int recapitalizeMode) { return this + " autoCapsFlags=" + CapsModeUtils.flagsToString(autoCapsFlags) + " recapitalizeMode=" + RecapitalizeStatus.modeToString(recapitalizeMode); } }