| java.lang.Object | |
| ↳ | com.davidluoye.support.utils.EventSender |
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| public static final int | INJECT_INPUT_EVENT_MODE_ASYNC | Input Event Injection Synchronization Mode: None. | |||||||||
| public static final int | INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH | Input Event Injection Synchronization Mode: Wait for finish. | |||||||||
| public static final int | INJECT_INPUT_EVENT_MODE_WAIT_FOR_RESULT | Input Event Injection Synchronization Mode: Wait for result. | |||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| EventSender() | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| static void |
sendCharacterSync(int keyCode)
Higher-level method for sending both the down and up key events for a
particular character key code.
| ||||||||||
| static void |
sendKeyDownUpSync(int key)
Sends an up and down key event sync to the currently focused window.
| ||||||||||
| static void |
sendKeySync(KeyEvent event)
Send a key event to the currently focused window/view and wait for it to
be processed.
| ||||||||||
| static void |
sendPointerSync(MotionEvent event)
Dispatch a pointer event.
| ||||||||||
| static void |
sendStringSync(String text)
Sends the key events corresponding to the text to the app being
instrumented.
| ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
Input Event Injection Synchronization Mode: None. Never blocks. Injection is asynchronous and is assumed always to be successful.
Input Event Injection Synchronization Mode: Wait for finish. Waits for the event to be delivered to the application and handled.
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.
Higher-level method for sending both the down and up key events for a
particular character key code. Equivalent to creating both KeyEvent
objects by hand and calling sendKeySync(KeyEvent). The event appears
as if it came from keyboard 0, the built in one.
| keyCode | The key code of the character to send. |
|---|
Sends an up and down key event sync to the currently focused window.
| key | The integer keycode for the event. |
|---|
Send a key event to the currently focused window/view and wait for it to be processed. Finished at some point after the recipient has returned from its event processing, though it may not have completely finished reacting from the event -- for example, if it needs to update its display as a result, it may still be in the process of doing that.
| event | The event to send to the current focus. |
|---|
Dispatch a pointer event. Finished at some point after the recipient has returned from its event processing, though it may not have completely finished reacting from the event -- for example, if it needs to update its display as a result, it may still be in the process of doing that.
| event | A motion event describing the pointer action. (As noted in
obtain(long, long, int, float, float, int), be sure to use
uptimeMillis() as the timebase.
|
|---|
Sends the key events corresponding to the text to the app being instrumented.
| text | The text to be sent. |
|---|