KeyEvent isAltPressed - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for KeyEvent isAltPressed method.

This code example shows how to use the following methods:isAltPressed
    } 
 
 
    @Override 
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (event.isAltPressed() == true) {
            return false; 
        } 
        return super.onKeyDown(keyCode, event);
    } 
 
 
    @Override 
    public void setOnLongClickListener(OnLongClickListener l) {
        mAnswer.setOnLongClickListener(l);
    } 
 
 
    @Override 
    public void cancelLongPress() { 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:isAltPressed
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		// Eat these keys, to avoid accidental exits / other screwups. 
		// Maybe there's even more we need to eat on tablets? 
		switch (keyCode) {
		case KeyEvent.KEYCODE_BACK:
			if (event.isAltPressed()) {
				NativeApp.keyDown(0, 1004); // special custom keycode 
			} else if (NativeApp.isAtTopLevel()) { 
				Log.i(TAG, "IsAtTopLevel returned true.");
				return super.onKeyDown(keyCode, event);
			} else { 
				NativeApp.keyDown(0, keyCode);
			} 
			return true; 
		case KeyEvent.KEYCODE_MENU:
		case KeyEvent.KEYCODE_SEARCH:
			NativeApp.keyDown(0, keyCode);
			return true; 
		case KeyEvent.KEYCODE_VOLUME_DOWN:
		case KeyEvent.KEYCODE_VOLUME_UP:
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMetaState, getUnicodeChar, isAltPressed
    private boolean processStateInput(int keyChar, int keyCode, KeyEvent event,
            boolean realAction) {
        // If ALT key is pressed, input alternative key. But if the 
        // alternative key is quote key, it will be used for input a splitter 
        // in Pinyin string. 
        if (event.isAltPressed()) {
            if ('\'' != event.getUnicodeChar(event.getMetaState())) {
                if (realAction) {
                    char fullwidth_char = KeyMapDream.getChineseLabel(keyCode);
                    if (0 != fullwidth_char) {
                        commitResultText(mDecInfo
                                .getCurrentFullSent(mCandidatesContainer
                                        .getActiveCandiatePos()) + 
                                        String.valueOf(fullwidth_char));
                        resetToIdleState(false); 
                    } 
                } 
                return true; 
            } else { 
                keyChar = '\'';
3
CodeRank
Experience pair programming with AI  Get Codota for Java
isAltPressed Method Overview
Returns the pressed state of the ALT meta key.
See Code Examples for other Android KeyEvent Methods: