private void setKeyboardMode(int mode, int imeOptions, boolean isSymbols) { if (mInputView == null) return; mMode = mode; mImeOptions = imeOptions; mIsSymbols = isSymbols; mInputView.setTextSizeScale(mInputMethodService.getKeyTextSizeScale()); mInputView.setPreviewEnabled(mInputMethodService.getPopupOn()); KeyboardId id = getKeyboardId(mode, imeOptions, isSymbols); SoftKeyboard keyboard = null; keyboard = getKeyboard(id); mCurrentId = id; mInputView.setKeyboard(keyboard); keyboard.setShifted(false); keyboard.setShiftLocked(keyboard.isShiftLocked()); keyboard.setImeOptions(mInputMethodService.getResources(), mMode, imeOptions); keyboard.setColorOfSymbolIcons( mIsAutoCompletionActive, mInputView.getLanguagebarTextColor(), mInputView.getLanguagebarShadowColor()); // Update the settings key state because number of enabled IMEs could have been changed updateSettingsKeyState(PreferenceManager.getDefaultSharedPreferences(mInputMethodService)); updateLanguageKeyState(PreferenceManager.getDefaultSharedPreferences(mInputMethodService)); }
public void toggleShift() { if (isAlphabetMode()) return; if (mCurrentId.equals(mSymbolsId) || !mCurrentId.equals(mSymbolsShiftedId)) { SoftKeyboard symbolsShiftedKeyboard = getKeyboard(mSymbolsShiftedId); mCurrentId = mSymbolsShiftedId; mInputView.setKeyboard(symbolsShiftedKeyboard); // Symbol shifted keyboard has an ALT key that has a caps lock style indicator. To // enable the indicator, we need to call enableShiftLock() and setShiftLocked(true). // Thus we can keep the ALT key's Key.on value true while LatinKey.onRelease() is // called. symbolsShiftedKeyboard.enableShiftLock(); symbolsShiftedKeyboard.setShiftLocked(true); symbolsShiftedKeyboard.setImeOptions(mInputMethodService.getResources(), mMode, mImeOptions); } else { SoftKeyboard symbolsKeyboard = getKeyboard(mSymbolsId); mCurrentId = mSymbolsId; mInputView.setKeyboard(symbolsKeyboard); // Symbol keyboard has an ALT key that has a caps lock style indicator. To disable the // indicator, we need to call enableShiftLock() and setShiftLocked(false). symbolsKeyboard.enableShiftLock(); symbolsKeyboard.setShifted(false); symbolsKeyboard.setImeOptions(mInputMethodService.getResources(), mMode, mImeOptions); } }