当前位置: 首页>>代码示例>>Java>>正文


Java KeyEvent.isSystem方法代码示例

本文整理汇总了Java中android.view.KeyEvent.isSystem方法的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.isSystem方法的具体用法?Java KeyEvent.isSystem怎么用?Java KeyEvent.isSystem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.KeyEvent的用法示例。


在下文中一共展示了KeyEvent.isSystem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onKeyUp

import android.view.KeyEvent; //导入方法依赖的package包/类
/**
 * Called when a key is released in the view.
 *
 * @param keyCode The keycode of the key which was released.
 * @param event   A {@link KeyEvent} describing the event.
 * @return Whether the event was handled.
 */
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (LOG_KEY_EVENTS)
        Log.i(EmulatorDebug.LOG_TAG, "onKeyUp(keyCode=" + keyCode + ", event=" + event + ")");
    if (mEmulator == null) return true;

    if (mClient.onKeyUp(keyCode, event)) {
        invalidate();
        return true;
    } else if (event.isSystem()) {
        // Let system key events through.
        return super.onKeyUp(keyCode, event);
    }

    return true;
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:24,代码来源:TerminalView.java

示例2: performPanelShortcut

import android.view.KeyEvent; //导入方法依赖的package包/类
private boolean performPanelShortcut(PanelFeatureState st, int keyCode, KeyEvent event, int flags) {
    if (event.isSystem()) {
        return false;
    }
    boolean handled = false;
    if ((st.isPrepared || preparePanel(st, event)) && st.menu != null) {
        handled = st.menu.performShortcut(keyCode, event, flags);
    }
    if (!handled || (flags & 1) != 0 || this.mDecorContentParent != null) {
        return handled;
    }
    closePanel(st, true);
    return handled;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:15,代码来源:AppCompatDelegateImplV7.java

示例3: onKeyDown

import android.view.KeyEvent; //导入方法依赖的package包/类
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (LOG_KEY_EVENTS)
        Log.i(EmulatorDebug.LOG_TAG, "onKeyDown(keyCode=" + keyCode + ", isSystem()=" + event.isSystem() + ", event=" + event + ")");
    if (mEmulator == null) return true;

    if (mClient.onKeyDown(keyCode, event, mTermSession)) {
        invalidate();
        return true;
    } else if (event.isSystem() && (!mClient.shouldBackButtonBeMappedToEscape() || keyCode != KeyEvent.KEYCODE_BACK)) {
        return super.onKeyDown(keyCode, event);
    } else if (event.getAction() == KeyEvent.ACTION_MULTIPLE && keyCode == KeyEvent.KEYCODE_UNKNOWN) {
        mTermSession.write(event.getCharacters());
        return true;
    }

    final int metaState = event.getMetaState();
    final boolean controlDownFromEvent = event.isCtrlPressed();
    final boolean leftAltDownFromEvent = (metaState & KeyEvent.META_ALT_LEFT_ON) != 0;
    final boolean rightAltDownFromEvent = (metaState & KeyEvent.META_ALT_RIGHT_ON) != 0;

    int keyMod = 0;
    if (controlDownFromEvent) keyMod |= KeyHandler.KEYMOD_CTRL;
    if (event.isAltPressed()) keyMod |= KeyHandler.KEYMOD_ALT;
    if (event.isShiftPressed()) keyMod |= KeyHandler.KEYMOD_SHIFT;
    if (handleKeyCode(keyCode, keyMod)) {
        if (LOG_KEY_EVENTS) Log.i(EmulatorDebug.LOG_TAG, "handleKeyCode() took key event");
        return true;
    }

    // Clear Ctrl since we handle that ourselves:
    int bitsToClear = KeyEvent.META_CTRL_MASK;
    if (rightAltDownFromEvent) {
        // Let right Alt/Alt Gr be used to compose characters.
    } else {
        // Use left alt to send to terminal (e.g. Left Alt+B to jump back a word), so remove:
        bitsToClear |= KeyEvent.META_ALT_ON | KeyEvent.META_ALT_LEFT_ON;
    }
    int effectiveMetaState = event.getMetaState() & ~bitsToClear;

    int result = event.getUnicodeChar(effectiveMetaState);
    if (LOG_KEY_EVENTS)
        Log.i(EmulatorDebug.LOG_TAG, "KeyEvent#getUnicodeChar(" + effectiveMetaState + ") returned: " + result);
    if (result == 0) {
        return true;
    }

    int oldCombiningAccent = mCombiningAccent;
    if ((result & KeyCharacterMap.COMBINING_ACCENT) != 0) {
        // If entered combining accent previously, write it out:
        if (mCombiningAccent != 0)
            inputCodePoint(mCombiningAccent, controlDownFromEvent, leftAltDownFromEvent);
        mCombiningAccent = result & KeyCharacterMap.COMBINING_ACCENT_MASK;
    } else {
        if (mCombiningAccent != 0) {
            int combinedChar = KeyCharacterMap.getDeadChar(mCombiningAccent, result);
            if (combinedChar > 0) result = combinedChar;
            mCombiningAccent = 0;
        }
        inputCodePoint(result, controlDownFromEvent, leftAltDownFromEvent);
    }

    if (mCombiningAccent != oldCombiningAccent) invalidate();

    if (onAutoCompleteListener != null) {
        if (event.isPrintingKey()) {
            char printingChar = (char) event.getUnicodeChar(metaState);
            if (printingChar != '\b') {
                // ASCII chars
                onAutoCompleteListener.onCompletionRequired(new String(new char[]{printingChar}));
            }
        }
    }

    return true;
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:77,代码来源:TerminalView.java


注:本文中的android.view.KeyEvent.isSystem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。