本文整理汇总了Java中android.view.KeyEvent.KEYCODE_PAGE_DOWN属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.KEYCODE_PAGE_DOWN属性的具体用法?Java KeyEvent.KEYCODE_PAGE_DOWN怎么用?Java KeyEvent.KEYCODE_PAGE_DOWN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.KEYCODE_PAGE_DOWN属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: playSoundEffect
/**
* Helper method to be used for playing sound effects.
*/
@Thunk private static void playSoundEffect(int keyCode, View v) {
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_LEFT:
v.playSoundEffect(SoundEffectConstants.NAVIGATION_LEFT);
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
v.playSoundEffect(SoundEffectConstants.NAVIGATION_RIGHT);
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
case KeyEvent.KEYCODE_PAGE_DOWN:
case KeyEvent.KEYCODE_MOVE_END:
v.playSoundEffect(SoundEffectConstants.NAVIGATION_DOWN);
break;
case KeyEvent.KEYCODE_DPAD_UP:
case KeyEvent.KEYCODE_PAGE_UP:
case KeyEvent.KEYCODE_MOVE_HOME:
v.playSoundEffect(SoundEffectConstants.NAVIGATION_UP);
break;
default:
break;
}
}
示例2: playSoundEffect
/**
* Helper method to be used for playing sound effects.
*/
@Thunk static void playSoundEffect(int keyCode, View v) {
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_LEFT:
v.playSoundEffect(SoundEffectConstants.NAVIGATION_LEFT);
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
v.playSoundEffect(SoundEffectConstants.NAVIGATION_RIGHT);
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
case KeyEvent.KEYCODE_PAGE_DOWN:
case KeyEvent.KEYCODE_MOVE_END:
v.playSoundEffect(SoundEffectConstants.NAVIGATION_DOWN);
break;
case KeyEvent.KEYCODE_DPAD_UP:
case KeyEvent.KEYCODE_PAGE_UP:
case KeyEvent.KEYCODE_MOVE_HOME:
v.playSoundEffect(SoundEffectConstants.NAVIGATION_UP);
break;
default:
break;
}
}
示例3: onKeyUp
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
Log.d("KEYS", event.toString());
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DPAD_LEFT:
case KeyEvent.KEYCODE_PAGE_UP:
previous();
return true;
case KeyEvent.KEYCODE_SPACE:
case KeyEvent.KEYCODE_DPAD_RIGHT:
case KeyEvent.KEYCODE_DPAD_CENTER:
case KeyEvent.KEYCODE_PAGE_DOWN:
advance();
return true;
case KeyEvent.KEYCODE_I:
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
case KeyEvent.KEYCODE_PERIOD:
display();
return true;
default:
return super.onKeyUp(keyCode, event);
}
}
示例4: onKey
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT
|| keyCode == KeyEvent.KEYCODE_PAGE_DOWN || keyCode == KeyEvent.KEYCODE_PAGE_UP) {
// Handle the key event just like a workspace icon would in these cases. In this case,
// it will basically act as if there is a single icon in the top left (so you could
// think of the fullscreen page as a focusable fullscreen widget).
return FocusHelper.handleIconKeyEvent(v, keyCode, event);
}
return false;
}
示例5: shouldConsume
/**
* Returns true only if this utility class handles the key code.
*/
public static boolean shouldConsume(int keyCode) {
return (keyCode == KeyEvent.KEYCODE_DPAD_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT ||
keyCode == KeyEvent.KEYCODE_DPAD_UP || keyCode == KeyEvent.KEYCODE_DPAD_DOWN ||
keyCode == KeyEvent.KEYCODE_MOVE_HOME || keyCode == KeyEvent.KEYCODE_MOVE_END ||
keyCode == KeyEvent.KEYCODE_PAGE_UP || keyCode == KeyEvent.KEYCODE_PAGE_DOWN);
}
示例6: shouldConsume
/**
* Returns true only if this utility class handles the key code.
*/
public static boolean shouldConsume(int keyCode) {
return (keyCode == KeyEvent.KEYCODE_DPAD_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT ||
keyCode == KeyEvent.KEYCODE_DPAD_UP || keyCode == KeyEvent.KEYCODE_DPAD_DOWN ||
keyCode == KeyEvent.KEYCODE_MOVE_HOME || keyCode == KeyEvent.KEYCODE_MOVE_END ||
keyCode == KeyEvent.KEYCODE_PAGE_UP || keyCode == KeyEvent.KEYCODE_PAGE_DOWN ||
keyCode == KeyEvent.KEYCODE_DEL || keyCode == KeyEvent.KEYCODE_FORWARD_DEL);
}
示例7: handleKeyEvent
public static int handleKeyEvent(int keyCode, int [][] map, int iconIdx, int pageIndex,
int pageCount, boolean isRtl) {
int cntX = map == null ? -1 : map.length;
int cntY = map == null ? -1 : map[0].length;
int newIndex = NOOP;
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_LEFT:
newIndex = handleDpadHorizontal(iconIdx, cntX, cntY, map, -1 /*increment*/, isRtl);
if (!isRtl && newIndex == NOOP && pageIndex > 0) {
newIndex = PREVIOUS_PAGE_RIGHT_COLUMN;
} else if (isRtl && newIndex == NOOP && pageIndex < pageCount - 1) {
newIndex = NEXT_PAGE_RIGHT_COLUMN;
}
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
newIndex = handleDpadHorizontal(iconIdx, cntX, cntY, map, 1 /*increment*/, isRtl);
if (!isRtl && newIndex == NOOP && pageIndex < pageCount - 1) {
newIndex = NEXT_PAGE_LEFT_COLUMN;
} else if (isRtl && newIndex == NOOP && pageIndex > 0) {
newIndex = PREVIOUS_PAGE_LEFT_COLUMN;
}
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
newIndex = handleDpadVertical(iconIdx, cntX, cntY, map, 1 /*increment*/);
break;
case KeyEvent.KEYCODE_DPAD_UP:
newIndex = handleDpadVertical(iconIdx, cntX, cntY, map, -1 /*increment*/);
break;
case KeyEvent.KEYCODE_MOVE_HOME:
newIndex = handleMoveHome();
break;
case KeyEvent.KEYCODE_MOVE_END:
newIndex = handleMoveEnd();
break;
case KeyEvent.KEYCODE_PAGE_DOWN:
newIndex = handlePageDown(pageIndex, pageCount);
break;
case KeyEvent.KEYCODE_PAGE_UP:
newIndex = handlePageUp(pageIndex);
break;
default:
break;
}
return newIndex;
}
示例8: handleKeyEvent
public static int handleKeyEvent(int keyCode, int [][] map, int iconIdx, int pageIndex,
int pageCount, boolean isRtl) {
int cntX = map == null ? -1 : map.length;
int cntY = map == null ? -1 : map[0].length;
if (DEBUG) {
Log.v(TAG, String.format(
"handleKeyEvent START: cntX=%d, cntY=%d, iconIdx=%d, pageIdx=%d, pageCnt=%d",
cntX, cntY, iconIdx, pageIndex, pageCount));
}
int newIndex = NOOP;
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_LEFT:
newIndex = handleDpadHorizontal(iconIdx, cntX, cntY, map, -1 /*increment*/, isRtl);
if (!isRtl && newIndex == NOOP && pageIndex > 0) {
newIndex = PREVIOUS_PAGE_RIGHT_COLUMN;
} else if (isRtl && newIndex == NOOP && pageIndex < pageCount - 1) {
newIndex = NEXT_PAGE_RIGHT_COLUMN;
}
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
newIndex = handleDpadHorizontal(iconIdx, cntX, cntY, map, 1 /*increment*/, isRtl);
if (!isRtl && newIndex == NOOP && pageIndex < pageCount - 1) {
newIndex = NEXT_PAGE_LEFT_COLUMN;
} else if (isRtl && newIndex == NOOP && pageIndex > 0) {
newIndex = PREVIOUS_PAGE_LEFT_COLUMN;
}
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
newIndex = handleDpadVertical(iconIdx, cntX, cntY, map, 1 /*increment*/);
break;
case KeyEvent.KEYCODE_DPAD_UP:
newIndex = handleDpadVertical(iconIdx, cntX, cntY, map, -1 /*increment*/);
break;
case KeyEvent.KEYCODE_MOVE_HOME:
newIndex = handleMoveHome();
break;
case KeyEvent.KEYCODE_MOVE_END:
newIndex = handleMoveEnd();
break;
case KeyEvent.KEYCODE_PAGE_DOWN:
newIndex = handlePageDown(pageIndex, pageCount);
break;
case KeyEvent.KEYCODE_PAGE_UP:
newIndex = handlePageUp(pageIndex);
break;
default:
break;
}
if (DEBUG) {
Log.v(TAG, String.format("handleKeyEvent FINISH: index [%d -> %s]",
iconIdx, getStringIndex(newIndex)));
}
return newIndex;
}