本文整理汇总了Java中android.view.KeyEvent.KEYCODE_S属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.KEYCODE_S属性的具体用法?Java KeyEvent.KEYCODE_S怎么用?Java KeyEvent.KEYCODE_S使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.KEYCODE_S属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onKeyUp
@Override
public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) {
if (event.isCtrlPressed()) {
switch (keyCode) {
case KeyEvent.KEYCODE_A:
case KeyEvent.KEYCODE_X:
case KeyEvent.KEYCODE_C:
case KeyEvent.KEYCODE_V:
case KeyEvent.KEYCODE_Z:
case KeyEvent.KEYCODE_Y:
case KeyEvent.KEYCODE_S:
return true;
default:
return false;
}
} else {
switch (keyCode) {
case KeyEvent.KEYCODE_TAB:
return true;
default:
return false;
}
}
}
示例2: onKeyShortcut
@Override
public boolean onKeyShortcut(int keyCode, KeyEvent event) {
if (event.isCtrlPressed()) {
switch (keyCode) {
case KeyEvent.KEYCODE_R:
saveAndRun();
break;
case KeyEvent.KEYCODE_S:
save();
break;
case KeyEvent.KEYCODE_F:
toggleApiDrawer();
break;
}
}
return super.onKeyShortcut(keyCode, event);
}
示例3: onKeyShortcut
@Override
public boolean onKeyShortcut(int keyCode, KeyEvent event) {
if (event.hasModifiers(KeyEvent.META_CTRL_ON)) {
switch (keyCode) {
case KeyEvent.KEYCODE_A:
if (mState == State.WORKSPACE) {
showAppsView(true, false);
return true;
}
break;
case KeyEvent.KEYCODE_S: {
View focusedView = getCurrentFocus();
if (focusedView instanceof BubbleTextView
&& focusedView.getTag() instanceof ItemInfo
&& mAccessibilityDelegate.performAction(focusedView,
(ItemInfo) focusedView.getTag(),
LauncherAccessibilityDelegate.DEEP_SHORTCUTS)) {
PopupContainerWithArrow.getOpen(this).requestFocus();
return true;
}
break;
}
case KeyEvent.KEYCODE_O:
if (new CustomActionsPopup(this, getCurrentFocus()).show()) {
return true;
}
break;
}
}
return super.onKeyShortcut(keyCode, event);
}
示例4: onKeyUp
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (DLog.DEBUG) {
Log.w(TAG, "onKeyUp " + event);
}
if (handleControlKey(keyCode, event, false)) {
return true;
}
if (event.isCtrlPressed() || mKeyListener.mControlKey.isActive()) {
switch (keyCode) {
case KeyEvent.KEYCODE_A:
case KeyEvent.KEYCODE_X:
case KeyEvent.KEYCODE_C:
case KeyEvent.KEYCODE_V:
case KeyEvent.KEYCODE_Z:
case KeyEvent.KEYCODE_Y:
case KeyEvent.KEYCODE_S:
case KeyEvent.KEYCODE_R:
case KeyEvent.KEYCODE_F:
case KeyEvent.KEYCODE_L:
return true;
}
} else {
switch (keyCode) {
case KeyEvent.KEYCODE_TAB:
return true;
}
}
return super.onKeyUp(keyCode, event);
}
示例5: onKeyDown
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
//Shortcuts that work no matter what is selected
switch (keyCode) {
case KeyEvent.KEYCODE_Q: {
onAccounts();
return true;
}
case KeyEvent.KEYCODE_S: {
onEditAccount();
return true;
}
case KeyEvent.KEYCODE_H: {
Toast toast = Toast.makeText(this, R.string.folder_list_help_key, Toast.LENGTH_LONG);
toast.show();
return true;
}
case KeyEvent.KEYCODE_1: {
setDisplayMode(FolderMode.FIRST_CLASS);
return true;
}
case KeyEvent.KEYCODE_2: {
setDisplayMode(FolderMode.FIRST_AND_SECOND_CLASS);
return true;
}
case KeyEvent.KEYCODE_3: {
setDisplayMode(FolderMode.NOT_SECOND_CLASS);
return true;
}
case KeyEvent.KEYCODE_4: {
setDisplayMode(FolderMode.ALL);
return true;
}
}//switch
return super.onKeyDown(keyCode, event);
}
示例6: onKeyDown
@Override
public boolean onKeyDown(int keyCode, @NonNull KeyEvent event) {
if (event.isCtrlPressed()) {
switch (keyCode) {
case KeyEvent.KEYCODE_A:
return onTextContextMenuItem(ID_SELECT_ALL);
case KeyEvent.KEYCODE_X:
return onTextContextMenuItem(ID_CUT);
case KeyEvent.KEYCODE_C:
return onTextContextMenuItem(ID_COPY);
case KeyEvent.KEYCODE_V:
return onTextContextMenuItem(ID_PASTE);
case KeyEvent.KEYCODE_Z:
if (getCanUndo()) {
return onTextContextMenuItem(ID_UNDO);
}
case KeyEvent.KEYCODE_Y:
if (getCanRedo()) {
return onTextContextMenuItem(ID_REDO);
}
case KeyEvent.KEYCODE_S:
((MainActivity) getContext()).saveTheFile(false);
return true;
default:
return super.onKeyDown(keyCode, event);
}
} else {
switch (keyCode) {
case KeyEvent.KEYCODE_TAB:
String textToInsert = " ";
int start, end;
start = Math.max(getSelectionStart(), 0);
end = Math.max(getSelectionEnd(), 0);
getText().replace(Math.min(start, end), Math.max(start, end),
textToInsert, 0, textToInsert.length());
return true;
default:
return super.onKeyDown(keyCode, event);
}
}
}