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


Java KeyEvent.KEYCODE_DPAD_RIGHT属性代码示例

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


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

示例1: 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) {
	boolean handled = false;
	if (event.getAction() == KeyEvent.ACTION_DOWN) {
		switch (event.getKeyCode()) {
		case KeyEvent.KEYCODE_DPAD_LEFT:
			handled = arrowScroll(FOCUS_LEFT);
			break;
		case KeyEvent.KEYCODE_DPAD_RIGHT:
			handled = arrowScroll(FOCUS_RIGHT);
			break;
		case KeyEvent.KEYCODE_TAB:
			if (Build.VERSION.SDK_INT >= 11) {
				// The focus finder had a bug handling FOCUS_FORWARD and FOCUS_BACKWARD
				// before Android 3.0. Ignore the tab key on those devices.
				if (KeyEventCompat.hasNoModifiers(event)) {
					handled = arrowScroll(FOCUS_FORWARD);
				} else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_SHIFT_ON)) {
					handled = arrowScroll(FOCUS_BACKWARD);
				}
			}
			break;
		}
	}
	return handled;
}
 
开发者ID:QuixomTech,项目名称:WeatherStream,代码行数:33,代码来源:CustomViewAbove.java

示例2: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
	int increment = selectedColorIndex;
	switch (keyCode) {
		case KeyEvent.KEYCODE_DPAD_LEFT:
		case KeyEvent.KEYCODE_MINUS:
			increment = Utils.isRTL() ? increment + 1 : increment -1;
			if(increment < 0){
				return false;
			}
			setSelectedColorPosition(increment);
			return true;

		case KeyEvent.KEYCODE_DPAD_RIGHT:
		case KeyEvent.KEYCODE_PLUS:
			increment =  Utils.isRTL() ? increment - 1  : increment + 1;
			if(increment >= colors.length){
				return false;
			}
			setSelectedColorPosition(increment);
			return true;
	}
	return super.onKeyDown(keyCode, event);
}
 
开发者ID:gigabytedevelopers,项目名称:FireFiles,代码行数:24,代码来源:LineColorPicker.java

示例3: 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) {
    boolean handled = false;
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
        switch (event.getKeyCode()) {
            case KeyEvent.KEYCODE_DPAD_LEFT:
                handled = arrowScroll(FOCUS_LEFT);
                break;
            case KeyEvent.KEYCODE_DPAD_RIGHT:
                handled = arrowScroll(FOCUS_RIGHT);
                break;
            case KeyEvent.KEYCODE_TAB:
                if (Build.VERSION.SDK_INT >= 11) {
                    // The focus finder had a bug handling FOCUS_FORWARD and FOCUS_BACKWARD
                    // before Android 3.0. Ignore the tab key on those devices.
                    if (KeyEventCompat.hasNoModifiers(event)) {
                        handled = arrowScroll(FOCUS_FORWARD);
                    } else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_SHIFT_ON)) {
                        handled = arrowScroll(FOCUS_BACKWARD);
                    }
                }
                break;
        }
    }
    return handled;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:33,代码来源:VerticalViewPager.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:michelelacorte,项目名称:FlickLauncher,代码行数:25,代码来源:FocusHelper.java

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

示例7: executeKeyEvent

/**
 * 执行按键响应事件
 */
public boolean executeKeyEvent(KeyEvent event) {
    boolean handled = false;
    if (event.getAction() == KeyEvent.ACTION_DOWN) {
        switch (event.getKeyCode()) {
            case KeyEvent.KEYCODE_DPAD_LEFT:
                handled = arrowScroll(FOCUS_LEFT);
                break;
            case KeyEvent.KEYCODE_DPAD_RIGHT:
                handled = arrowScroll(FOCUS_RIGHT);
                break;
            case KeyEvent.KEYCODE_TAB:
                if (Build.VERSION.SDK_INT >= 11) {
                    // The focus finder had a bug handling FOCUS_FORWARD and FOCUS_BACKWARD
                    // before Android 3.0. Ignore the tab key on those devices.
                    if (KeyEventCompat.hasNoModifiers(event)) {
                        handled = arrowScroll(FOCUS_FORWARD);
                    } else if (KeyEventCompat.hasModifiers(event, KeyEvent.META_SHIFT_ON)) {
                        handled = arrowScroll(FOCUS_BACKWARD);
                    }
                }
                break;
        }
    }
    return handled;
}
 
开发者ID:Datatellit,项目名称:xlight_android_native,代码行数:28,代码来源:CustomViewAbove.java

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

示例9: onKeyUp

public boolean onKeyUp(int keyCode, KeyEvent event) {

            // Handle keys going up.
            boolean handled = false;
            switch (keyCode) {
                case KeyEvent.KEYCODE_DPAD_LEFT:
                    setHeadingX(0);
                    mDPadState &= ~DPAD_STATE_LEFT;
                    handled = true;
                    break;
                case KeyEvent.KEYCODE_DPAD_RIGHT:
                    setHeadingX(0);
                    mDPadState &= ~DPAD_STATE_RIGHT;
                    handled = true;
                    break;
                case KeyEvent.KEYCODE_DPAD_UP:
                    setHeadingY(0);
                    mDPadState &= ~DPAD_STATE_UP;
                    handled = true;
                    break;
                case KeyEvent.KEYCODE_DPAD_DOWN:
                    setHeadingY(0);
                    mDPadState &= ~DPAD_STATE_DOWN;
                    handled = true;
                    break;
                default:
                    if (isFireKey(keyCode)) {
                        handled = true;
                    }
                    break;
            }
            return handled;
        }
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:33,代码来源:GameView.java

示例10: onKeyUp

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    switch(keyCode) {
        case KeyEvent.KEYCODE_DPAD_RIGHT:
            updateNextDrawable((getDelay() < mMax || !hasMax) ? R.drawable.arrow_right : -1);
            return true;
        case KeyEvent.KEYCODE_DPAD_LEFT:
            updatePreviousDrawable((getDelay() > mMin || !hasMin) ? R.drawable.arrow_left : -1);
            return true;
    }
    return TVUtils.isOKKey(keyCode);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:12,代码来源:TimerDelayTVPicker.java

示例11: onKey

@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT
            || keyCode == KeyEvent.KEYCODE_PAGE_DOWN || keyCode == KeyEvent.KEYCODE_PAGE_UP) {
        // Handle the key event just like a workspace icon would in these cases. In this case,
        // it will basically act as if there is a single icon in the top left (so you could
        // think of the fullscreen page as a focusable fullscreen widget).
        return FocusHelper.handleIconKeyEvent(v, keyCode, event);
    }
    return false;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:11,代码来源:FocusHelper.java

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

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

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

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


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