當前位置: 首頁>>代碼示例>>Java>>正文


Java KeyEvent.KEYCODE_DPAD_UP屬性代碼示例

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


在下文中一共展示了KeyEvent.KEYCODE_DPAD_UP屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    boolean handled = false;
    // When using DPad, show all the OSD so that focus can move freely
    // from/to ActionBar to/from PlayerController
    switch (keyCode) {

        case KeyEvent.KEYCODE_DPAD_UP:
            if(mPlayerController!=null){
                return mPlayerController.onKey(keyCode, event); 
            }
            break;
        case KeyEvent.KEYCODE_I:
            showVideoInfos();
            handled = true;
            break;
    }

    if (!mStopped && (mPlayerController!=null) &&mPlayerControllerPlaceholder!=null&&!handled) {
        // Send key event to PlayerController if it (its place-holder actually) has the focus
        // Only keep keys used for focus navigation (because this is not handled by PlayerController)
        handled = mPlayerController.onKey(keyCode, event);
    }
    return handled ? true : super.onKeyDown(keyCode, event);
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:25,代碼來源:PlayerActivity.java

示例2: 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

示例3: processKey

private boolean processKey(KeyEvent event, boolean realAction) {
    int keyCode = event.getKeyCode();
    // 按返回鍵.
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        return false;
    }
    switch (keyCode) {
        case KeyEvent.KEYCODE_BACK:
            return false;
        case KeyEvent.KEYCODE_DPAD_DOWN:
        case KeyEvent.KEYCODE_DPAD_RIGHT:
        case KeyEvent.KEYCODE_DPAD_LEFT:
        case KeyEvent.KEYCODE_DPAD_UP:
            //
            if (realAction)
                mRootView.onKeyDown(keyCode, event);
            else
                mRootView.onKeyUp(keyCode, event);
            return true;
        default:
            break;
    }

    return true;
}
 
開發者ID:junchenChow,項目名稱:exciting-app,代碼行數:25,代碼來源:EmojiIME.java

示例4: isDpadKey

@SuppressLint("InlinedApi")
private boolean isDpadKey(int keyCode) {
    return keyCode == KeyEvent.KEYCODE_DPAD_UP || keyCode == KeyEvent.KEYCODE_DPAD_UP_RIGHT
            || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT || keyCode == KeyEvent.KEYCODE_DPAD_DOWN_RIGHT
            || keyCode == KeyEvent.KEYCODE_DPAD_DOWN || keyCode == KeyEvent.KEYCODE_DPAD_DOWN_LEFT
            || keyCode == KeyEvent.KEYCODE_DPAD_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_UP_LEFT
            || keyCode == KeyEvent.KEYCODE_DPAD_CENTER;
}
 
開發者ID:yangchaojiang,項目名稱:yjPlay,代碼行數:8,代碼來源:SimpleExoPlayerView.java

示例5: dispatchKeyEvent

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    if (tvCursorManager != null && tvCursorManager.isShowCursor() && !isIMEMode) {
        if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_DOWN ||
                event.getKeyCode() == KeyEvent.KEYCODE_DPAD_UP ||
                event.getKeyCode() == KeyEvent.KEYCODE_DPAD_LEFT ||
                event.getKeyCode() == KeyEvent.KEYCODE_DPAD_RIGHT ||
                event.getKeyCode() == KeyEvent.KEYCODE_DPAD_CENTER)
            return tvCursorManager.onDpadClicked(event);
    }
    return super.dispatchKeyEvent(event);
}
 
開發者ID:jasonhancn,項目名稱:AndroidTVCursor,代碼行數:12,代碼來源:TvCursorActivity.java

示例6: handleKeyActionDown

private boolean handleKeyActionDown(View v, int keyCode, KeyEvent event) {
    if(isInterruptOnKeyActionDown(v, keyCode, event)){
        return true;
    }
    switch (keyCode){
        case KeyEvent.KEYCODE_DPAD_UP:
            PLog.d(TAG,"onKeyActionDown : dpad up");
            return onKeyActionDownDpadUp(v, keyCode, event);

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

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

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

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

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

        case KeyEvent.KEYCODE_MENU:
            PLog.d(TAG,"onKeyActionDown : dpad menu");
            return onKeyActionDownDpadMenu(v, keyCode, event);
    }
    return false;
}
 
開發者ID:jiajunhui,項目名稱:PlayerBase,代碼行數:36,代碼來源:BaseFocusCover.java

示例7: 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

示例8: onKeyDown

public boolean onKeyDown(int kCode, KeyEvent kEvent) {
    switch (kCode) {
        case KeyEvent.KEYCODE_DPAD_LEFT:
        case KeyEvent.KEYCODE_DPAD_UP:
        case KeyEvent.KEYCODE_DPAD_RIGHT:
        case KeyEvent.KEYCODE_DPAD_DOWN:
        case KeyEvent.KEYCODE_DPAD_CENTER:
            break;
        case KeyEvent.KEYCODE_BACK:
            exitBy2Click();
            return true;
    }
    return super.onKeyDown(kCode, kEvent);
}
 
開發者ID:ronghao,項目名稱:FrameAnimationView,代碼行數:14,代碼來源:MainActivity.java

示例9: 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:
            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:MLNO,項目名稱:airgram,代碼行數:33,代碼來源:NumberPicker.java

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: executeKeyEvent

/**
 * You can call this function yourself to have the scroll view perform
 * scrolling from a key event, just as if the event had been dispatched to
 * it by the view hierarchy.
 *
 * @param event The key event to execute.
 * @return Return true if the event was handled, else false.
 */
public boolean executeKeyEvent(KeyEvent event) {
    mTempRect.setEmpty();
    if (!canScroll()) {
        if (isFocused()) {
            View currentFocused = findFocus();
            if (currentFocused == this) currentFocused = null;
            View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, View.FOCUS_DOWN);
            return nextFocused != null && nextFocused != this && nextFocused.requestFocus(View.FOCUS_DOWN);
        }
        return false;
    }
    boolean handled = false;
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
        switch (event.getKeyCode()) {
            case KeyEvent.KEYCODE_DPAD_UP:
                if (!event.isAltPressed()) {
                    handled = arrowScroll(View.FOCUS_UP, false);
                } else {
                    handled = fullScroll(View.FOCUS_UP, false);
                }
                break;
            case KeyEvent.KEYCODE_DPAD_DOWN:
                if (!event.isAltPressed()) {
                    handled = arrowScroll(View.FOCUS_DOWN, false);
                } else {
                    handled = fullScroll(View.FOCUS_DOWN, false);
                }
                break;
            case KeyEvent.KEYCODE_DPAD_LEFT:
                if (!event.isAltPressed()) {
                    handled = arrowScroll(View.FOCUS_LEFT, true);
                } else {
                    handled = fullScroll(View.FOCUS_LEFT, true);
                }
                break;
            case KeyEvent.KEYCODE_DPAD_RIGHT:
                if (!event.isAltPressed()) {
                    handled = arrowScroll(View.FOCUS_RIGHT, true);
                } else {
                    handled = fullScroll(View.FOCUS_RIGHT, true);
                }
                break;
        }
    }
    return handled;
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:54,代碼來源:TwoDScrollView.java

示例15: 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:helenepang,項目名稱:LimitedDatePicker,代碼行數:36,代碼來源:NumberPicker.java


注:本文中的android.view.KeyEvent.KEYCODE_DPAD_UP屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。