當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。