本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}