Java Code Examples for android.view.KeyEvent#KEYCODE_DPAD_RIGHT
The following examples show how to use
android.view.KeyEvent#KEYCODE_DPAD_RIGHT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VerticalViewPager.java From ankihelper with GNU General Public License v3.0 | 8 votes |
/** * 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 (KeyEvent.metaStateHasNoModifiers(event.getMetaState())) { handled = arrowScroll(FOCUS_FORWARD); } else if (KeyEvent.metaStateHasNoModifiers(event.getMetaState())) { handled = arrowScroll(FOCUS_BACKWARD); } } break; } } return handled; }
Example 2
Source File: ViewPager.java From android-recipes-app with Apache License 2.0 | 6 votes |
/** * 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; }
Example 3
Source File: ViewPager.java From adt-leanback-support with Apache License 2.0 | 6 votes |
/** * 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; }
Example 4
Source File: VerticalViewPager.java From SprintNBA with Apache License 2.0 | 6 votes |
/** * 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; }
Example 5
Source File: WeekDatePicker.java From WeekDatePicker with MIT License | 6 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (!isEnabled()) { return super.onKeyDown(keyCode, event); } switch (keyCode) { case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_ENTER: // selectDay(); return true; case KeyEvent.KEYCODE_DPAD_LEFT: smoothScrollBy(-1); return true; case KeyEvent.KEYCODE_DPAD_RIGHT: smoothScrollBy(1); return true; default: return super.onKeyDown(keyCode, event); } }
Example 6
Source File: FuckViewPager.java From nono-android with GNU General Public License v3.0 | 6 votes |
/** * 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; }
Example 7
Source File: VelocityViewPager.java From Rey-MusicPlayer with Apache License 2.0 | 6 votes |
/** * 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; }
Example 8
Source File: AutoGallery.java From Bailan with Apache License 2.0 | 6 votes |
/** * 重写Galler中手指滑动的手势方法 * @param e1 按下的点 * @param e2 抬起的点 * @param velocityX X轴 * @param velocityY Y轴 * @return */ @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { int kEvent; if (isScrollingLeft(e1, e2)) { kEvent = KeyEvent.KEYCODE_DPAD_LEFT; //设置手势滑动的方法 --向左 } else { kEvent = KeyEvent.KEYCODE_DPAD_RIGHT; //设置手势滑动的方法--向右 } onKeyDown(kEvent, null); //进行设置galler切换图片 if (this.getSelectedItemPosition() == 0) { this.setSelection(length); } return false; }
Example 9
Source File: GameView.java From codeexamples-android with Eclipse Public License 1.0 | 5 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { ensureInitialized(); // Handle keys going up. boolean handled = false; switch (keyCode) { case KeyEvent.KEYCODE_DPAD_LEFT: mShip.setHeadingX(0); mDPadState &= ~DPAD_STATE_LEFT; handled = true; break; case KeyEvent.KEYCODE_DPAD_RIGHT: mShip.setHeadingX(0); mDPadState &= ~DPAD_STATE_RIGHT; handled = true; break; case KeyEvent.KEYCODE_DPAD_UP: mShip.setHeadingY(0); mDPadState &= ~DPAD_STATE_UP; handled = true; break; case KeyEvent.KEYCODE_DPAD_DOWN: mShip.setHeadingY(0); mDPadState &= ~DPAD_STATE_DOWN; handled = true; break; default: if (isFireKey(keyCode)) { handled = true; } break; } if (handled) { step(event.getEventTime()); return true; } return super.onKeyUp(keyCode, event); }
Example 10
Source File: ImageActivity.java From base-module with Apache License 2.0 | 5 votes |
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { Log.i("!!!!!!", "==============================="); switch (keyCode) { case KeyEvent.KEYCODE_DPAD_RIGHT: // loadResImage(mImageView); // loadSdImage(mImageView); // loadNetImageByFresco(mImageView); // loadResImageByFresco(mImageView); // loadSdImageByFresco(mImageView); loadResImageByGlide(mImageView); break; case KeyEvent.KEYCODE_DPAD_LEFT: // loadResImage(mImageView1); // loadSdImage(mImageView1); // loadNetImageByFresco(mImageView1); // loadResImageByFresco(mImageView1); // loadSdImageByFresco(mImageView1); loadResImageByGlide(mImageView1); break; case KeyEvent.KEYCODE_DPAD_UP: break; case KeyEvent.KEYCODE_DPAD_DOWN: break; } return super.onKeyUp(keyCode, event); }
Example 11
Source File: SliderKeyTestRtl.java From material-components-android with Apache License 2.0 | 5 votes |
@Test public void testMoveThumbFocus_dPad_correctThumbHasFocus() { slider.requestFocus(); KeyEventBuilder left = new KeyEventBuilder(KeyEvent.KEYCODE_DPAD_LEFT); KeyEventBuilder right = new KeyEventBuilder(KeyEvent.KEYCODE_DPAD_RIGHT); // We start at far right in RTL so go left first, then go back right. sendKeyEventThereAndBack(left, right); }
Example 12
Source File: GamepadMappings.java From 365browser with Apache License 2.0 | 5 votes |
private static void mapCommonDpadButtons(float[] mappedButtons, float[] rawButtons) { float dpadDown = rawButtons[KeyEvent.KEYCODE_DPAD_DOWN]; float dpadUp = rawButtons[KeyEvent.KEYCODE_DPAD_UP]; float dpadLeft = rawButtons[KeyEvent.KEYCODE_DPAD_LEFT]; float dpadRight = rawButtons[KeyEvent.KEYCODE_DPAD_RIGHT]; mappedButtons[CanonicalButtonIndex.DPAD_DOWN] = dpadDown; mappedButtons[CanonicalButtonIndex.DPAD_UP] = dpadUp; mappedButtons[CanonicalButtonIndex.DPAD_LEFT] = dpadLeft; mappedButtons[CanonicalButtonIndex.DPAD_RIGHT] = dpadRight; }
Example 13
Source File: RecyclerViewTV.java From AndroidTVWidget with Apache License 2.0 | 5 votes |
@Override public boolean dispatchKeyEvent(KeyEvent event) { int action = event.getAction(); int keyCode = event.getKeyCode(); if (action == KeyEvent.ACTION_UP) { if (!isHorizontalLayoutManger() && keyCode == KeyEvent.KEYCODE_DPAD_DOWN) { // 垂直布局向下按键. exeuteKeyEvent(); } else if (isHorizontalLayoutManger() && keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) { // 横向布局向右按键. exeuteKeyEvent(); } } return super.dispatchKeyEvent(event); }
Example 14
Source File: ViewPager.java From ankihelper with GNU General Public License v3.0 | 5 votes |
/** * 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: if (isOrientationHorizontal()) handled = arrowScroll(FOCUS_LEFT); break; case KeyEvent.KEYCODE_DPAD_RIGHT: if (isOrientationHorizontal()) handled = arrowScroll(FOCUS_RIGHT); break; case KeyEvent.KEYCODE_DPAD_UP: if (!isOrientationHorizontal()) handled = arrowScroll(FOCUS_UP); break; case KeyEvent.KEYCODE_DPAD_DOWN: if (!isOrientationHorizontal()) handled = arrowScroll(FOCUS_DOWN); 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; }
Example 15
Source File: TabHost.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
@Override public boolean dispatchKeyEvent(KeyEvent event) { final boolean handled = super.dispatchKeyEvent(event); // unhandled key events change focus to tab indicator for embedded // activities when there is nothing that will take focus from default // focus searching if (!handled && (event.getAction() == KeyEvent.ACTION_DOWN) && (mCurrentView != null) && (mCurrentView.isRootNamespace()) && (mCurrentView.hasFocus())) { int keyCodeShouldChangeFocus = KeyEvent.KEYCODE_DPAD_UP; int directionShouldChangeFocus = View.FOCUS_UP; int soundEffect = SoundEffectConstants.NAVIGATION_UP; switch (getTabWidgetLocation()) { case TABWIDGET_LOCATION_LEFT: keyCodeShouldChangeFocus = KeyEvent.KEYCODE_DPAD_LEFT; directionShouldChangeFocus = View.FOCUS_LEFT; soundEffect = SoundEffectConstants.NAVIGATION_LEFT; break; case TABWIDGET_LOCATION_RIGHT: keyCodeShouldChangeFocus = KeyEvent.KEYCODE_DPAD_RIGHT; directionShouldChangeFocus = View.FOCUS_RIGHT; soundEffect = SoundEffectConstants.NAVIGATION_RIGHT; break; case TABWIDGET_LOCATION_BOTTOM: keyCodeShouldChangeFocus = KeyEvent.KEYCODE_DPAD_DOWN; directionShouldChangeFocus = View.FOCUS_DOWN; soundEffect = SoundEffectConstants.NAVIGATION_DOWN; break; case TABWIDGET_LOCATION_TOP: default: keyCodeShouldChangeFocus = KeyEvent.KEYCODE_DPAD_UP; directionShouldChangeFocus = View.FOCUS_UP; soundEffect = SoundEffectConstants.NAVIGATION_UP; break; } if (event.getKeyCode() == keyCodeShouldChangeFocus && mCurrentView.findFocus().focusSearch(directionShouldChangeFocus) == null) { mTabWidget.getChildTabViewAt(mCurrentTab).requestFocus(); playSoundEffect(soundEffect); return true; } } return handled; }
Example 16
Source File: Gamepad.java From BobEngine with GNU Lesser General Public License v2.1 | 4 votes |
/** * Convert the KeyEvent key code into a Gamepad key code. Returns -1 * if the key code does not have a matching Gamepad key code. * @param keyCode a KeyEvent key code * @return Gamepad key code */ public int getButton(int keyCode) { int button = -1; switch (keyCode) { case KeyEvent.KEYCODE_DPAD_RIGHT: button = D_RIGHT; break; case KeyEvent.KEYCODE_DPAD_LEFT: button = D_LEFT; break; case KeyEvent.KEYCODE_DPAD_UP: button = D_UP; break; case KeyEvent.KEYCODE_DPAD_DOWN: button = D_DOWN; break; case KeyEvent.KEYCODE_BUTTON_A: button = A; break; case KeyEvent.KEYCODE_BUTTON_B: button = B; break; case KeyEvent.KEYCODE_BUTTON_X: button = X; break; case KeyEvent.KEYCODE_BUTTON_Y: button = Y; break; case KeyEvent.KEYCODE_BUTTON_R1: button = R1; break; case KeyEvent.KEYCODE_BUTTON_L1: button = L1; break; case KeyEvent.KEYCODE_BUTTON_START: button = START; break; case KeyEvent.KEYCODE_BUTTON_SELECT: button = SELECT; break; } return button; }
Example 17
Source File: FocusHelper.java From TurboLauncher with Apache License 2.0 | 4 votes |
/** * Handles key events in the workspace hotseat (bottom of the screen). */ static boolean handleHotseatButtonKeyEvent(View v, int keyCode, KeyEvent e, int orientation) { final ViewGroup parent = (ViewGroup) v.getParent(); final ViewGroup launcher = (ViewGroup) parent.getParent(); final Workspace workspace = (Workspace) launcher.findViewById(R.id.workspace); final int buttonIndex = parent.indexOfChild(v); final int buttonCount = parent.getChildCount(); final int pageIndex = workspace.getCurrentPage(); // NOTE: currently we don't special case for the phone UI in different // orientations, even though the hotseat is on the side in landscape mode. This // is to ensure that accessibility consistency is maintained across rotations. final int action = e.getAction(); final boolean handleKeyEvent = (action != KeyEvent.ACTION_UP); boolean wasHandled = false; switch (keyCode) { case KeyEvent.KEYCODE_DPAD_LEFT: if (handleKeyEvent) { // Select the previous button, otherwise snap to the previous page if (buttonIndex > 0) { parent.getChildAt(buttonIndex - 1).requestFocus(); } else { workspace.snapToPage(pageIndex - 1); } } wasHandled = true; break; case KeyEvent.KEYCODE_DPAD_RIGHT: if (handleKeyEvent) { // Select the next button, otherwise snap to the next page if (buttonIndex < (buttonCount - 1)) { parent.getChildAt(buttonIndex + 1).requestFocus(); } else { workspace.snapToPage(pageIndex + 1); } } wasHandled = true; break; case KeyEvent.KEYCODE_DPAD_UP: if (handleKeyEvent) { // Select the first bubble text view in the current page of the workspace final CellLayout layout = (CellLayout) workspace.getChildAt(pageIndex); final ShortcutAndWidgetContainer children = layout.getShortcutsAndWidgets(); final View newIcon = getIconInDirection(layout, children, -1, 1); if (newIcon != null) { newIcon.requestFocus(); } else { workspace.requestFocus(); } } wasHandled = true; break; case KeyEvent.KEYCODE_DPAD_DOWN: // Do nothing wasHandled = true; break; default: break; } return wasHandled; }
Example 18
Source File: GalleryActivity.java From MHViewer with Apache License 2.0 | 4 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (mGalleryView == null) { return super.onKeyDown(keyCode, event); } // Check volume if (Settings.getVolumePage()) { if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { if (mLayoutMode == GalleryView.LAYOUT_RIGHT_TO_LEFT) { mGalleryView.pageRight(); } else { mGalleryView.pageLeft(); } return true; } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { if (mLayoutMode == GalleryView.LAYOUT_RIGHT_TO_LEFT) { mGalleryView.pageLeft(); } else { mGalleryView.pageRight(); } return true; } } // Check keyboard and Dpad switch (keyCode) { case KeyEvent.KEYCODE_PAGE_UP: case KeyEvent.KEYCODE_DPAD_UP: if (mLayoutMode == GalleryView.LAYOUT_RIGHT_TO_LEFT) { mGalleryView.pageRight(); } else { mGalleryView.pageLeft(); } return true; case KeyEvent.KEYCODE_DPAD_LEFT: mGalleryView.pageLeft(); return true; case KeyEvent.KEYCODE_PAGE_DOWN: case KeyEvent.KEYCODE_DPAD_DOWN: if (mLayoutMode == GalleryView.LAYOUT_RIGHT_TO_LEFT) { mGalleryView.pageLeft(); } else { mGalleryView.pageRight(); } return true; case KeyEvent.KEYCODE_DPAD_RIGHT: mGalleryView.pageRight(); return true; case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_SPACE: case KeyEvent.KEYCODE_MENU: onTapMenuArea(); return true; } return super.onKeyDown(keyCode, event); }
Example 19
Source File: SearchView.java From CSipSimple with GNU General Public License v3.0 | 4 votes |
/** * React to the user typing while in the suggestions list. First, check for * action keys. If not handled, try refocusing regular characters into the * EditText. */ private boolean onSuggestionsKey(View v, int keyCode, KeyEvent event) { // guard against possible race conditions (late arrival after dismiss) if (mSearchable == null) { return false; } if (mSuggestionsAdapter == null) { return false; } if (event.getAction() == KeyEvent.ACTION_DOWN && KeyEventCompat.hasNoModifiers(event)) { // First, check for enter or search (both of which we'll treat as a // "click") if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_SEARCH || keyCode == KeyEvent.KEYCODE_TAB) { int position = mQueryTextView.getListSelection(); return onItemClicked(position, KeyEvent.KEYCODE_UNKNOWN, null); } // Next, check for left/right moves, which we use to "return" the // user to the edit view if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) { // give "focus" to text editor, with cursor at the beginning if // left key, at end if right key // TODO: Reverse left/right for right-to-left languages, e.g. // Arabic int selPoint = (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) ? 0 : mQueryTextView .length(); mQueryTextView.setSelection(selPoint); mQueryTextView.setListSelection(0); mQueryTextView.clearListSelection(); ensureImeVisible(mQueryTextView, true); return true; } // Next, check for an "up and out" move if (keyCode == KeyEvent.KEYCODE_DPAD_UP && 0 == mQueryTextView.getListSelection()) { // TODO: restoreUserQuery(); // let ACTV complete the move return false; } // Next, check for an "action key" // TODO SearchableInfo.ActionKeyInfo actionKey = mSearchable.findActionKey(keyCode); // TODO if ((actionKey != null) // TODO && ((actionKey.getSuggestActionMsg() != null) || (actionKey // TODO .getSuggestActionMsgColumn() != null))) { // TODO // launch suggestion using action key column // TODO int position = mQueryTextView.getListSelection(); // TODO if (position != ListView.INVALID_POSITION) { // TODO Cursor c = mSuggestionsAdapter.getCursor(); // TODO if (c.moveToPosition(position)) { // TODO final String actionMsg = getActionKeyMessage(c, actionKey); // TODO if (actionMsg != null && (actionMsg.length() > 0)) { // TODO return onItemClicked(position, keyCode, actionMsg); // TODO } // TODO } // TODO } // TODO } } return false; }
Example 20
Source File: KeyNavigationUtil.java From AndroidChromium with Apache License 2.0 | 2 votes |
/** * Checks whether the given event is any of DPAD right or NUMPAD right. * @param event Event to be checked. * @return Whether the event should be processed as a navigation right. */ public static boolean isGoRight(KeyEvent event) { return isActionDown(event) && (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_RIGHT || (!event.isNumLockOn() && event.getKeyCode() == KeyEvent.KEYCODE_NUMPAD_6)); }