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


Java KeyEvent.KEYCODE_DPAD_CENTER屬性代碼示例

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


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

示例1: onKeyUp

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
	switch (keyCode) {
	case KeyEvent.KEYCODE_DPAD_CENTER:
	case KeyEvent.KEYCODE_ENTER:
		if (!isEnabled()) {
			return true;
		}
		if (isClickable() && isPressed() && mSelectedPosition >= 0
				&& mAdapter != null
				&& mSelectedPosition < mAdapter.getCount()) {

			final View view = getChildAt(mSelectedPosition - mFirstPosition);
			if (view != null) {
				performItemClick(view, mSelectedPosition, mSelectedColId);
				view.setPressed(false);
			}
			setPressed(false);
			return true;
		}
		break;
	}
	return super.onKeyUp(keyCode, event);
}
 
開發者ID:junchenChow,項目名稱:exciting-app,代碼行數:24,代碼來源:AbsHListView.java

示例2: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    switch (keyCode) {
        case KeyEvent.KEYCODE_DPAD_CENTER:
            Log.e(TAG, "onKeyDown: ok");
            break;

        case KeyEvent.KEYCODE_DPAD_DOWN:
            Log.e(TAG, "onKeyDown: down");
            mViewPager.requestFocus();
            break;

        case KeyEvent.KEYCODE_DPAD_LEFT:
            Log.e(TAG, "onKeyDown: left");
            break;

        case KeyEvent.KEYCODE_DPAD_RIGHT:
            Log.e(TAG, "onKeyDown: right");
            break;

        case KeyEvent.KEYCODE_DPAD_UP:
            Log.e(TAG, "onKeyDown: up");
            break;
    }
    return super.onKeyDown(keyCode, event);
}
 
開發者ID:xfangfang,項目名稱:NeuTV,代碼行數:26,代碼來源:MainActivity.java

示例3: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    mVelocity++;
    int v = (int)Math.sqrt(1 + mVelocity / 2);
    if (mListener != null) {
        if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) {
            mListener.markerLeft(this, v);
            return true;
        } else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
            mListener.markerRight(this, v);
            return true;
        } else if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
            mListener.markerEnter(this);
            return true;
        }
    }

    return super.onKeyDown(keyCode, event);
}
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:19,代碼來源:MarkerView.java

示例4: onKey

public boolean onKey(View v, int keyCode, KeyEvent event) {
    if ((keyCode == KeyEvent.KEYCODE_DPAD_CENTER || keyCode == KeyEvent.KEYCODE_ENTER) && event.getAction() == KeyEvent.ACTION_DOWN) {
        View focusedItem = mListView.getSelectedView();
        if (focusedItem != null) {
            // The user is using the Archos remote to control this activity and he pressed the OK key
            // while an item of the listview was highlighted => make as if he pressed the reject button
            int position = mListView.getPositionForView(focusedItem);
            rejectScraperInfos(position);
            return true;
        }
    }
    else if ((keyCode == KeyEvent.KEYCODE_DPAD_UP || keyCode == KeyEvent.KEYCODE_DPAD_DOWN) && event.getAction() == KeyEvent.ACTION_DOWN) {
        mScrollingWithKeys = true;
    }
    return false;
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:16,代碼來源:AutoScraperActivity.java

示例5: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
  if (isEnabled()) {
    long positionIncrement = getPositionIncrement();
    switch (keyCode) {
      case KeyEvent.KEYCODE_DPAD_LEFT:
        positionIncrement = -positionIncrement;
        // Fall through.
      case KeyEvent.KEYCODE_DPAD_RIGHT:
        if (scrubIncrementally(positionIncrement)) {
          removeCallbacks(stopScrubbingRunnable);
          postDelayed(stopScrubbingRunnable, STOP_SCRUBBING_TIMEOUT_MS);
          return true;
        }
        break;
      case KeyEvent.KEYCODE_DPAD_CENTER:
      case KeyEvent.KEYCODE_ENTER:
        if (scrubbing) {
          removeCallbacks(stopScrubbingRunnable);
          stopScrubbingRunnable.run();
          return true;
        }
        break;
      default:
        // Do nothing.
    }
  }
  return super.onKeyDown(keyCode, event);
}
 
開發者ID:yangchaojiang,項目名稱:yjPlay,代碼行數:29,代碼來源:DefaultTimeBar.java

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

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

示例8: onKeyDown

@Override
public boolean onKeyDown(final int keyCode, final KeyEvent event) {
    switch (keyCode) {
        case KeyEvent.KEYCODE_DPAD_CENTER:
        case KeyEvent.KEYCODE_ENTER:
            /*
             * Need to call super to make long press work, but return true
             * so that the application doesn't get the down event
             */
            super.onKeyDown(keyCode, event);
            return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:14,代碼來源:RepeatingImageButton.java

示例9: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
    if (KeyEvent.KEYCODE_DPAD_CENTER == keyCode || KeyEvent.KEYCODE_ENTER == keyCode)
    {
        if (videoList.getVisibility() != View.VISIBLE)
        {
            videoList.setVisibility(View.VISIBLE);
            tips.setVisibility(View.INVISIBLE);
            mRecyclerViewBridge.setVisibleWidget(false);
            videoList.requestFocus();
        }
    }
    else if (KeyEvent.KEYCODE_BACK == keyCode)
    {
        if (videoList.getVisibility() == View.VISIBLE)
        {
            videoList.setVisibility(View.INVISIBLE);
            tips.setVisibility(View.VISIBLE);
            mRecyclerViewBridge.setVisibleWidget(true);
            return true;
        }
    }
    else if (KeyEvent.KEYCODE_MENU == keyCode)
    {
        if (videoList.getVisibility() != View.VISIBLE)
        {
            videoList.setVisibility(View.VISIBLE);
            tips.setVisibility(View.INVISIBLE);
            videoList.requestFocus();
            mRecyclerViewBridge.setVisibleWidget(false);
        }
    }
    return super.onKeyDown(keyCode, event);
}
 
開發者ID:Dreamxiaoxuan,項目名稱:AndroidTvDemo,代碼行數:35,代碼來源:LiveVideoActivity.java

示例10: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (isEnabled()) {
        long positionIncrement = getPositionIncrement();
        switch (keyCode) {
            case KeyEvent.KEYCODE_DPAD_LEFT:
                positionIncrement = -positionIncrement;
                // Fall through.
            case KeyEvent.KEYCODE_DPAD_RIGHT:
                if (scrubIncrementally(positionIncrement)) {
                    removeCallbacks(stopScrubbingRunnable);
                    postDelayed(stopScrubbingRunnable, STOP_SCRUBBING_TIMEOUT_MS);
                    return true;
                }
                break;
            case KeyEvent.KEYCODE_DPAD_CENTER:
            case KeyEvent.KEYCODE_ENTER:
                if (scrubbing) {
                    removeCallbacks(stopScrubbingRunnable);
                    stopScrubbingRunnable.run();
                    return true;
                }
                break;
            default:
                // Do nothing.
        }
    }
    return super.onKeyDown(keyCode, event);
}
 
開發者ID:hongcwamazing,項目名稱:PreviewSeekBar-master,代碼行數:29,代碼來源:CustomTimeBar.java

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

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

示例13: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    switch (keyCode) {
        case KeyEvent.KEYCODE_DPAD_CENTER:
        case KeyEvent.KEYCODE_ENTER:
            // need to call super to make long press work, but return
            // true so that the application doesn't get the down event.
            super.onKeyDown(keyCode, event);
            return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:12,代碼來源:RepeatingImageButton.java

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

示例15: onKeyUp

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if ((keyCode == KeyEvent.KEYCODE_DPAD_CENTER)
            || (keyCode == KeyEvent.KEYCODE_ENTER)) {
        cancelLongpress();
    }
    return super.onKeyUp(keyCode, event);
}
 
開發者ID:tiberiusteng,項目名稱:financisto1-holo,代碼行數:8,代碼來源:NumberPickerButton.java


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