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


Java KeyEvent.KEYCODE_D属性代码示例

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


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

示例1: onKeyUp

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    switch (keyCode) {
        case KeyEvent.KEYCODE_A:
            startDiscovery();
            break;
        case KeyEvent.KEYCODE_B:
            stopDiscovery();
            break;
        case KeyEvent.KEYCODE_C:
            createBondDiscoveredDevices();
            break;
        case KeyEvent.KEYCODE_D:
            pairBondedDevices();
            break;
        case KeyEvent.KEYCODE_E:
            unpairBondedDevices();
            break;
    }

    return super.onKeyUp(keyCode, event);
}
 
开发者ID:casper-kim,项目名称:androidthings-bluetooth-pairing,代码行数:22,代码来源:MainActivity.java

示例2: onKeyDown

@Override public boolean onKeyDown(int keyCode, KeyEvent event) {
    switch (keyCode) {
        case KeyEvent.KEYCODE_DPAD_DOWN:
            mDoFilter = !mDoFilter;
            updateTitle();
            mView.invalidate();
            return true;
        case KeyEvent.KEYCODE_DPAD_UP:
            mDoDither = !mDoDither;
            updateTitle();
            mView.invalidate();
            return true;
        case KeyEvent.KEYCODE_DPAD_RIGHT:
            mCurrBGIndex = (mCurrBGIndex + 1) % mBGs.length;
            mView.invalidate();
            return true;
        case KeyEvent.KEYCODE_DPAD_LEFT:
            mCurrBGIndex -= 1;
            if (mCurrBGIndex < 0) {
                mCurrBGIndex = 0;
            }
            mView.invalidate();
            return true;
        case KeyEvent.KEYCODE_VOLUME_UP:
            toggleFPS();
            return true;
        case KeyEvent.KEYCODE_U:
        case KeyEvent.KEYCODE_D:
        case KeyEvent.KEYCODE_VOLUME_DOWN:
            return super.onKeyDown(keyCode, event);
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:33,代码来源:NinePatchLab.java

示例3: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {

    switch (keyCode) {
        case KeyEvent.KEYCODE_R:
            mViewModel.addRectLayer();
            return true;
        case KeyEvent.KEYCODE_T:
            mViewModel.addTriangleLayer();
            return true;
        case KeyEvent.KEYCODE_O:
            mViewModel.addOvalLayer();
            return true;
    }

    if (mBinding.documentView.hasFocus()) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_DEL:
            case KeyEvent.KEYCODE_FORWARD_DEL:
                return onContextMenuAction(DELETE);
        }

        if (event.isCtrlPressed()) {
            switch (keyCode) {
                case KeyEvent.KEYCODE_X:
                    return onContextMenuAction(CUT);
                case KeyEvent.KEYCODE_C:
                    return onContextMenuAction(COPY);
                case KeyEvent.KEYCODE_V:
                    return onContextMenuAction(PASTE);
                case KeyEvent.KEYCODE_D:
                    return onContextMenuAction(DUPLICATE);
                case KeyEvent.KEYCODE_G:
                    return onContextMenuAction(GROUP);
            }
        }
    }

    return super.onKeyDown(keyCode, event);
}
 
开发者ID:google,项目名称:spline,代码行数:40,代码来源:EditorActivity.java

示例4: onKeyUp

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    switch (keyCode) {
        case KeyEvent.KEYCODE_P:
            // Enable Pairing mode (discoverable)
            enableDiscoverable();
            return true;
        case KeyEvent.KEYCODE_D:
            // Disconnect any currently connected devices
            disconnectConnectedDevices();
            return true;
    }
    return super.onKeyUp(keyCode, event);
}
 
开发者ID:androidthings,项目名称:sample-bluetooth-audio,代码行数:14,代码来源:A2dpSinkActivity.java

示例5: configureButton

private void configureButton() {
    try {
        mPairingButtonDriver = new ButtonInputDriver(BoardDefaults.getGPIOForPairing(),
                Button.LogicState.PRESSED_WHEN_LOW, KeyEvent.KEYCODE_P);
        mPairingButtonDriver.register();
        mDisconnectAllButtonDriver = new ButtonInputDriver(
                BoardDefaults.getGPIOForDisconnectAllBTDevices(),
                Button.LogicState.PRESSED_WHEN_LOW, KeyEvent.KEYCODE_D);
        mDisconnectAllButtonDriver.register();
    } catch (IOException e) {
        Log.w(TAG, "Could not register GPIO button drivers. Use keyboard events to trigger " +
                "the functions instead", e);
    }
}
 
开发者ID:androidthings,项目名称:sample-bluetooth-audio,代码行数:14,代码来源:A2dpSinkActivity.java

示例6: onKey

@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
    if(event.getAction() == 0 && event.isCtrlPressed()
            && !event.isShiftPressed()
            && !event.isAltPressed()
            && !event.isFunctionPressed()
            && keyCode == KeyEvent.KEYCODE_X) {
        cut(); //Ctrl+X
        return true;
    } else if(event.getAction() == 0 && event.isCtrlPressed()
            && !event.isShiftPressed()
            && !event.isAltPressed()
            && !event.isFunctionPressed()
            && keyCode == KeyEvent.KEYCODE_C) {
        copy(); //Ctrl-C
        return true;
    } else if(event.getAction() == 0 && event.isCtrlPressed()
            && !event.isShiftPressed()
            && !event.isAltPressed()
            && !event.isFunctionPressed()
            && keyCode == KeyEvent.KEYCODE_V) {
        paste(); //Ctrl-V
        return true;
    } else if(event.getAction() == 0 && event.isCtrlPressed()
            && !event.isShiftPressed()
            && !event.isAltPressed()
            && !event.isFunctionPressed()
            && keyCode == KeyEvent.KEYCODE_Z) {
        undo(); //Ctrl-Z
        return true;
    } else if(event.getAction() == 0 && event.isCtrlPressed()
            && !event.isShiftPressed()
            && !event.isAltPressed()
            && !event.isFunctionPressed()
            && keyCode == KeyEvent.KEYCODE_Y) {
        redo(); //Ctrl-Y
        return true;
    } else if(event.getAction() == 0 && event.isCtrlPressed()
            && !event.isShiftPressed()
            && !event.isAltPressed()
            && !event.isFunctionPressed()
            && keyCode == KeyEvent.KEYCODE_A) {
        selectAll(); //Ctrl-A
        return true;
    } else if(event.getAction() == 0 && event.isCtrlPressed()
            && event.isShiftPressed()
            && !event.isAltPressed()
            && !event.isFunctionPressed()
            && keyCode == KeyEvent.KEYCODE_D) {
        deleteLine(); //Ctrl+Shift-D
        return true;
    } else if(event.getAction() == 0 && event.isCtrlPressed()
            && !event.isShiftPressed()
            && event.isAltPressed()
            && !event.isFunctionPressed()
            && keyCode == KeyEvent.KEYCODE_A) {
        selectLine(); //Ctrl+Alt-A
        return true;
    } else {
        return false;
    }
}
 
开发者ID:Light-Team,项目名称:ModPE-IDE-Source,代码行数:62,代码来源:LModEditor.java


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