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

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

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

KeyEvent.isCtrlPressed介绍

暂无

代码示例

代码示例来源:origin: ankidroid/Anki-Android

if (event.isCtrlPressed()) {
  saveNote();
if (event.isCtrlPressed() && (mNoteDeckSpinner != null)) {
    mNoteDeckSpinner.performClick();
if (event.isCtrlPressed()) {
  showCardTemplateEditor();
if (event.isCtrlPressed() && (mNoteTypeSpinner != null)) {
    mNoteTypeSpinner.performClick();
if (event.isCtrlPressed() && event.isShiftPressed()) {
  showTagsDialog();

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
 if (keyCode==KeyEvent.KEYCODE_DPAD_RIGHT && event.getRepeatCount()==0) {
  int position=adapter.getCheckedPosition();
  if (position>=0) {
   Uri videoUri=adapter.getVideoUri(position);
   if (event.isAltPressed()) {
    playVideo(videoUri);
   }
   else if (event.isCtrlPressed()) {
    showLargeThumbnail(videoUri);
   }
   return(true);
  }
 }
 return(super.onKeyDown(keyCode, event));
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
 if (keyCode==KeyEvent.KEYCODE_DPAD_RIGHT && event.getRepeatCount()==0) {
  int position=adapter.getCheckedPosition();
  if (position>=0) {
   Uri videoUri=adapter.getVideoUri(position);
   if (event.isAltPressed()) {
    playVideo(videoUri);
   }
   else if (event.isCtrlPressed()) {
    showLargeThumbnail(videoUri);
   }
   return(true);
  }
 }
 return(super.onKeyDown(keyCode, event));
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
 if (keyCode==KeyEvent.KEYCODE_DPAD_RIGHT && event.getRepeatCount()==0) {
  int position=adapter.getCheckedPosition();
  if (position>=0) {
   Uri videoUri=adapter.getVideoUri(position);
   if (event.isAltPressed()) {
    playVideo(videoUri);
   }
   else if (event.isCtrlPressed()) {
    showLargeThumbnail(videoUri);
   }
   return(true);
  }
 }
 return(super.onKeyDown(keyCode, event));
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
 if (keyCode==KeyEvent.KEYCODE_DPAD_RIGHT && event.getRepeatCount()==0) {
  int position=adapter.getCheckedPosition();
  if (position>=0) {
   Uri videoUri=adapter.getVideoUri(position);
   if (event.isAltPressed()) {
    playVideo(videoUri);
   }
   else if (event.isCtrlPressed()) {
    showLargeThumbnail(videoUri);
   }
   return(true);
  }
 }
 return(super.onKeyDown(keyCode, event));
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
 if (event.getRepeatCount()==0) {
  if (keyCode==KeyEvent.KEYCODE_DPAD_RIGHT) {
   int position=adapter.getCheckedPosition();
   if (position>=0) {
    Uri videoUri=adapter.getVideoUri(position);
    if (event.isAltPressed()) {
     playVideo(videoUri);
    }
    else if (event.isCtrlPressed()) {
     showLargeThumbnail(videoUri);
    }
    return(true);
   }
  }
  else if (keyCode==KeyEvent.KEYCODE_SLASH &&
   event.isMetaPressed() &&
   Build.VERSION.SDK_INT<Build.VERSION_CODES.N) {
   new ShortcutDialogFragment().show(getSupportFragmentManager(),
    "shortcuts");
   return(true);
  }
 }
 return(super.onKeyDown(keyCode, event));
}

代码示例来源:origin: termux/termux-app

mActivity.removeFinishedSession(currentSession);
  return true;
} else if (e.isCtrlPressed() && e.isAltPressed()) {

代码示例来源:origin: termux/termux-app

final boolean controlDownFromEvent = event.isCtrlPressed();
final boolean leftAltDownFromEvent = (metaState & KeyEvent.META_ALT_LEFT_ON) != 0;
final boolean rightAltDownFromEvent = (metaState & KeyEvent.META_ALT_RIGHT_ON) != 0;

代码示例来源:origin: limboemu/limbo

public static boolean isTextInputEvent(KeyEvent event) {
 
  // Key pressed with Ctrl should be sent as SDL_KEYDOWN/SDL_KEYUP and not SDL_TEXTINPUT
  if (Build.VERSION.SDK_INT >= 11) {
    if (event.isCtrlPressed()) {
      return false;
    }  
  }
  return event.isPrintingKey() || event.getKeyCode() == KeyEvent.KEYCODE_SPACE;
}

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

private static int getMetaState(KeyEvent event) {
  return (event.isCtrlPressed() ? CTRL : 0)
      | (event.isAltPressed() ? ALT : 0)
      | (event.isShiftPressed() ? SHIFT : 0);
}

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

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
  if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_F3
      || (keyCode == KeyEvent.KEYCODE_G && event.isCtrlPressed())) {
    mFindToolbar.hideKeyboardAndStartFinding(!event.isShiftPressed());
    return true;
  }
  return super.onKeyDown(keyCode, event);
}

代码示例来源: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: playn/playn

private int mods (KeyEvent event) {
 return modifierFlags(event.isAltPressed(), event.isCtrlPressed(), event.isMetaPressed(),
            event.isShiftPressed());
}

代码示例来源:origin: termux/termux-float

@Override
public boolean onKeyDown(int keyCode, KeyEvent e, TerminalSession session) {
  if (handleVirtualKeys(keyCode, e, true)) return true;
  if (e.isCtrlPressed() && e.isAltPressed()) {
    // Get the unmodified code point:
    int unicodeChar = e.getUnicodeChar(0);
    if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN || unicodeChar == 'n'/* next */) {
      // TODO: Toggle minimized or not.
    } else if (unicodeChar == 'f'/* full screen */) {
      // TODO: Toggle full screen.
    } else if (unicodeChar == 'k'/* keyboard */) {
      InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
      imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
    }
    return true;
  }
  return false;
}

代码示例来源:origin: YeDaxia/Android-YRichEditor

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
  if (keyCode == KeyEvent.KEYCODE_ENTER ||
      keyCode == KeyEvent.KEYCODE_DEL ||
      keyCode == KeyEvent.KEYCODE_FORWARD_DEL) {
    updateLineGroups();
  } else if (keyboardShortcuts
      && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    if (event.isCtrlPressed()) {
      if (keyCode == KeyEvent.KEYCODE_B) {
        toggleEffect(RichEditText.BOLD);
        return (true);
      } else if (keyCode == KeyEvent.KEYCODE_I) {
        toggleEffect(RichEditText.ITALIC);
        return (true);
      } else if (keyCode == KeyEvent.KEYCODE_U) {
        toggleEffect(RichEditText.UNDERLINE);
        return (true);
      }
    }
  }
  return (super.onKeyUp(keyCode, event));
}

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

&& event.isCtrlPressed()
&& event.getRepeatCount() == 0
&& !KeyEvent.isModifierKey(keyCode)) {

代码示例来源:origin: threerings/playn

private Modifiers extractModifiers(KeyEvent nativeEvent) {
 Modifiers modifiers = new Modifiers();
 if (nativeEvent.isAltPressed()) modifiers.add(Key.ALT);
 if (nativeEvent.isCtrlPressed()) modifiers.add(Key.CONTROL);
 if (nativeEvent.isShiftPressed()) modifiers.add(Key.SHIFT);
 if (nativeEvent.isMetaPressed()) modifiers.add(Key.META);
 return modifiers;
}

代码示例来源:origin: com.googlecode.playn/playn-android

private Modifiers extractModifiers(KeyEvent nativeEvent) {
 Modifiers modifiers = new Modifiers();
 if (nativeEvent.isAltPressed()) modifiers.add(Key.ALT);
 if (nativeEvent.isCtrlPressed()) modifiers.add(Key.CONTROL);
 if (nativeEvent.isShiftPressed()) modifiers.add(Key.SHIFT);
 if (nativeEvent.isMetaPressed()) modifiers.add(Key.META);
 return modifiers;
}

代码示例来源:origin: KDE/kdeconnect-android

if (event.isCtrlPressed()) {
  np.set("ctrl", true);
  modifier = true;

代码示例来源:origin: CypherpunkArmory/UserLAnd

mActivity.removeFinishedSession(currentSession);
  return true;
} else if (e.isCtrlPressed() && e.isAltPressed()) {

相关文章