コード例 #1
0
ファイル: SoftKeyboard.java プロジェクト: TroyDL/SoftKeyboard
 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
ファイル: SoftKeyboard.java プロジェクト: TroyDL/SoftKeyboard
  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);
    }
  }