當前位置: 首頁>>代碼示例>>Java>>正文


Java Keyboard.KEYCODE_MODE_CHANGE屬性代碼示例

本文整理匯總了Java中android.inputmethodservice.Keyboard.KEYCODE_MODE_CHANGE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Keyboard.KEYCODE_MODE_CHANGE屬性的具體用法?Java Keyboard.KEYCODE_MODE_CHANGE怎麽用?Java Keyboard.KEYCODE_MODE_CHANGE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.inputmethodservice.Keyboard的用法示例。


在下文中一共展示了Keyboard.KEYCODE_MODE_CHANGE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onPress

public void onPress(int primaryCode) {
    if (mKeyboardSwitcher.isVibrateAndSoundFeedbackRequired()) {
        vibrate();
        playKeyClick(primaryCode);
    }
    final boolean distinctMultiTouch = mKeyboardSwitcher.hasDistinctMultitouch();
    if (distinctMultiTouch && primaryCode == Keyboard.KEYCODE_SHIFT) {
        mShiftKeyState.onPress();
        handleShift();
    } else if (distinctMultiTouch && primaryCode == Keyboard.KEYCODE_MODE_CHANGE) {
        changeKeyboardMode();
        mSymbolKeyState.onPress();
        mKeyboardSwitcher.setAutoModeSwitchStateMomentary();
    } else {
        mShiftKeyState.onOtherKeyPressed();
        mSymbolKeyState.onOtherKeyPressed();
    }
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:18,代碼來源:KP2AKeyboard.java

示例2: onRelease

public void onRelease(int primaryCode) {
    // Reset any drag flags in the keyboard
    ((LatinKeyboard) mKeyboardSwitcher.getInputView().getKeyboard()).keyReleased();
    //vibrate();
    final boolean distinctMultiTouch = mKeyboardSwitcher.hasDistinctMultitouch();
    if (distinctMultiTouch && primaryCode == Keyboard.KEYCODE_SHIFT) {
        if (mShiftKeyState.isMomentary())
            resetShift();
        mShiftKeyState.onRelease();
    } else if (distinctMultiTouch && primaryCode == Keyboard.KEYCODE_MODE_CHANGE) {
        // Snap back to the previous keyboard mode if the user chords the mode change key and
        // other key, then released the mode change key.
        if (mKeyboardSwitcher.isInChordingAutoModeSwitchState())
            changeKeyboardMode();
        mSymbolKeyState.onRelease();
    }
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:17,代碼來源:KP2AKeyboard.java

示例3: createKeyFromXml

@Override
protected Key createKeyFromXml(Resources res, Row parent, int x, int y,
                               XmlResourceParser parser) {
    Key key = new LatinKey(res, parent, x, y, parser);
    if (key.codes[0] == 10) {
        mEnterKey = key;
    } else if (key.codes[0] == ' ') {
        mSpaceKey = key;
    } else if (key.codes[0] == Keyboard.KEYCODE_MODE_CHANGE) {
        mModeChangeKey = key;
        mSavedModeChangeKey = new LatinKey(res, parent, x, y, parser);
    } else if (key.codes[0] == LatinKeyboard.KEYCODE_LAYUOUT_SWITCH) {
        mLanguageSwitchKey = key;
        mSavedLanguageSwitchKey = new LatinKey(res, parent, x, y, parser);
    }
    return key;
}
 
開發者ID:VladThodo,項目名稱:behe-keyboard,代碼行數:17,代碼來源:LatinKeyboard.java

示例4: onKey

@Override
public void onKey(int primaryCode, int[] ints) {
    Editable editable = getText();
    int start = getSelectionStart();

    switch (primaryCode) {
        case Keyboard.KEYCODE_MODE_CHANGE:// 英文鍵盤與數字鍵盤切換-2
            shiftKeyboard();
            break;
        case Keyboard.KEYCODE_DELETE:// 回退-5
            if (editable != null && editable.length() > 0 && start > 0) {
                editable.delete(start - 1, start);
            }
            break;
        case Keyboard.KEYCODE_SHIFT:// 英文大小寫切換-1
            shiftEnglish();
            keyboardView.setKeyboard(keyboardEnglish);
            break;
        case Keyboard.KEYCODE_DONE:// 完成-4
            break;

        default:
            editable.insert(start, Character.toString((char) primaryCode));
            break;
    }
}
 
開發者ID:GitPhoenix,項目名稱:KeyboardView,代碼行數:26,代碼來源:EditView.java

示例5: createKeyFromXml

@Override
protected Key createKeyFromXml(Resources res, Row parent, int x, int y, 
        XmlResourceParser parser) {
    Key key = new LatinKey(res, parent, x, y, parser);
    if (key.codes[0] == 10) {
        mEnterKey = key;
    } else if (key.codes[0] == ' ') {
        mSpaceKey = key;
        mSavedSpaceKey = new LatinKey(res, parent, x, y, parser);
    } else if (key.codes[0] == Keyboard.KEYCODE_MODE_CHANGE) {
        mModeChangeKey = key;
        mSavedModeChangeKey = new LatinKey(res, parent, x, y, parser);
    } else if (key.codes[0] == LatinKeyboardView.KEYCODE_LANGUAGE_SWITCH) {
        mLanguageSwitchKey = key;
        mSavedLanguageSwitchKey = new LatinKey(res, parent, x, y, parser);
    } else if (key.codes[0] == Keyboard.KEYCODE_CANCEL) {
        mCancelKey = key;
        mSavedCancelKey = new LatinKey(res, parent, x, y, parser);
    } else if (key.codes[0] == 44) { // comma
        mCommaKey = key;
        mSavedCommaKey = new LatinKey(res, parent, x, y, parser);
    }
    return key;
}
 
開發者ID:accentype,項目名稱:accentype-android,代碼行數:24,代碼來源:LatinKeyboard.java

示例6: onKey

public void onKey(int primaryCode, int[] keyCodes) {
    if (primaryCode == Keyboard.KEYCODE_DELETE) {
        handleBackspace();
    } else if (primaryCode == Keyboard.KEYCODE_SHIFT) {
        handleShift();
    } else if (primaryCode == Keyboard.KEYCODE_CANCEL) {
        handleClose();
        return;
    } else if (primaryCode == Keyboard.KEYCODE_MODE_CHANGE) {
        handleModeChange();
    } else if (primaryCode == EntryKeyboard.KEYCODE_ENTER) {
        handleEnter();
    } else {
        handleCharacter(primaryCode, keyCodes);
        // Switch back to old keyboard if we're not in capslock mode
        if (mKeyboardState == KEYBOARD_STATE_SHIFTED) {
            // skip to the unlocked state
            mKeyboardState = KEYBOARD_STATE_CAPSLOCK;
            handleShift();
        }
    }
}
 
開發者ID:bither,項目名稱:bither-android,代碼行數:22,代碼來源:EntryKeyboardView.java

示例7: isModifierInternal

private boolean isModifierInternal(int keyIndex) {
    Key key = getKey(keyIndex);
    if (key == null)
        return false;
    int primaryCode = key.codes[0];
    return primaryCode == Keyboard.KEYCODE_SHIFT
            || primaryCode == Keyboard.KEYCODE_MODE_CHANGE;
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:8,代碼來源:PointerTracker.java

示例8: onKey

@Override
        public void onKey(int primaryCode, int[] keyCodes) {
            Editable editable = mEditText.getText();
            int start = mEditText.getSelectionStart();
            if (primaryCode == Keyboard.KEYCODE_CANCEL) { // cancel
                hideKeyboard();
            } else if (primaryCode == Keyboard.KEYCODE_DELETE) { // 回退
                if (editable != null && editable.length() > 0) {
                    if (start > 0) {
                        editable.delete(start - 1, start);
                    }
                }
            } else if (primaryCode == Keyboard.KEYCODE_SHIFT) { // 大小寫切換
//                changeKeyboart();
//                mKeyboardView.setKeyboard(mLetterKeyboard);

            } else if (primaryCode == Keyboard.KEYCODE_MODE_CHANGE) { // 數字與字母鍵盤互換
//                if (isNumber) {
//                    isNumber = false;
//                    mKeyboardView.setKeyboard(mLetterKeyboard);
//                } else {
//                    isNumber = true;
                    mKeyboardView.setKeyboard(mNumberKeyboard);
//                }

            } else if (primaryCode == 57419) { // 左移
                if (start > 0) {
                    mEditText.setSelection(start - 1);
                }

            } else if (primaryCode == 57419) { // 右移
                if (start > mEditText.length()) {
                    mEditText.setSelection(start + 1);
                }
            } else { // 輸入鍵盤值
                editable.insert(start, Character.toString((char) primaryCode));
            }
        }
 
開發者ID:wuhighway,項目名稱:DailyStudy,代碼行數:38,代碼來源:KeyboardUtil.java

示例9: onKey

@Override
public void onKey(int primaryCode, int[] ints) {
    Log.d(TAG, "onKey " + primaryCode);
    InputConnection ic = getCurrentInputConnection();
    playClick(primaryCode);

    switch (primaryCode) {
        case Keyboard.KEYCODE_DELETE:
            ic.deleteSurroundingText(1, 0);
            break;
        case Keyboard.KEYCODE_SHIFT:
            handleShift();
            break;
        case Keyboard.KEYCODE_DONE:
            ic.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
            break;
        case Keyboard.KEYCODE_ALT:
            handleSymbolsSwitch();
            break;
        case Keyboard.KEYCODE_MODE_CHANGE:
            handleLanguageSwitch();
            break;
        default:
            char code = (char) primaryCode;
            if (Character.isLetter(code) && isCapsOn) {
                code = Character.toUpperCase(code);
            }

            ic.commitText(String.valueOf(code), 1);
            break;
    }
}
 
開發者ID:Medeuz,項目名稱:CustomAndroidKeyboard,代碼行數:32,代碼來源:SimpleIME.java

示例10: onKey

public void onKey(int primaryCode, int[] keyCodes) {
    if (isWordSeparator(primaryCode)) {
        // Handle separator. DCH: removed the space ' ' 0x0020
        commitTyped(getCurrentInputConnection());
        sendKey(primaryCode);
    } else if (primaryCode == Keyboard.KEYCODE_DELETE) {
        handleBackspace();
    } else if (primaryCode == Keyboard.KEYCODE_SHIFT) {
        handleShift();
    } else if (primaryCode == Keyboard.KEYCODE_CANCEL) {
        handleClose();
    } else if (primaryCode == ArabicKeyboardView.KEYCODE_LANGUAGE_SWITCH) {
        handleLanguageSwitch();
    } else if (primaryCode == ArabicKeyboardView.KEYCODE_OPTIONS) {
        showOptionsMenu();
    } else if (primaryCode == Keyboard.KEYCODE_MODE_CHANGE
            && mInputView != null) {
        Keyboard current = mInputView.getKeyboard();
        if (current == mSymbolsKeyboard || current == mSymbolsShiftedKeyboard) {
            setArabicKeyboard(mArabicKeyboard);
        } else {
            setArabicKeyboard(mSymbolsKeyboard);
            mSymbolsKeyboard.setShifted(false);
        }
    } else {
        handleCharacter(primaryCode);
    }
}
 
開發者ID:cdjalel,項目名稱:QuranKeyboard,代碼行數:28,代碼來源:QuranKeyboardIME.java

示例11: onKey

@Override
    public void onKey(int primaryCode, int[] keyCodes) {
        InputConnection ic = getCurrentInputConnection();
        switch(primaryCode){
            case PuffKeyboardView.KEYCODE_EDIT :
                Intent intent = new Intent(this, DialogAcctList.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_CLEAR_TASK);
                getApplicationContext().startActivity(intent);
                stopSelf();
                break;
            case -11 :
                ic.commitText(account, 1);
                account = "";
                break;
            case -12:
                ic.commitText(password, 1);
                password = "";
                break;
            case -13:
                ic.commitText(additional, 1);
                additional = "";
                break;
            case Keyboard.KEYCODE_DONE:
                ic.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
                break;
            case Keyboard.KEYCODE_DELETE:
                ic.deleteSurroundingText(1, 0);
                break;
            case Keyboard.KEYCODE_MODE_CHANGE:
                if(kv.getKeyboard() == symbolKeyboard || kv.getKeyboard() == symsftKeyboard) {
                    currentKeyboard = normalKeyboard;
                } else {
                    currentKeyboard = symbolKeyboard;
                }
                kv.setKeyboard(currentKeyboard);
                break;
            case Keyboard.KEYCODE_SHIFT:
//                if (kv.getKeyboard() == normalKeyboard) {
//                    caps = !caps;
//                    normalKeyboard.setShifted(caps);
//                    kv.invalidateAllKeys();
//                }
                if(currentKeyboard == shiftKeyboard) {
                    currentKeyboard = normalKeyboard;
                } else {
                    currentKeyboard = shiftKeyboard;
                }
                kv.setKeyboard(currentKeyboard);
                break;
            case Keyboard.KEYCODE_ALT:
                if (kv.getKeyboard() == symbolKeyboard) {
                    currentKeyboard = symsftKeyboard;
                } else {
                    currentKeyboard = symbolKeyboard;
                }
                kv.setKeyboard(currentKeyboard);
                break;
            case -886 :
                Toast.makeText(IMEService.this, "close", Toast.LENGTH_SHORT).show();
                break ;
            default:
                char code = (char)primaryCode;
                if (caps) {
                    code = Character.toUpperCase(code);
                }
                ic.commitText(String.valueOf(code),1);
                break;
        }

        VibrateUtil.getStaticInstance(this).tick();
    }
 
開發者ID:PuffOpenSource,項目名稱:Puff-Android,代碼行數:71,代碼來源:IMEService.java

示例12: onKey

public void onKey(int primaryCode, int[] keyCodes) {
    long when = SystemClock.uptimeMillis();
    boolean mIsQuickPress = when < mLastKeyTime + QUICK_PRESS;
    if (primaryCode != Keyboard.KEYCODE_DELETE || !mIsQuickPress) {
        mDeleteCount = 0;
    }
    mLastKeyTime = when;
    InputConnection ic = getCurrentInputConnection();
    if (isWordSeparator(primaryCode)) {
        // Handle separator
        if (mComposing.length() > 0) {
            commitTyped(ic);
        }
        sendKey(primaryCode);
        if (mJustEnteredAutoSpace) {
            swapPunctuationAndSpace();
        }
        updateShiftKeyState(getCurrentInputEditorInfo());
    } else if (primaryCode == Keyboard.KEYCODE_DELETE) {
        handleBackspace();
        mDeleteCount++;
    } else if (primaryCode == Keyboard.KEYCODE_SHIFT) {
        handleShift();
    } else if (primaryCode == Keyboard.KEYCODE_CANCEL) {
        handleClose();
        return;
    } else if (primaryCode == LatinKeyboardView.KEYCODE_OPTIONS) {
        showChooseLexiconDialog();
        // Show a menu or somethin'
    } else if (primaryCode == Keyboard.KEYCODE_MODE_CHANGE
            && mInputView != null) {
        Keyboard current = mInputView.getKeyboard();
        if (current == mSymbolsKeyboard || current == mSymbolsShiftedKeyboard) {
            current = mQwertyKeyboard;
        } else {
            current = mSymbolsKeyboard;
        }
        mInputView.setKeyboard(current);
        if (current == mSymbolsKeyboard) {
            current.setShifted(false);
        }
    } else {
        mJustEnteredAutoSpace = false;
        handleCharacter(primaryCode, keyCodes);
    }
}
 
開發者ID:divec,項目名稱:literatim,代碼行數:46,代碼來源:SoftKeyboard.java

示例13: onKey

@Override
public void onKey(int primaryCode, int[] keyCodes) {
    if (primaryCode == Keyboard.KEYCODE_DELETE) {
        keyDownUp(KeyEvent.KEYCODE_DEL);
    } else if (primaryCode == Keyboard.KEYCODE_SHIFT) {
        mInputView.setShifted(!mInputView.isShifted());
    } else if (primaryCode == Keyboard.KEYCODE_CANCEL) {
        requestHideSelf(0);
        mInputView.closing();
    } else if (primaryCode == Keyboard.KEYCODE_MODE_CHANGE
            && mInputView != null) {
        Keyboard current = mInputView.getKeyboard();
        if (current == mSymbolKeyboard) {
            current = mQwertyKeyboard;
        } else {
            current = mSymbolKeyboard;
        }
        mInputView.setKeyboard(current);
    } else {
        if (isInputViewShown()) {
            if (mInputView.isShifted()) {
                primaryCode = Character.toUpperCase(primaryCode);
            }
        }
        getCurrentInputConnection().commitText(
                String.valueOf((char) primaryCode), 1);
    }
}
 
開發者ID:singwhatiwanna,項目名稱:TinyIme,代碼行數:28,代碼來源:ImeService.java

示例14: onKey

@Override
public void onKey(int primaryCode, int[] keyCodes) {
    Editable editable = ed.getText();
    int start = ed.getSelectionStart();
    if (primaryCode == Keyboard.KEYCODE_CANCEL) {// 完成
        hideKeyboard();
    } else if (primaryCode == Keyboard.KEYCODE_DELETE) {// 回退
        if (editable != null && editable.length() > 0) {
            if (start > 0) {
                editable.delete(start - 1, start);
            }
        }
    } else if (primaryCode == Keyboard.KEYCODE_SHIFT) {// 大小寫切換
        changeKey();
        mKeyboardView.setKeyboard(k1);

    } else if (primaryCode == Keyboard.KEYCODE_MODE_CHANGE) {// 數字鍵盤切換
        if (isNun) {
            isNun = false;
            mKeyboardView.setKeyboard(k1);
        } else {
            isNun = true;
            mKeyboardView.setKeyboard(k2);
        }
    } else if (primaryCode == 57419) { // go left
        if (start > 0) {
            ed.setSelection(start - 1);
        }
    } else if (primaryCode == 57421) { // go right
        if (start < ed.length()) {
            ed.setSelection(start + 1);
        }
    } else {
        editable.insert(start, Character.toString((char) primaryCode));
    }
}
 
開發者ID:tangqifa,項目名稱:AndroidSecurityKeyboard,代碼行數:36,代碼來源:SecKeyboardView.java

示例15: onKey

public void onKey(int primaryCode, int[] keyCodes) {
    if (isWordSeparator(primaryCode)) {
        // Handle separator
        if (mComposing.length() > 0) {
            commitTyped(getCurrentInputConnection());
        }
        sendKey(primaryCode);
        updateShiftKeyState(getCurrentInputEditorInfo());
    } else if (primaryCode == Keyboard.KEYCODE_DELETE) {
        handleBackspace();
    } else if (primaryCode == Keyboard.KEYCODE_SHIFT) {
        handleShift();
    } else if (primaryCode == Keyboard.KEYCODE_CANCEL) {
        handleClose();
        return;
    } else if (primaryCode == LatinKeyboardView.KEYCODE_OPTIONS) {
        // Show a menu or somethin'
    } else if (primaryCode == Keyboard.KEYCODE_MODE_CHANGE
            && mInputView != null) {
        Keyboard current = mInputView.getKeyboard();
        if (current == mSymbolsKeyboard || current == mSymbolsShiftedKeyboard) {
            current = mEmoticonsKeyboard;
        } else if (current == mQwertyKeyboard) {
            current = mSymbolsKeyboard;
        }
        else
        {
        	current = mQwertyKeyboard;
        }
        mInputView.setKeyboard(current);
        if (current == mSymbolsKeyboard) {
            current.setShifted(false);
        }
    } else {
        handleCharacter(primaryCode, keyCodes);
    }
}
 
開發者ID:dioh,項目名稱:animal,代碼行數:37,代碼來源:AnimalKeyboard.java


注:本文中的android.inputmethodservice.Keyboard.KEYCODE_MODE_CHANGE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。