本文整理匯總了Java中android.view.KeyEvent.FLAG_LONG_PRESS屬性的典型用法代碼示例。如果您正苦於以下問題:Java KeyEvent.FLAG_LONG_PRESS屬性的具體用法?Java KeyEvent.FLAG_LONG_PRESS怎麽用?Java KeyEvent.FLAG_LONG_PRESS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.view.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.FLAG_LONG_PRESS屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: sendEvent
void sendEvent(int action, int flags, long when, boolean applyDefaultFlags) {
try {
final int repeatCount = (flags & KeyEvent.FLAG_LONG_PRESS) != 0 ? 1 : 0;
if (applyDefaultFlags) {
flags |= KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY;
}
final KeyEvent ev = new KeyEvent(mDownTime, when, action, mCode, repeatCount,
0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, flags,
InputDevice.SOURCE_KEYBOARD);
final Object inputManager = XposedHelpers.callStaticMethod(InputManager.class, "getInstance");
XposedHelpers.callMethod(inputManager, "injectInputEvent", ev, 0);
} catch (Throwable t) {
XposedBridge.log(t);
}
}
示例2: longHome
@Override
protected void longHome() {
KeyEvent keyEvent = new KeyEvent(KeyEvent.FLAG_LONG_PRESS, KeyEvent.KEYCODE_HOME);
mInst.sendKeySync(keyEvent);
}