InputDriver
public
class
InputDriver
extends Object
java.lang.Object | |
↳ | com.google.android.things.userdriver.InputDriver |
Driver to interface with user-connected input devices. User defined drivers should instantiate this class and call the appropriate emit method whenever input events are ready.
Summary
Nested classes | |
---|---|
class |
InputDriver.Builder
Builder class for |
Public methods | |
---|---|
static
InputDriver.Builder
|
builder(int source)
Constructs a new builder. |
boolean
|
emit(int x, int y, boolean press)
Emit a single touch event. |
boolean
|
emit(KeyEvent[] events)
Emit a list of KeyEvents. |
Inherited methods | |
---|---|
From
class
java.lang.Object
|
Public methods
builder
</div>
InputDriver.Builder builder (int source)
Constructs a new builder.
Parameters | |
---|---|
source |
int :
An int representing the device this driver supports. Supported sources are
SOURCE_CLASS_BUTTON,
SOURCE_TOUCHPAD, and
SOURCE_TOUCHSCREEN. |
Returns | |
---|---|
InputDriver.Builder |
A new InputDriver.Builder instance.
|
</div>
emit
</div>
boolean emit (int x, int y, boolean press)
Emit a single touch event.
Parameters | |
---|---|
x |
int :
An int denoting the x-axis location of the touch. |
y |
int :
An int denoting the y-axis location of the touch. |
press |
boolean :
A boolean denoting whether device is being pressed or not. |
Returns | |
---|---|
boolean |
true on success. |
</div>
emit
</div>
boolean emit (KeyEvent[] events)
Emit a list of KeyEvents.
The driver will treat the entire list of events as synchronous, i.e. happened at the same time. If any of the events are not supported by this driver, none of them will be emitted.</p>
Parameters | |
---|---|
events |
KeyEvent :
An array of KeyEvents. |
Returns | |
---|---|
boolean |
true on success, i.e. the entire array of KeyEvents was emitted. |
</div>