当前位置: 首页>>代码示例>>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;未经允许,请勿转载。