Example usage for android.view InputDevice SOURCE_KEYBOARD

List of usage examples for android.view InputDevice SOURCE_KEYBOARD

Introduction

In this page you can find the example usage for android.view InputDevice SOURCE_KEYBOARD.

Prototype

int SOURCE_KEYBOARD

To view the source code for android.view InputDevice SOURCE_KEYBOARD.

Click Source Link

Document

The input source is a keyboard.

Usage

From source file:Main.java

@SuppressLint("InlinedApi")
public static String getSourcesString(int sources) {
    List<String> names = new ArrayList<String>();
    addString(sources, InputDevice.SOURCE_KEYBOARD, names);
    addString(sources, InputDevice.SOURCE_DPAD, names);
    addString(sources, InputDevice.SOURCE_GAMEPAD, names);
    addString(sources, InputDevice.SOURCE_TOUCHSCREEN, names);
    addString(sources, InputDevice.SOURCE_MOUSE, names);
    addString(sources, InputDevice.SOURCE_STYLUS, names);
    addString(sources, InputDevice.SOURCE_TOUCHPAD, names);
    addString(sources, InputDevice.SOURCE_JOYSTICK, names);
    return TextUtils.join(", ", names);
}

From source file:Main.java

/**
 * Gets the name of the source performing an action.
 * /*from www.  j ava  2  s  .co  m*/
 * @param source A number representing the source.
 * 
 * @return The name of the source.
 */
public static String getSourceName(int source) {
    switch (source) {
    case InputDevice.SOURCE_CLASS_BUTTON:
        return "BUTTON";
    case InputDevice.SOURCE_CLASS_POINTER:
        return "POINTER";
    case InputDevice.SOURCE_CLASS_TRACKBALL:
        return "TRACKBALL";
    case InputDevice.SOURCE_CLASS_POSITION:
        return "POSITION";
    case InputDevice.SOURCE_CLASS_JOYSTICK:
        return "JOYSTICK";
    case InputDevice.SOURCE_DPAD:
        return "dpad";
    case InputDevice.SOURCE_GAMEPAD:
        return "gamepad";
    case InputDevice.SOURCE_JOYSTICK:
        return "joystick";
    case InputDevice.SOURCE_KEYBOARD:
        return "keyboard";
    case InputDevice.SOURCE_MOUSE:
        return "mouse";
    case InputDevice.SOURCE_STYLUS:
        return "stylus";
    case InputDevice.SOURCE_TOUCHPAD:
        return "touchpad";
    case InputDevice.SOURCE_TOUCHSCREEN:
        return "touchscreen";
    case InputDevice.SOURCE_TRACKBALL:
        return "trackball";
    case InputDevice.SOURCE_UNKNOWN:
        return "unknown";
    default:
        return "source_" + source;
    }
}

From source file:com.google.fpl.voltair.VoltAirActivity.java

private static boolean isTouchNavigationEvent(InputEvent event) {
    return isFromSource(event, InputDevice.SOURCE_TOUCH_NAVIGATION)
            && isFromSource(event, InputDevice.SOURCE_KEYBOARD);
}

From source file:com.google.fpl.voltair.VoltAirActivity.java

private static boolean isKeyboardEvent(KeyEvent event) {
    return isFromSource(event, InputDevice.SOURCE_KEYBOARD);
}