List of usage examples for android.view KeyEvent metaStateHasModifiers
public static boolean metaStateHasModifiers(int metaState, int modifiers)
From source file:com.lambergar.verticalviewpager.VerticalViewPager.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 va2 s . c o m*/ * * @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_UP: handled = arrowScroll(FOCUS_UP); break; case KeyEvent.KEYCODE_DPAD_RIGHT: handled = arrowScroll(FOCUS_RIGHT); break; case KeyEvent.KEYCODE_DPAD_DOWN: handled = arrowScroll(FOCUS_DOWN); break; case KeyEvent.KEYCODE_TAB: if (KeyEvent.metaStateHasNoModifiers(event.getMetaState())) { handled = arrowScroll(FOCUS_FORWARD); } else if (KeyEvent.metaStateHasModifiers(event.getMetaState(), KeyEvent.META_SHIFT_ON)) { handled = arrowScroll(FOCUS_BACKWARD); } break; } } return handled; }