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


Java Keyboard.KEYCODE_CANCEL屬性代碼示例

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


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

示例1: onLongPress

@Override
protected boolean onLongPress(Key key) {
    if (key.codes[0] == Keyboard.KEYCODE_CANCEL) {
        getOnKeyboardActionListener().onKey(LatinKeyboard.KEYCODE_OPTIONS, null);
        return true;
    }
    if(key.codes[0] == -113) {
        Variables.setCtrlOn();
        draw(new Canvas());
        return true;
    }
    if(key.codes[0] == -114) {
        Variables.setAltOn();
        draw(new Canvas());
        return true;
    }

    return super.onLongPress(key);
}
 
開發者ID:VladThodo,項目名稱:behe-keyboard,代碼行數:19,代碼來源:CustomKeyboard.java

示例2: onKey

@Override
public void onKey(int primaryCode, int[] keyCodes) {
	Log.d("keydemo", "--------onkey-->" + primaryCode);
	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 (onDelKeyEventListener != null) {
				onDelKeyEventListener.onDeleteClick();
			}
		}
	} 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:luoxianli,項目名稱:GridPassword,代碼行數:25,代碼來源:CustomBoardEditText.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;
        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

示例4: onLongPress

@Override
protected boolean onLongPress(Key key) {
    if (key.codes[0] == Keyboard.KEYCODE_CANCEL) {
        getOnKeyboardActionListener().onKey(KEYCODE_OPTIONS, null);
        return true;
    } else if (key.codes[0] == KEYCODE_LANGUAGE_SWITCH) {
        getOnKeyboardActionListener().onKey(KEYCODE_INPUT_METHOD_SWITCH, null);
        return true;
    } else if (key.codes[0] == Keyboard.KEYCODE_DELETE) {
        // turn off server predictions during long pressing backspace key
        mLastPredictionEnabled = ((SoftKeyboard)getOnKeyboardActionListener()).turnOffPredictionsIfNeeded();
        mLongPressedDelete = true;
        return false;
    } else {
        return super.onLongPress(key);
    }
}
 
開發者ID:accentype,項目名稱:accentype-android,代碼行數:17,代碼來源:LatinKeyboardView.java

示例5: onKey

@Override
public void onKey(int primaryCode, int[] keyCodes) {
    EditText editText = getEditTextByTag();
    if (editText == null) return;

    Editable editable = editText.getText();
    int start = editText.getSelectionStart();
    int end = editText.getSelectionEnd();
    if (primaryCode == Keyboard.KEYCODE_CANCEL) {// 完成
        hideKeyboard(editText);
    } else if (primaryCode == Keyboard.KEYCODE_DELETE) {// 回退
        start = start == end ? start - 1 : start;
        if (!TextUtils.isEmpty(editable)) {
            if (start >= 0 && end <= editable.length()) {
                editable.delete(start, end);
            }
        }
    } else {
        editable.insert(start, Character.toString((char) primaryCode));
    }
}
 
開發者ID:beilly,項目名稱:randomkeyboard,代碼行數:21,代碼來源:KeyboardHelper.java

示例6: onKey

@Override
public void onKey(int primaryCode, int[] keyCodes) {
	InputConnection inputConnection = getCurrentInputConnection();
	playClick(primaryCode);
	switch (primaryCode) {
		case Keyboard.KEYCODE_DELETE:
			inputConnection.deleteSurroundingText(1, 0);
			break;
           case Keyboard.KEYCODE_DONE:
               inputConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
               break;
           case Keyboard.KEYCODE_CANCEL:
               deleteWord(inputConnection);
               break;
           default:
               String randomWord = randomWords.getRandomWord();
               randomWord += " ";
               inputConnection.commitText(randomWord, randomWord.length() + 1);
	}
}
 
開發者ID:makiftasova,項目名稱:random-keyboard,代碼行數:20,代碼來源:RandomIME.java

示例7: 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

示例8: onKey

public void onKey(int primaryCode, int[] keyCodes) {
    this.wordProcessor.getChinesePhraseDictLinkedHashMap("(");
    if (imeSwitch.handleKey(primaryCode)) {
        this.strokereset();
        this.inputView.setKeyboard(imeSwitch.getCurrentKeyboard());
        return;
    }
    if (primaryCode == Keyboard.KEYCODE_CANCEL) {
        this.handleClose();
        return;
    }
    if (primaryCode == Keyboard.KEYCODE_DELETE) {
        this.handleBackspace();
        return;
    }
    if (primaryCode == IMEKeyboard.KEYCODE_ENTER) {
        this.handleEnter();
    }
    if (primaryCode == Keyboard.KEYCODE_DONE) {
        return;
    }
    this.handleKey(primaryCode, keyCodes);
}
 
開發者ID:wanleung,項目名稱:ChangjieIME,代碼行數:23,代碼來源:ChangjieIME.java

示例9: 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

示例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: onLongPress

@Override
protected boolean onLongPress(Key key) {
    if (key.codes[0] == Keyboard.KEYCODE_CANCEL) {
        getOnKeyboardActionListener().onKey(KEYCODE_OPTIONS, null);
        return true;
    } else {
        return super.onLongPress(key);
    }
}
 
開發者ID:cdjalel,項目名稱:QuranKeyboard,代碼行數:9,代碼來源:ArabicKeyboardView.java

示例12: onLongPress

@Override
protected boolean onLongPress(Key key) {
    if (key.codes[0] == Keyboard.KEYCODE_CANCEL) {
        getOnKeyboardActionListener().onKey(KEYCODE_OPTIONS, null);
        return true;
    } else if (key.codes[0] == 'ာ') {
        getOnKeyboardActionListener().onKey(4139, null);
        return true;
    } else {
        return super.onLongPress(key);
    }
}
 
開發者ID:YehtutHl,項目名稱:myan,代碼行數:12,代碼來源:smKeyboardView.java

示例13: onLongPress

@Override
protected boolean onLongPress(Key key) {
	
    if (key.codes[0] == Keyboard.KEYCODE_CANCEL) {
        getOnKeyboardActionListener().onKey(KEYCODE_OPTIONS, null);
        return true;
    } else {
        return super.onLongPress(key);
    }
}
 
開發者ID:iamironrabbit,項目名稱:tibetan-keyboard,代碼行數:10,代碼來源:BhoKeyboardView.java

示例14: 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

示例15: 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


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