本文整理汇总了Java中android.view.KeyEvent.KEYCODE_MOVE_HOME属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.KEYCODE_MOVE_HOME属性的具体用法?Java KeyEvent.KEYCODE_MOVE_HOME怎么用?Java KeyEvent.KEYCODE_MOVE_HOME使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.KEYCODE_MOVE_HOME属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例4: 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);
}
示例5: 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;
}
示例6: 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;
}