android.view.KeyEvent.isModifierKey()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(183)

本文整理了Java中android.view.KeyEvent.isModifierKey()方法的一些代码示例,展示了KeyEvent.isModifierKey()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyEvent.isModifierKey()方法的具体详情如下:
包路径:android.view.KeyEvent
类名称:KeyEvent
方法名:isModifierKey

KeyEvent.isModifierKey介绍

暂无

代码示例

代码示例来源:origin: nekocode/JarFilterPlugin

/**
 * KeyEvents with non-default modifiers are not dispatched to menu's performShortcut in API 25
 * or lower. Here, we check if the keypress corresponds to a menuitem's shortcut combination
 * and perform the corresponding action.
 */
private boolean performMenuItemShortcut(int keycode, KeyEvent event) {
  if (!(Build.VERSION.SDK_INT >= 26) && !event.isCtrlPressed()
      && !KeyEvent.metaStateHasNoModifiers(event.getMetaState())
      && event.getRepeatCount() == 0
      && !KeyEvent.isModifierKey(event.getKeyCode())) {
    final Window currentWindow = getWindow();
    if (currentWindow != null && currentWindow.getDecorView() != null) {
      final View decorView = currentWindow.getDecorView();
      if (decorView.dispatchKeyShortcutEvent(event)) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: osfans/trime

private boolean composeEvent(KeyEvent event) {
 int keyCode = event.getKeyCode();
 if (keyCode == KeyEvent.KEYCODE_MENU) return false; //不處理Menu鍵
 if (keyCode >= Key.getSymbolStart()) return false; //只處理安卓標準按鍵
 if (event.getRepeatCount() == 0 && KeyEvent.isModifierKey(keyCode)) {
  boolean ret =
    onRimeKey(
      Event.getRimeEvent(
        keyCode, event.getAction() == KeyEvent.ACTION_DOWN ? 0 : Rime.META_RELEASE_ON));
  if (isComposing()) setCandidatesViewShown(canCompose); //藍牙鍵盤打字時顯示候選欄
  return ret;
 }
 if (!canCompose || Rime.isVoidKeycode(keyCode)) return false;
 return true;
}

代码示例来源:origin: osfans/trime

&& event.isCtrlPressed()
 && event.getRepeatCount() == 0
 && !KeyEvent.isModifierKey(keyCode)) {
if (handleAciton(keyCode, event.getMetaState())) return true;

代码示例来源:origin: derry/delion

boolean isCurrentTabVisible, boolean tabSwitchingEnabled) {
int keyCode = event.getKeyCode();
if (event.getRepeatCount() != 0 || KeyEvent.isModifierKey(keyCode)) return false;
if (KeyEvent.isGamepadButton(keyCode)) {
  if (isGamepadAPIActive(activity)) return false;

相关文章