本文整理汇总了Java中android.view.KeyEvent.KEYCODE_P属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.KEYCODE_P属性的具体用法?Java KeyEvent.KEYCODE_P怎么用?Java KeyEvent.KEYCODE_P使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.KEYCODE_P属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispatchKeyEvent
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN && event.isCtrlPressed()) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_P:
// Open a new private window
if(event.isShiftPressed()) {
startActivity(new Intent(this, IncognitoActivity.class));
overridePendingTransition(R.anim.slide_up_in, R.anim.fade_out_scale);
return true;
}
break;
}
}
return super.dispatchKeyEvent(event);
}
示例2: 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);
}
示例3: 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);
}
}