本文整理了Java中android.view.KeyEvent.keyCodeToString()
方法的一些代码示例,展示了KeyEvent.keyCodeToString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyEvent.keyCodeToString()
方法的具体详情如下:
包路径:android.view.KeyEvent
类名称:KeyEvent
方法名:keyCodeToString
暂无
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
String name = KeyEvent.keyCodeToString(keyCode);
String original = KeyEvent.keyCodeToString(keyCode);
代码示例来源:origin: bitcraze/crazyflie-android-client
@Override
public boolean onKey(DialogInterface dialog, int pKeyCode, KeyEvent event) {
if(pKeyCode != KeyEvent.KEYCODE_BACK) {
this.mKeyCode = KeyEvent.keyCodeToString(pKeyCode);
mValueTextView.setText(mKeyCode);
} else {
dialog.dismiss();
}
return true;
}
代码示例来源:origin: gearvrf/GearVRf-Demos
public void onKeyDown(int keyCode) {
keyTextView.setText(String.format("Key Pressed: %s ",
KeyEvent.keyCodeToString(keyCode)));
}
代码示例来源:origin: osfans/trime
public void speakKey(int code) {
if (code <= 0) return;
String text =
KeyEvent.keyCodeToString(code)
.replace("KEYCODE_", "")
.replace("_", " ")
.toLowerCase(Locale.getDefault());
speakKey(text);
}
代码示例来源:origin: li2/learning-android-open-source
public boolean onKeyDown(KeyEvent event) {
final int keyCode = event.getKeyCode();
if (isGameKey(keyCode)) {
if (event.getRepeatCount() == 0) {
final String symbolicName = KeyEvent.keyCodeToString(keyCode);
mKeys.put(keyCode, 1);
Log.i(TAG, mDevice.getName() + " - Key Down: " + symbolicName);
}
return true;
}
return false;
}
代码示例来源:origin: qiubiteme/android_api_demos
public boolean onKeyDown(KeyEvent event) {
final int keyCode = event.getKeyCode();
if (isGameKey(keyCode)) {
if (event.getRepeatCount() == 0) {
final String symbolicName = KeyEvent.keyCodeToString(keyCode);
mKeys.put(keyCode, 1);
Log.i(TAG, mDevice.getName() + " - Key Down: " + symbolicName);
}
return true;
}
return false;
}
代码示例来源:origin: qiubiteme/android_api_demos
public boolean onKeyUp(KeyEvent event) {
final int keyCode = event.getKeyCode();
if (isGameKey(keyCode)) {
int index = mKeys.indexOfKey(keyCode);
if (index >= 0) {
final String symbolicName = KeyEvent.keyCodeToString(keyCode);
mKeys.put(keyCode, 0);
Log.i(TAG, mDevice.getName() + " - Key Up: " + symbolicName);
}
return true;
}
return false;
}
代码示例来源:origin: li2/learning-android-open-source
public boolean onKeyUp(KeyEvent event) {
final int keyCode = event.getKeyCode();
if (isGameKey(keyCode)) {
int index = mKeys.indexOfKey(keyCode);
if (index >= 0) {
final String symbolicName = KeyEvent.keyCodeToString(keyCode);
mKeys.put(keyCode, 0);
Log.i(TAG, mDevice.getName() + " - Key Up: " + symbolicName);
}
return true;
}
return false;
}
代码示例来源:origin: li2/learning-android-open-source
TextColumn column = (TextColumn) mDataItems.get(id);
if (column == null) {
column = new TextColumn(id, KeyEvent.keyCodeToString(keyCode));
mDataItems.put(id, column);
代码示例来源:origin: qiubiteme/android_api_demos
TextColumn column = (TextColumn) mDataItems.get(id);
if (column == null) {
column = new TextColumn(id, KeyEvent.keyCodeToString(keyCode));
mDataItems.put(id, column);
代码示例来源:origin: wasdennnoch/AndroidN-ify
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if ((boolean) XposedHelpers.callMethod(mPhoneWindowManager, "keyguardOn")) return;
KeyEvent event = (KeyEvent) param.args[1];
int keyCode = event.getKeyCode();
boolean down = event.getAction() == KeyEvent.ACTION_DOWN;
boolean isFromSystem = (event.getFlags() & KeyEvent.FLAG_FROM_SYSTEM) != 0;
if (keyCode == KeyEvent.KEYCODE_APP_SWITCH) {
XposedHook.logD(TAG, "interceptKeyBeforeDispatching: keyCode= " + keyCode +
"; keyCodeString=" + KeyEvent.keyCodeToString(keyCode) +
"; down= " + down +
"; repeatCount= " + event.getRepeatCount() +
"; isInjected= " + (((Integer) param.args[2] & 0x01000000) != 0) +
"; fromSystem= " + isFromSystem);
if (isFromSystem && !isTaskLocked(mContext) && down && event.getRepeatCount() == 0) {
if (!mWasPressed) {
XposedHook.logD(TAG, "HW recents clicked");
mWasPressed = true;
mHandler.postDelayed(resetPressedState, mDoubletapSpeed);
} else {
XposedHook.logD(TAG, "Double tap detected");
mHandler.removeCallbacks(resetPressedState);
mWasPressed = false;
switchToLastApp(mContext, mHandler);
}
param.setResult(-1);
}
}
}
};
内容来源于网络,如有侵权,请联系作者删除!