本文整理汇总了Java中android.view.KeyEvent.getFlags方法的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.getFlags方法的具体用法?Java KeyEvent.getFlags怎么用?Java KeyEvent.getFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.getFlags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onKeyDown
import android.view.KeyEvent; //导入方法依赖的package包/类
boolean onKeyDown(int keyCode, KeyEvent event) {
boolean z = true;
switch (keyCode) {
case 4:
if ((event.getFlags() & 128) == 0) {
z = false;
}
this.mLongPressBackDown = z;
break;
case 82:
onKeyDownPanel(0, event);
return true;
}
if (VERSION.SDK_INT < 11) {
onKeyShortcut(keyCode, event);
}
return false;
}
示例2: beforeHookedMethod
import android.view.KeyEvent; //导入方法依赖的package包/类
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (!allowSkipTrack) return;
final KeyEvent event = (KeyEvent) param.args[0];
final int keyCode = event.getKeyCode();
initManagers((Context) XposedHelpers.getObjectField(param.thisObject, "mContext"));
if ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN ||
keyCode == KeyEvent.KEYCODE_VOLUME_UP) &&
(event.getFlags() & KeyEvent.FLAG_FROM_SYSTEM) != 0 &&
!mPowerManager.isInteractive() &&
mAudioManager != null && mAudioManager.isMusicActive()) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
mIsLongPress = false;
handleVolumeLongPress(param.thisObject, keyCode);
} else {
handleVolumeLongPressAbort(param.thisObject);
if (!mIsLongPress) {
if (mShoudTriggerWakeUp) {
wakeUp();
} else {
mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC,
keyCode == KeyEvent.KEYCODE_VOLUME_UP ?
AudioManager.ADJUST_RAISE : AudioManager.ADJUST_LOWER, 0);
}
}
}
param.setResult(0);
return;
}
}