예제 #1
0
 private void handleCharacter(int primaryCode, int[] keyCodes) {
   if (isInputViewShown()) {
     if (mInputView.isShifted()) {
       primaryCode = Character.toUpperCase(primaryCode);
     }
   }
   if (isAlphabet(primaryCode) && mPredictionOn) {
     mComposing.append((char) primaryCode);
     getCurrentInputConnection().setComposingText(mComposing, 1);
     updateShiftKeyState(getCurrentInputEditorInfo());
     updateCandidates();
   } else {
     getCurrentInputConnection().commitText(String.valueOf((char) primaryCode), 1);
   }
 }
예제 #2
0
  private void handleShift() {
    if (mInputView == null) {
      return;
    }

    Keyboard currentKeyboard = mInputView.getKeyboard();
    if (mQwertyKeyboard == currentKeyboard) {
      // Alphabet keyboard
      checkToggleCapsLock();
      mInputView.setShifted(mCapsLock || !mInputView.isShifted());
    } else if (currentKeyboard == mSymbolsKeyboard) {
      mSymbolsKeyboard.setShifted(true);
      mInputView.setKeyboard(mSymbolsShiftedKeyboard);
      mSymbolsShiftedKeyboard.setShifted(true);
    } else if (currentKeyboard == mSymbolsShiftedKeyboard) {
      mSymbolsShiftedKeyboard.setShifted(false);
      mInputView.setKeyboard(mSymbolsKeyboard);
      mSymbolsKeyboard.setShifted(false);
    }
  }