当前位置: 首页>>代码示例>>Java>>正文


Java KeyEvent.KEYCODE_DPAD_DOWN属性代码示例

本文整理汇总了Java中android.view.KeyEvent.KEYCODE_DPAD_DOWN属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.KEYCODE_DPAD_DOWN属性的具体用法?Java KeyEvent.KEYCODE_DPAD_DOWN怎么用?Java KeyEvent.KEYCODE_DPAD_DOWN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.view.KeyEvent的用法示例。


在下文中一共展示了KeyEvent.KEYCODE_DPAD_DOWN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    //click mapping
    if(TVUtils.isOKKey(keyCode) &&ocl!=null) {
        this.ocl.onClick(this);
        return true;
    }
    //handle focus on dialog
    else if ((keyCode == KeyEvent.KEYCODE_DPAD_DOWN||keyCode == KeyEvent.KEYCODE_DPAD_UP)&&this.ofol!=null) {
        View v = findFocus().focusSearch(keyCode == KeyEvent.KEYCODE_DPAD_DOWN?FOCUS_DOWN:FOCUS_UP);
        if(v instanceof TVMenuSeparator){
        	v = v.focusSearch(keyCode == KeyEvent.KEYCODE_DPAD_DOWN?FOCUS_DOWN:FOCUS_UP);          	
        }
        if(isViewInCard(v)){
        	v.requestFocus();
        	return true;
        }
        else if(this.ofol!=null)
        	return this.ofol.onFocusOut(keyCode);
    }
    return false;

}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:23,代码来源:TVCardView.java

示例2: onKeyDown

/**
 * Handles key events in the game. Update the direction our snake is traveling based on the
 * DPAD.
 *
 */
@Override
public boolean onKeyDown(int keyCode, KeyEvent msg) {

    switch (keyCode) {
        case KeyEvent.KEYCODE_DPAD_UP:
            mSnakeView.moveSnake(MOVE_UP);
            break;
        case KeyEvent.KEYCODE_DPAD_RIGHT:
            mSnakeView.moveSnake(MOVE_RIGHT);
            break;
        case KeyEvent.KEYCODE_DPAD_DOWN:
            mSnakeView.moveSnake(MOVE_DOWN);
            break;
        case KeyEvent.KEYCODE_DPAD_LEFT:
            mSnakeView.moveSnake(MOVE_LEFT);
            break;
    }

    return super.onKeyDown(keyCode, msg);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:25,代码来源:Snake.java

示例3: dispatchKeyEvent

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
        switch (event.getKeyCode()) {
            case KeyEvent.KEYCODE_DPAD_RIGHT:
                lineByLineMoveTo(1);
                return true;
            case KeyEvent.KEYCODE_DPAD_LEFT:
                lineByLineMoveTo(-1);
                return true;
            case KeyEvent.KEYCODE_DPAD_DOWN:
                verticalDpadScroll(1);
                return true;
            case KeyEvent.KEYCODE_DPAD_UP:
                verticalDpadScroll(-1);
                return true;
        }
    }
    return super.dispatchKeyEvent(event);
}
 
开发者ID:lidong1665,项目名称:AndroidPDF,代码行数:20,代码来源:DocumentView.java

示例4: 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;
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:25,代码来源:FocusHelper.java

示例5: 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;
    }
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:25,代码来源:FocusHelper.java

示例6: dispatchKeyEvent

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    final int keyCode = event.getKeyCode();
    switch (keyCode) {
        case KeyEvent.KEYCODE_DPAD_CENTER:
        case KeyEvent.KEYCODE_ENTER:
            removeAllCallbacks();
            break;
        case KeyEvent.KEYCODE_DPAD_DOWN:
        case KeyEvent.KEYCODE_DPAD_UP:
            if (!mHasSelectorWheel) {
                break;
            }
            switch (event.getAction()) {
                case KeyEvent.ACTION_DOWN:
                    if (mWrapSelectorWheel || ((keyCode == KeyEvent.KEYCODE_DPAD_DOWN)
                            ? getValue() < getMaxValue() : getValue() > getMinValue())) {
                        requestFocus();
                        mLastHandledDownDpadKeyCode = keyCode;
                        removeAllCallbacks();
                        if (mFlingScroller.isFinished()) {
                            changeValueByOne(keyCode == KeyEvent.KEYCODE_DPAD_DOWN);
                        }
                        return true;
                    }
                    break;
                case KeyEvent.ACTION_UP:
                    if (mLastHandledDownDpadKeyCode == keyCode) {
                        mLastHandledDownDpadKeyCode = -1;
                        return true;
                    }
                    break;
            }
    }
    return super.dispatchKeyEvent(event);
}
 
开发者ID:Gericop,项目名称:DateTimePicker,代码行数:36,代码来源:NumberPicker.java

示例7: 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);
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:9,代码来源:FocusLogic.java

示例8: 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);
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:10,代码来源:FocusLogic.java

示例9: dispatchKeyEvent

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    if (mOnInterceptListener != null && mOnInterceptListener.onIntercept(event)) {
        return true;
    }
    boolean result = super.dispatchKeyEvent(event);
    View focusView = this.getFocusedChild();
    if (focusView == null) {
        return result;
    } else {
        // TODO: 2017-11-3 解决不同viewType的item滑动
        int dy = 0;
        int dx = 0;
        if (getChildCount() > 0) {
            View firstView = this.getChildAt(0);
            dy = firstView.getHeight();
            dx = firstView.getWidth();
        }
        if (event.getAction() == KeyEvent.ACTION_UP
                && keyCodeOfDPAD(event)) {
            return true;
        } else {
            switch (event.getKeyCode()) {
                case KeyEvent.KEYCODE_DPAD_RIGHT:
                    return findNextFocusView(focusView, new Point(dx, 0), View.FOCUS_RIGHT);
                case KeyEvent.KEYCODE_DPAD_LEFT:
                    return findNextFocusView(focusView, new Point(-dx, 0), View.FOCUS_LEFT);
                case KeyEvent.KEYCODE_DPAD_DOWN:
                    return findNextFocusView(focusView, new Point(0, dy), View.FOCUS_DOWN);
                case KeyEvent.KEYCODE_DPAD_UP:
                    return findNextFocusView(focusView, new Point(0, -dy), View.FOCUS_UP);
            }
        }
    }


    return result;
}
 
开发者ID:kevinhqf,项目名称:TVRecyclerView,代码行数:38,代码来源:TVRecyclerView.java

示例10: isNavigationKey

public static boolean isNavigationKey(KeyEvent event) {
	int keyCode = event.getKeyCode();
	return keyCode == KeyEvent.KEYCODE_DPAD_DOWN ||
		keyCode == KeyEvent.KEYCODE_DPAD_UP ||
		keyCode == KeyEvent.KEYCODE_DPAD_RIGHT ||
		keyCode == KeyEvent.KEYCODE_DPAD_LEFT;
}
 
开发者ID:MikaGuraN,项目名称:HL4A,代码行数:7,代码来源:KeysInterpreter.java

示例11: handleKeyActionUp

private boolean handleKeyActionUp(View v, int keyCode, KeyEvent event) {
    if(isInterruptOnKeyActionUp(v, keyCode, event)){
        return true;
    }
    switch (keyCode){
        case KeyEvent.KEYCODE_DPAD_UP:
            PLog.d(TAG,"onKeyActionUp : dpad up");
            return onKeyActionUpDpadUp(v, keyCode, event);

        case KeyEvent.KEYCODE_DPAD_DOWN:
            PLog.d(TAG,"onKeyActionUp : dpad down");
            return onKeyActionUpDpadDown(v, keyCode, event);

        case KeyEvent.KEYCODE_DPAD_LEFT:
            PLog.d(TAG,"onKeyActionUp : dpad left");
            return onKeyActionUpDpadLeft(v, keyCode, event);

        case KeyEvent.KEYCODE_DPAD_RIGHT:
            PLog.d(TAG,"onKeyActionUp : dpad right");
            return onKeyActionUpDpadRight(v, keyCode, event);

        case KeyEvent.KEYCODE_DPAD_CENTER:
        case KeyEvent.KEYCODE_ENTER:
            PLog.d(TAG,"onKeyActionUp : dpad enter");
            return onKeyActionUpDpadEnter(v, keyCode, event);

        case KeyEvent.KEYCODE_BACK:
            PLog.d(TAG,"onKeyActionUp : dpad back");
            return onKeyActionUpDpadBack(v, keyCode, event);

        case KeyEvent.KEYCODE_MENU:
            PLog.d(TAG,"onKeyActionUp : dpad menu");
            return onKeyActionUpDpadMenu(v, keyCode, event);
    }
    return false;
}
 
开发者ID:jiajunhui,项目名称:PlayerBase,代码行数:36,代码来源:BaseFocusCover.java

示例12: executeKeyEvent

@Override
public boolean executeKeyEvent(KeyEvent event) {
    // Ignore all key events except arrow keys and spacebar. Otherwise, the ScrollView consumes
    // unwanted events (including the hardware menu button and app-level keyboard shortcuts).
    // http://crbug.com/308322
    switch (event.getKeyCode()) {
        case KeyEvent.KEYCODE_DPAD_UP:
        case KeyEvent.KEYCODE_DPAD_DOWN:
        case KeyEvent.KEYCODE_SPACE:
            return super.executeKeyEvent(event);
        default:
            return false;
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:14,代码来源:NewTabPageScrollView.java

示例13: onKeyDown

public boolean onKeyDown(int keyCode, KeyEvent event) {
    // Handle DPad keys and fire button on initial down but not on
    // auto-repeat.
    boolean handled = false;
    if (event.getRepeatCount() == 0) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_DPAD_LEFT:
                setHeadingX(-1);
                mDPadState |= DPAD_STATE_LEFT;
                handled = true;
                break;
            case KeyEvent.KEYCODE_DPAD_RIGHT:
                setHeadingX(1);
                mDPadState |= DPAD_STATE_RIGHT;
                handled = true;
                break;
            case KeyEvent.KEYCODE_DPAD_UP:
                setHeadingY(-1);
                mDPadState |= DPAD_STATE_UP;
                handled = true;
                break;
            case KeyEvent.KEYCODE_DPAD_DOWN:
                setHeadingY(1);
                mDPadState |= DPAD_STATE_DOWN;
                handled = true;
                break;
            default:
                if (isFireKey(keyCode)) {
                    fire();
                    handled = true;
                }
                break;
        }
    }
    return handled;
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:36,代码来源:GameView.java

示例14: extOnKeyEvent

@Override
public boolean extOnKeyEvent(KeyEvent event) {
    int keyCode = event.getKeyCode();
    switch (keyCode) {
        case KeyEvent.KEYCODE_DPAD_LEFT:
        case KeyEvent.KEYCODE_DPAD_RIGHT:
        case KeyEvent.KEYCODE_DPAD_UP:
        case KeyEvent.KEYCODE_DPAD_DOWN:
            return dispatchKeyEvent(event);
    }
    return false;
}
 
开发者ID:starcor-company,项目名称:starcor.xul,代码行数:12,代码来源:XulExt_ExternalEditBox.java

示例15: 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;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:58,代码来源:FocusLogic.java


注:本文中的android.view.KeyEvent.KEYCODE_DPAD_DOWN属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。