IT. Expert System.

Android Reference

InputManager


android.hardware.input

Class InputManager

    • Field Detail

      • ACTION_QUERY_KEYBOARD_LAYOUTS

        public static final String ACTION_QUERY_KEYBOARD_LAYOUTS
        Broadcast Action: Query available keyboard layouts.

        The input manager service locates available keyboard layouts by querying broadcast receivers that are registered for this action. An application can offer additional keyboard layouts to the user by declaring a suitable broadcast receiver in its manifest.

        Here is an example broadcast receiver declaration that an application might include in its AndroidManifest.xml to advertise keyboard layouts. The meta-data specifies a resource that contains a description of each keyboard layout that is provided by the application.

        
         <receiver android:name=".InputDeviceReceiver"
                 android:label="@string/keyboard_layouts_label">
             <intent-filter>
                 <action android:name="android.hardware.input.action.QUERY_KEYBOARD_LAYOUTS" />
             </intent-filter>
             <meta-data android:name="android.hardware.input.metadata.KEYBOARD_LAYOUTS"
                     android:resource="@xml/keyboard_layouts" />
         </receiver>
         

        In the above example, the @xml/keyboard_layouts resource refers to an XML resource whose root element is <keyboard-layouts> that contains zero or more <keyboard-layout> elements. Each <keyboard-layout> element specifies the name, label, and location of a key character map for a particular keyboard layout. The label on the receiver is used to name the collection of keyboard layouts provided by this receiver in the keyboard layout settings.

        
         <?xml version="1.0" encoding="utf-8"?>
         <keyboard-layouts xmlns:android="http://schemas.android.com/apk/res/android">
             <keyboard-layout android:name="keyboard_layout_english_us"
                     android:label="@string/keyboard_layout_english_us_label"
                     android:keyboardLayout="@raw/keyboard_layout_english_us" />
         </keyboard-layouts>
         

        The android:name attribute specifies an identifier by which the keyboard layout will be known in the package. The android:label attributes specifies a human-readable descriptive label to describe the keyboard layout in the user interface, such as "English (US)". The android:keyboardLayout attribute refers to a key character map resource that defines the keyboard layout.

        See Also:
        Constant Field Values
      • META_DATA_KEYBOARD_LAYOUTS

        public static final String META_DATA_KEYBOARD_LAYOUTS
        Metadata Key: Keyboard layout metadata associated with ACTION_QUERY_KEYBOARD_LAYOUTS.

        Specifies the resource id of a XML resource that describes the keyboard layouts that are provided by the application.

        See Also:
        Constant Field Values
      • MIN_POINTER_SPEED

        public static final int MIN_POINTER_SPEED
        Pointer Speed: The minimum (slowest) pointer speed (-7).
        See Also:
        Constant Field Values
      • MAX_POINTER_SPEED

        public static final int MAX_POINTER_SPEED
        Pointer Speed: The maximum (fastest) pointer speed (7).
        See Also:
        Constant Field Values
      • DEFAULT_POINTER_SPEED

        public static final int DEFAULT_POINTER_SPEED
        Pointer Speed: The default pointer speed (0).
        See Also:
        Constant Field Values
      • INJECT_INPUT_EVENT_MODE_ASYNC

        public static final int INJECT_INPUT_EVENT_MODE_ASYNC
        Input Event Injection Synchronization Mode: None. Never blocks. Injection is asynchronous and is assumed always to be successful.
        See Also:
        Constant Field Values
      • INJECT_INPUT_EVENT_MODE_WAIT_FOR_RESULT

        public static final int INJECT_INPUT_EVENT_MODE_WAIT_FOR_RESULT
        Input Event Injection Synchronization Mode: Wait for result. Waits for previous events to be dispatched so that the input dispatcher can determine whether input event injection will be permitted based on the current input focus. Does not wait for the input event to finish being handled by the application.
        See Also:
        Constant Field Values
      • INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH

        public static final int INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH
        Input Event Injection Synchronization Mode: Wait for finish. Waits for the event to be delivered to the application and handled.
        See Also:
        Constant Field Values
    • Method Detail

      • getInstance

        public static InputManager getInstance()
        Gets an instance of the input manager.
        Returns:
        The input manager instance.
      • getInputDevice

        public InputDevice getInputDevice(int id)
        Gets information about the input device with the specified id.
        Parameters:
        id - The device id.
        Returns:
        The input device or null if not found.
      • getInputDeviceByDescriptor

        public InputDevice getInputDeviceByDescriptor(String descriptor)
        Gets information about the input device with the specified descriptor.
        Parameters:
        descriptor - The input device descriptor.
        Returns:
        The input device or null if not found.
      • getInputDeviceIds

        public int[] getInputDeviceIds()
        Gets the ids of all input devices in the system.
        Returns:
        The input device ids.
      • getKeyboardLayouts

        public KeyboardLayout[] getKeyboardLayouts()
        Gets information about all supported keyboard layouts.

        The input manager consults the built-in keyboard layouts as well as all keyboard layouts advertised by applications using a ACTION_QUERY_KEYBOARD_LAYOUTS broadcast receiver.

        Returns:
        A list of all supported keyboard layouts.
      • getKeyboardLayout

        public KeyboardLayout getKeyboardLayout(String keyboardLayoutDescriptor)
        Gets the keyboard layout with the specified descriptor.
        Parameters:
        keyboardLayoutDescriptor - The keyboard layout descriptor, as returned by KeyboardLayout.getDescriptor().
        Returns:
        The keyboard layout, or null if it could not be loaded.
      • getCurrentKeyboardLayoutForInputDevice

        public String getCurrentKeyboardLayoutForInputDevice(String inputDeviceDescriptor)
        Gets the current keyboard layout descriptor for the specified input device.
        Parameters:
        inputDeviceDescriptor - The input device descriptor.
        Returns:
        The keyboard layout descriptor, or null if no keyboard layout has been set.
      • setCurrentKeyboardLayoutForInputDevice

        public void setCurrentKeyboardLayoutForInputDevice(String inputDeviceDescriptor,
                                                  String keyboardLayoutDescriptor)
        Sets the current keyboard layout descriptor for the specified input device.

        This method may have the side-effect of causing the input device in question to be reconfigured.

        Parameters:
        inputDeviceDescriptor - The input device descriptor.
        keyboardLayoutDescriptor - The keyboard layout descriptor to use, must not be null.
      • getKeyboardLayoutsForInputDevice

        public String[] getKeyboardLayoutsForInputDevice(String inputDeviceDescriptor)
        Gets all keyboard layout descriptors that are enabled for the specified input device.
        Parameters:
        inputDeviceDescriptor - The input device descriptor.
        Returns:
        The keyboard layout descriptors.
      • addKeyboardLayoutForInputDevice

        public void addKeyboardLayoutForInputDevice(String inputDeviceDescriptor,
                                           String keyboardLayoutDescriptor)
        Adds the keyboard layout descriptor for the specified input device.

        This method may have the side-effect of causing the input device in question to be reconfigured.

        Parameters:
        inputDeviceDescriptor - The input device descriptor.
        keyboardLayoutDescriptor - The descriptor of the keyboard layout to add.
      • removeKeyboardLayoutForInputDevice

        public void removeKeyboardLayoutForInputDevice(String inputDeviceDescriptor,
                                              String keyboardLayoutDescriptor)
        Removes the keyboard layout descriptor for the specified input device.

        This method may have the side-effect of causing the input device in question to be reconfigured.

        Parameters:
        inputDeviceDescriptor - The input device descriptor.
        keyboardLayoutDescriptor - The descriptor of the keyboard layout to remove.
      • setPointerSpeed

        public void setPointerSpeed(Context context,
                           int speed)
        Sets the mouse pointer speed.

        Requires android.Manifest.permissions.WRITE_SETTINGS.

        Parameters:
        context - The application context.
        speed - The pointer speed as a value between MIN_POINTER_SPEED and MAX_POINTER_SPEED, or the default value DEFAULT_POINTER_SPEED.
      • tryPointerSpeed

        public void tryPointerSpeed(int speed)
        Changes the mouse pointer speed temporarily, but does not save the setting.

        Requires android.Manifest.permission.SET_POINTER_SPEED.

        Parameters:
        speed - The pointer speed as a value between MIN_POINTER_SPEED and MAX_POINTER_SPEED, or the default value DEFAULT_POINTER_SPEED.
      • deviceHasKeys

        public boolean[] deviceHasKeys(int[] keyCodes)
        Queries the framework about whether any physical keys exist on the any keyboard attached to the device that are capable of producing the given array of key codes.
        Parameters:
        keyCodes - The array of key codes to query.
        Returns:
        A new array of the same size as the key codes array whose elements are set to true if at least one attached keyboard supports the corresponding key code at the same index in the key codes array.
      • injectInputEvent

        public boolean injectInputEvent(InputEvent event,
                               int mode)
        Injects an input event into the event system on behalf of an application. The synchronization mode determines whether the method blocks while waiting for input injection to proceed.

        Requires android.Manifest.permission.INJECT_EVENTS to inject into windows that are owned by other applications.

        Make sure you correctly set the event time and input source of the event before calling this method.

        Parameters:
        event - The event to inject.
        mode - The synchronization mode. One of: INJECT_INPUT_EVENT_MODE_ASYNC, INJECT_INPUT_EVENT_MODE_WAIT_FOR_RESULT, or INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH.
        Returns:
        True if input event injection succeeded.
      • getInputDeviceVibrator

        public Vibrator getInputDeviceVibrator(int deviceId)
        Gets a vibrator service associated with an input device, assuming it has one.
        Returns:
        The vibrator, never null.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 587 / . Delta: 0.02453 с