本文整理汇总了Java中android.view.KeyEvent.hasNoModifiers方法的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.hasNoModifiers方法的具体用法?Java KeyEvent.hasNoModifiers怎么用?Java KeyEvent.hasNoModifiers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.hasNoModifiers方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispatchKeyEvent
import android.view.KeyEvent; //导入方法依赖的package包/类
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
boolean retVal = super.dispatchKeyEvent(event);
if (retVal && mUrlHasFocus && mUrlFocusedWithoutAnimations
&& event.getAction() == KeyEvent.ACTION_DOWN && event.isPrintingKey()
&& event.hasNoModifiers()) {
handleUrlFocusAnimation(mUrlHasFocus);
}
return retVal;
}
示例2: handleKeyboardEvent
import android.view.KeyEvent; //导入方法依赖的package包/类
@Override
public void handleKeyboardEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN && mTab.getActivity() != null) {
if (mTab.getActivity().onKeyDown(event.getKeyCode(), event)) return;
// Handle the Escape key here (instead of in KeyboardShortcuts.java), so it doesn't
// interfere with other parts of the activity (e.g. the URL bar).
if (event.getKeyCode() == KeyEvent.KEYCODE_ESCAPE && event.hasNoModifiers()) {
WebContents wc = mTab.getWebContents();
if (wc != null) wc.stop();
return;
}
}
handleMediaKey(event);
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:16,代码来源:TabWebContentsDelegateAndroid.java
示例3: onKey
import android.view.KeyEvent; //导入方法依赖的package包/类
@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;
}
示例4: onKeyDown
import android.view.KeyEvent; //导入方法依赖的package包/类
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// We need to handle focus change within the SimpleMonthView because we are simulating
// multiple Views. The arrow keys will move between days until there is no space (no
// day to the left, top, right, or bottom). Focus forward and back jumps out of the
// SimpleMonthView, skipping over other SimpleMonthViews in the parent ViewPager
// to the next focusable View in the hierarchy.
boolean focusChanged = false;
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DPAD_LEFT:
if (event.hasNoModifiers()) {
focusChanged = moveOneDay(isLayoutRtl());
}
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
if (event.hasNoModifiers()) {
focusChanged = moveOneDay(!isLayoutRtl());
}
break;
case KeyEvent.KEYCODE_DPAD_UP:
if (event.hasNoModifiers()) {
ensureFocusedDay();
if (mHighlightedDay > 7) {
mHighlightedDay -= 7;
focusChanged = true;
}
}
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
if (event.hasNoModifiers()) {
ensureFocusedDay();
if (mHighlightedDay <= mDaysInMonth - 7) {
mHighlightedDay += 7;
focusChanged = true;
}
}
break;
case KeyEvent.KEYCODE_DPAD_CENTER:
case KeyEvent.KEYCODE_ENTER:
if (mHighlightedDay != -1) {
onDayClicked(mHighlightedDay);
return true;
}
break;
case KeyEvent.KEYCODE_TAB: {
int focusChangeDirection = 0;
if (event.hasNoModifiers()) {
focusChangeDirection = View.FOCUS_FORWARD;
} else if (event.hasModifiers(KeyEvent.META_SHIFT_ON)) {
focusChangeDirection = View.FOCUS_BACKWARD;
}
if (focusChangeDirection != 0) {
final ViewParent parent = getParent();
// move out of the ViewPager next/previous
View nextFocus = this;
do {
nextFocus = nextFocus.focusSearch(focusChangeDirection);
} while (nextFocus != null && nextFocus != this &&
nextFocus.getParent() == parent);
if (nextFocus != null) {
nextFocus.requestFocus();
return true;
}
}
break;
}
}
if (focusChanged) {
invalidate();
return true;
} else {
return super.onKeyDown(keyCode, event);
}
}