Example usage for android.view KeyEvent isNumLockOn

List of usage examples for android.view KeyEvent isNumLockOn

Introduction

In this page you can find the example usage for android.view KeyEvent isNumLockOn.

Prototype

public final boolean isNumLockOn() 

Source Link

Document

Returns the locked state of the NUM LOCK meta key.

Usage

From source file:Main.java

/**
 * Checks whether the given event is any of DPAD up or NUMPAD up.
 * @param event Event to be checked.//from w w w .  j  a  v  a 2 s  .  c  o m
 * @return Whether the event should be processed as a navigation up.
 */
public static boolean isGoUp(KeyEvent event) {
    return isActionDown(event) && (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_UP
            || (!event.isNumLockOn() && event.getKeyCode() == KeyEvent.KEYCODE_NUMPAD_8));
}

From source file:Main.java

/**
 * Checks whether the given event is any of DPAD right or NUMPAD right.
 * @param event Event to be checked.// w w w  . j  av  a2s.  com
 * @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));
}

From source file:Main.java

/**
 * Checks whether the given event is any of DPAD down or NUMPAD down.
 * @param event Event to be checked./*w w w  .j a  va2 s  . c  om*/
 * @return Whether the event should be processed as a navigation down.
 */
public static boolean isGoDown(KeyEvent event) {
    return isActionDown(event) && (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_DOWN
            || (!event.isNumLockOn() && event.getKeyCode() == KeyEvent.KEYCODE_NUMPAD_2));
}