本文整理匯總了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;
}
}