List of usage examples for android.view KeyEvent KEYCODE_DPAD_UP
int KEYCODE_DPAD_UP
To view the source code for android.view KeyEvent KEYCODE_DPAD_UP.
Click Source Link
From source file:org.telegram.ui.Components.NumberPicker.java
@Override public boolean dispatchKeyEvent(KeyEvent event) { final int keyCode = event.getKeyCode(); switch (keyCode) { case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_ENTER: removeAllCallbacks();/*from w ww. j av a2 s.c om*/ 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); }
From source file:org.ligi.gobandroid_hd.ui.GoActivity.java
@Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { final Cell ensuredTouchPosition = interaction_scope.getEnsuredTouchPosition(); final BoardCell boardCell = getGame().getCalcBoard().getCell(ensuredTouchPosition); switch (keyCode) { case KeyEvent.KEYCODE_DPAD_UP: if (boardCell.up != null) { interaction_scope.touch_position = boardCell.up; } else { return false; }//from www . j a va 2 s .c om break; case KeyEvent.KEYCODE_DPAD_LEFT: if (boardCell.left != null) { interaction_scope.touch_position = boardCell.left; } else { return false; } break; case KeyEvent.KEYCODE_DPAD_DOWN: if (boardCell.down != null) { interaction_scope.touch_position = boardCell.down; } else { return false; } break; case KeyEvent.KEYCODE_DPAD_RIGHT: if (boardCell.right != null) { interaction_scope.touch_position = boardCell.right; } else { return false; } break; case KeyEvent.KEYCODE_DPAD_CENTER: doMoveWithUIFeedback(boardCell); break; default: return false; } go_board.postInvalidate(); refreshZoomFragment(); return true; } return false; }
From source file:com.hippo.widget.BothScrollView.java
/** * 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./* w w w . ja va 2s . com*/ * * @param event The key event to execute. * @return Return true if the event was handled, else false. */ public boolean executeKeyEvent(KeyEvent event) { mTempRect.setEmpty(); if (!canScrollHorizontally()) { if (isFocused() && event.getKeyCode() != KeyEvent.KEYCODE_BACK) { View currentFocused = findFocus(); if (currentFocused == this) { currentFocused = null; } View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, View.FOCUS_RIGHT); return nextFocused != null && nextFocused != this && nextFocused.requestFocus(View.FOCUS_RIGHT); } return false; } if (!canScrollVertically()) { if (isFocused() && event.getKeyCode() != KeyEvent.KEYCODE_BACK) { View currentFocused = findFocus(); if (currentFocused == this) { currentFocused = null; } View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, View.FOCUS_DOWN); return nextFocused != null && nextFocused != this && nextFocused.requestFocus(View.FOCUS_DOWN); } return false; } boolean handled = false; if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_DPAD_LEFT: if (!event.isAltPressed()) { handled = arrowScrollHorizontally(View.FOCUS_LEFT); } else { handled = fullScroll(View.FOCUS_LEFT); } break; case KeyEvent.KEYCODE_DPAD_RIGHT: if (!event.isAltPressed()) { handled = arrowScrollHorizontally(View.FOCUS_RIGHT); } else { handled = fullScroll(View.FOCUS_RIGHT); } break; case KeyEvent.KEYCODE_DPAD_UP: if (!event.isAltPressed()) { handled = arrowScrollVertically(View.FOCUS_UP); } else { handled = fullScroll(View.FOCUS_UP); } break; case KeyEvent.KEYCODE_DPAD_DOWN: if (!event.isAltPressed()) { handled = arrowScrollVertically(View.FOCUS_DOWN); } else { handled = fullScroll(View.FOCUS_DOWN); } break; case KeyEvent.KEYCODE_SPACE: if (event.isCtrlPressed()) { pageScroll(event.isShiftPressed() ? View.FOCUS_LEFT : View.FOCUS_RIGHT); } else { pageScroll(event.isShiftPressed() ? View.FOCUS_UP : View.FOCUS_DOWN); } break; } } return handled; }
From source file:com.hxqc.mall.thirdshop.views.CustomScrollView.java
/** * 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./*from w w w. j a v a2 s .c om*/ * * @param event The key event to execute. * @return Return true if the event was handled, else false. */ public boolean executeKeyEvent(KeyEvent event) { mTempRect.setEmpty(); if (!canScroll()) { if (isFocused() && event.getKeyCode() != KeyEvent.KEYCODE_BACK) { View currentFocused = findFocus(); if (currentFocused == this) currentFocused = null; View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, View.FOCUS_DOWN); return nextFocused != null && nextFocused != this && nextFocused.requestFocus(View.FOCUS_DOWN); } return false; } boolean handled = false; if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_DPAD_UP: if (!event.isAltPressed()) { handled = arrowScroll(View.FOCUS_UP); } else { handled = fullScroll(View.FOCUS_UP); } break; case KeyEvent.KEYCODE_DPAD_DOWN: if (!event.isAltPressed()) { handled = arrowScroll(View.FOCUS_DOWN); } else { handled = fullScroll(View.FOCUS_DOWN); } break; case KeyEvent.KEYCODE_SPACE: pageScroll(event.isShiftPressed() ? View.FOCUS_UP : View.FOCUS_DOWN); break; default: break; } } return handled; }
From source file:org.medcare.Dicom.DicomActivity.java
public boolean onKeyDown(int keyCode, KeyEvent event) { Log.e(TAG, "onKeyDown!!!!!!!!!!!!!!! " + keyCode); if (keyCode == KeyEvent.KEYCODE_PLUS) { Log.e(TAG, "zoomIn!!!!!!!!!!!!!!!"); this.dicomView.dicomThread.action("zoomIn"); return true; } else if (keyCode == KeyEvent.KEYCODE_MINUS) { Log.e(TAG, "zoomOut!!!!!!!!!!!!!!!"); this.dicomView.dicomThread.action("zoomOut"); return true; } else if (keyCode == KeyEvent.KEYCODE_DPAD_UP) { Log.e(TAG, "zoomIn!!!!!!!!!!!!!!!"); this.dicomView.dicomThread.action("zoomIn"); return true; } else if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) { Log.e(TAG, "zoomOut!!!!!!!!!!!!!!!"); this.dicomView.dicomThread.action("zoomOut"); return true; } else if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) { Log.e(TAG, "Del!!!!!!!!!!!!!!!"); this.dicomView.dicomThread.action("Del"); } else if (keyCode == KeyEvent.KEYCODE_DEL) { Log.e(TAG, "del!!!!!!!!!!!!!!!"); this.dicomView.dicomThread.action("Del"); } else if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) { Log.e(TAG, "TAGS_INFO!!!!!!!!!!!!!!!"); this.dicomView.dicomThread.action("TAGS_INFO"); } else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) { Log.e(TAG, "TAGS_OFF!!!!!!!!!!!!!!!"); this.dicomView.dicomThread.action("TAGS_OFF"); }// www . j a v a 2 s . c om return false; }
From source file:com.apptentive.android.sdk.view.ApptentiveNestedScrollView.java
/** * 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.//from w w w .j a v a 2s . com * * @param event The key event to execute. * @return Return true if the event was handled, else false. */ public boolean executeKeyEvent(KeyEvent event) { mTempRect.setEmpty(); if (!canScroll()) { if (isFocused() && event.getKeyCode() != KeyEvent.KEYCODE_BACK) { View currentFocused = findFocus(); if (currentFocused == this) currentFocused = null; View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, View.FOCUS_DOWN); return nextFocused != null && nextFocused != this && nextFocused.requestFocus(View.FOCUS_DOWN); } return false; } boolean handled = false; if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_DPAD_UP: if (!event.isAltPressed()) { handled = arrowScroll(View.FOCUS_UP); } else { handled = fullScroll(View.FOCUS_UP); } break; case KeyEvent.KEYCODE_DPAD_DOWN: if (!event.isAltPressed()) { handled = arrowScroll(View.FOCUS_DOWN); } else { handled = fullScroll(View.FOCUS_DOWN); } break; case KeyEvent.KEYCODE_SPACE: pageScroll(event.isShiftPressed() ? View.FOCUS_UP : View.FOCUS_DOWN); break; } } return handled; }
From source file:android.support.v7ox.app.AppCompatActivity.java
@Override public boolean dispatchKeyEvent(KeyEvent event) { final int keyCode = event.getKeyCode(); if (keyCode == KeyEvent.KEYCODE_DPAD_UP) { final int action = event.getAction(); if (action == KeyEvent.ACTION_DOWN) { if (KeyEventCompat.hasModifiers(event, KeyEvent.META_ALT_ON)) { final ActionBar actionBar = getSupportActionBar(); if (actionBar != null && actionBar.isShowing() && actionBar.requestFocus()) { mEatKeyUpEvent = true; return true; }//from w w w . j av a2s .c o m } } else if (action == KeyEvent.ACTION_UP && mEatKeyUpEvent) { mEatKeyUpEvent = false; return true; } } return super.dispatchKeyEvent(event); }
From source file:com.peerless2012.twowaynestedscrollview.TwoWayNestedScrollView.java
/** * 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./* w w w . ja v a 2s .c om*/ * * @param event * The key event to execute. * @return Return true if the event was handled, else false. */ public boolean executeKeyEvent(KeyEvent event) { mTempRect.setEmpty(); if (!canVerticalScroll()) { if (isFocused() && event.getKeyCode() != KeyEvent.KEYCODE_BACK) { View currentFocused = findFocus(); if (currentFocused == this) currentFocused = null; View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, View.FOCUS_DOWN); return nextFocused != null && nextFocused != this && nextFocused.requestFocus(View.FOCUS_DOWN); } return false; } if (!canHorizontalScroll()) { if (isFocused() && event.getKeyCode() != KeyEvent.KEYCODE_BACK) { View currentFocused = findFocus(); if (currentFocused == this) currentFocused = null; View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, View.FOCUS_DOWN); return nextFocused != null && nextFocused != this && nextFocused.requestFocus(View.FOCUS_DOWN); } return false; } boolean handled = false; if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (event.getKeyCode()) { case KeyEvent.KEYCODE_DPAD_UP: if (!event.isAltPressed()) { handled = arrowScroll(View.FOCUS_UP); } else { handled = fullScroll(View.FOCUS_UP); } break; case KeyEvent.KEYCODE_DPAD_DOWN: if (!event.isAltPressed()) { handled = arrowScroll(View.FOCUS_DOWN); } else { handled = fullScroll(View.FOCUS_DOWN); } break; case KeyEvent.KEYCODE_SPACE: pageScroll(event.isShiftPressed() ? View.FOCUS_UP : View.FOCUS_DOWN); break; } } return handled; }
From source file:info.bartowski.easteregg.LLand.java
@Override public boolean onKeyDown(int keyCode, KeyEvent ev) { if (DEBUG)//w ww. j ava 2 s . co m L("keyDown: %d", keyCode); switch (keyCode) { case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_SPACE: case KeyEvent.KEYCODE_ENTER: case KeyEvent.KEYCODE_BUTTON_A: poke(); return true; } return false; }
From source file:info.bartowski.easteregg.LLand.java
@Override public boolean onKeyUp(int keyCode, KeyEvent ev) { if (DEBUG)//from ww w . j a va 2 s . co m L("keyDown: %d", keyCode); switch (keyCode) { case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_SPACE: case KeyEvent.KEYCODE_ENTER: case KeyEvent.KEYCODE_BUTTON_A: unpoke(); return true; } return false; }