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

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

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

KeyEvent.isShiftPressed介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
  // If triggered by an enter key, this is the event; otherwise, this is null.
  if (event != null) {
    // if shift key is down, then we want to insert the '\n' char in the TextView;
    // otherwise, the default action is to send the message.
    if (!event.isShiftPressed()) {
      if (isPreparedForSending()) {
        confirmSendMessageIfNeeded();
      }
      return true;
    }
    return false;
  }

  if (isPreparedForSending()) {
    confirmSendMessageIfNeeded();
  }
  return true;
}

代码示例来源:origin: k9mail/k-9

public void zoom(KeyEvent event) {
  if (event.isShiftPressed()) {
    mMessageContentView.zoomIn();
  } else {
    mMessageContentView.zoomOut();
  }
}

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

/**
 * Select Text in the webview and automatically sends the selected text to the clipboard. From
 * http://cosmez.blogspot.com/2010/04/webview-emulateshiftheld-on-android.html
 */
@SuppressWarnings("deprecation") // Tracked separately in Github as #5024
private void selectAndCopyText() {
  try {
    KeyEvent shiftPressEvent = new KeyEvent(0, 0, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0);
    shiftPressEvent.dispatch(mCard);
    shiftPressEvent.isShiftPressed();
    mIsSelecting = true;
  } catch (Exception e) {
    throw new AssertionError(e);
  }
}

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

if (event.isCtrlPressed() && event.isShiftPressed()) {
  showTagsDialog();

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

if (controlDownFromEvent) keyMod |= KeyHandler.KEYMOD_CTRL;
if (event.isAltPressed()) keyMod |= KeyHandler.KEYMOD_ALT;
if (event.isShiftPressed()) keyMod |= KeyHandler.KEYMOD_SHIFT;
if (!event.isFunctionPressed() && handleKeyCode(keyCode, keyMod)) {
  if (LOG_KEY_EVENTS) Log.i(EmulatorDebug.LOG_TAG, "handleKeyCode() took key event");

代码示例来源:origin: stackoverflow.com

edit1.setOnKeyListener(new View.OnKeyListener() {
 @Override
 public boolean onKey(View v, int keyCode, KeyEvent event) {
  if(event.isShiftPressed())
   {

    }
  return false;
 }
});

代码示例来源:origin: stackoverflow.com

@Override 
public boolean onKeyUp(int keyCode, KeyEvent event) {
 switch (keyCode) {
   ...
   case KeyEvent.KEYCODE_J:
     if (event.isShiftPressed()) {
       fireLaser();
     } else {
       fireMachineGun();
     }
     return true;
   case KeyEvent.KEYCODE_K:
     if (event.isShiftPressed()) {
       fireSeekingMissle();
     } else {
       fireMissile();
     }
     return true;
   default:
     return super.onKeyUp(keyCode, event);
 } }

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

@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
  if (keyCode == KeyEvent.KEYCODE_TAB && event.getAction() == KeyEvent.ACTION_DOWN) {
    if (event.hasNoModifiers()) {
      View forward = getNextFocusForward();
      if (forward != null) return forward.requestFocus();
    } else if (event.isShiftPressed()) {
      View backward = getNextFocusBackward();
      if (backward != null) return backward.requestFocus();
    }
  } else if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_UP) {
    return handleEnterKeyPress();
  }
  return false;
}

代码示例来源:origin: rokudol/PswText

@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
  if (event.getAction() == KeyEvent.ACTION_DOWN) {
    if (event.isShiftPressed()) {//处理*#等键
      return false;
    }
    if (keyCode >= KeyEvent.KEYCODE_0 && keyCode <= KeyEvent.KEYCODE_9) {//只处理数字
      if (result.size() < pswLength) {
        result.add(keyCode - 7);
        invalidate();
        FinishInput();
      }
      return true;
    }
    if (keyCode == KeyEvent.KEYCODE_DEL) {
      if (!result.isEmpty()) {//不为空时,删除最后一个数字
        saveResult = result.size();
        result.remove(result.size() - 1);
        invalidate();
      }
      return true;
    }
    if (keyCode == KeyEvent.KEYCODE_ENTER) {
      FinishInput();
      return true;
    }
  }
  return false;
}

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

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

代码示例来源:origin: maks/MGit

return true;
case KeyEvent.KEYCODE_SLASH:
  if (event.isShiftPressed()) {
    showKeyboardShortcutsHelpOverlay();

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

pageScroll(event.isShiftPressed() ? View.FOCUS_UP : View.FOCUS_DOWN);
break;

代码示例来源:origin: apptentive/apptentive-android

pageScroll(event.isShiftPressed() ? View.FOCUS_UP : View.FOCUS_DOWN);
break;

代码示例来源:origin: crvv/android_wubi_input

if (keyEvent.isShiftPressed()) {
  return Event.createHardwareKeypressEvent(Event.NOT_A_CODE_POINT,

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

if (event.isShiftPressed()) {
  np.set("shift", true);

代码示例来源:origin: MobiDevelop/android-split-pane-layout

boolean remeasure = false;
int offset = mSplitterSize;
if (event.isShiftPressed()) {
  offset *= 5;

相关文章