Java Code Examples for android.view.KeyEvent#KEYCODE_NUMPAD_2

The following examples show how to use android.view.KeyEvent#KEYCODE_NUMPAD_2 . 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: MatrixKeypadActivity.java    From drivers-samples with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (USE_LAYOUT) {
        setContentView(R.layout.layout_main);
    }
    try {
        mMatrixKeypadDriver = new MatrixKeypadInputDriver(BoardDefaults.getRowPins(),
                BoardDefaults.getColPins(),
                new int[] {KeyEvent.KEYCODE_NUMPAD_1, KeyEvent.KEYCODE_NUMPAD_2,
                        KeyEvent.KEYCODE_NUMPAD_3, KeyEvent.KEYCODE_NUMPAD_4,
                        KeyEvent.KEYCODE_NUMPAD_5, KeyEvent.KEYCODE_NUMPAD_6,
                        KeyEvent.KEYCODE_NUMPAD_7, KeyEvent.KEYCODE_NUMPAD_8,
                        KeyEvent.KEYCODE_NUMPAD_9, KeyEvent.KEYCODE_NUMPAD_MULTIPLY,
                        KeyEvent.KEYCODE_NUMPAD_0, KeyEvent.KEYCODE_NUMPAD_ENTER});
        mMatrixKeypadDriver.register();
    } catch (IOException e) {
        Log.e(TAG, "Cannot register matrix keypad driver:", e);
    }
}
 
Example 2
Source File: KeyEventProfileActivity.java    From DeviceConnect-Android with MIT License 4 votes vote down vote up
/**
 * Get Configure string.
 * 
 * @param keymode Key Mode.
 * @param keyId Key ID.
 * @return config Configure string.
 */
private String getConfig(final KeyMode keymode, final int keyId) {
    String config = "";
    int nIndex = -1;
    switch (keyId) {
    case KeyEvent.KEYCODE_NUMPAD_0:
        nIndex = 0;
        break;
    case KeyEvent.KEYCODE_NUMPAD_1:
        nIndex = 1;
        break;
    case KeyEvent.KEYCODE_NUMPAD_2:
        nIndex = 2;
        break;
    case KeyEvent.KEYCODE_NUMPAD_3:
        nIndex = 3;
        break;
    case KeyEvent.KEYCODE_NUMPAD_4:
        nIndex = 4;
        break;
    case KeyEvent.KEYCODE_NUMPAD_5:
        nIndex = 5;
        break;
    case KeyEvent.KEYCODE_NUMPAD_6:
        nIndex = 6;
        break;
    case KeyEvent.KEYCODE_NUMPAD_7:
        nIndex = 7;
        break;
    case KeyEvent.KEYCODE_NUMPAD_8:
        nIndex = 8;
        break;
    case KeyEvent.KEYCODE_NUMPAD_9:
        nIndex = 9;
        break;
    case KeyEvent.KEYCODE_NUMPAD_DOT:
        nIndex = 10;
        break;
    case KeyEvent.KEYCODE_NUMPAD_ENTER:
        nIndex = 11;
        break;
    default:
        nIndex = -1;
        break;
    }
    if (nIndex != -1) {
        switch (mKeyMode) {
        case MEDIA_CTRL:
            config = mConfigMediaCtrl[nIndex];
            break;
        case DPAD_BUTTON:
            config = mConfigDpad[nIndex];
            break;
        case USER:
            config = mConfigUser[nIndex];
            break;
        case STD_KEY:
        default:
            config = mConfigStdKey[nIndex];
            break;
        }
    } else {
        config = "";
    }

    return config;
}
 
Example 3
Source File: KeyNavigationUtil.java    From delion with Apache License 2.0 2 votes vote down vote up
/**
 * Checks whether the given event is any of DPAD down or NUMPAD down.
 * @param event Event to be checked.
 * @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));
}
 
Example 4
Source File: KeyNavigationUtil.java    From AndroidChromium with Apache License 2.0 2 votes vote down vote up
/**
 * Checks whether the given event is any of DPAD down or NUMPAD down.
 * @param event Event to be checked.
 * @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));
}
 
Example 5
Source File: KeyNavigationUtil.java    From 365browser with Apache License 2.0 2 votes vote down vote up
/**
 * Checks whether the given event is any of DPAD down or NUMPAD down.
 * @param event Event to be checked.
 * @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));
}