當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。