本文整理匯總了Java中android.view.KeyEvent.KEYCODE_PAGE_UP屬性的典型用法代碼示例。如果您正苦於以下問題:Java KeyEvent.KEYCODE_PAGE_UP屬性的具體用法?Java KeyEvent.KEYCODE_PAGE_UP怎麽用?Java KeyEvent.KEYCODE_PAGE_UP使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.view.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.KEYCODE_PAGE_UP屬性的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;
}