Interface IKeyboardAPI


public interface IKeyboardAPI
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    getKeyState(int keyCode)
    Gets the key state of the given key.
    Gets all keys currently pressed down.
    void
    holdKey(int keyCode, int time)
    Hold a key for an amount of time.
    void
    holdKey(int keyCode, int time, boolean async)
    Hold a key for an amount of time.
    void
    holdKey(int keyCode, int maxTime, boolean async, Completable completable)
    Hold a key for a maximum amount of time or until the given Completable is done.
    void
    holdKey(int keyCode, int maxTime, Completable completable)
    Hold a key for a maximum amount of time or until the given Completable is done.
    void
    pressKey(int keyCode)
     
    void
    releaseKey(int keyCode)
     
    void
    sendKey(int keyCode)
    Send a key press and release event for the given key.
    void
    sendKey(int keyCode, boolean async)
    Send a key press and release event for the given key.
    void
    sendText(String text, boolean pressEnter)
    Sends key events to type the given text.
    void
    sendText(String text, boolean pressEnter, boolean async)
    Sends key events to type the given text.
    void
    typeKey(int keyCode)
     
  • Method Details

    • getKeyState

      boolean getKeyState(int keyCode)
      Gets the key state of the given key.
      Parameters:
      keyCode - the key code (see KeyEvent)
      Returns:
      true if the key is pressed, false otherwise
    • getPressedKeys

      List<Integer> getPressedKeys()
      Gets all keys currently pressed down.
      Returns:
      list of key codes (see KeyEvent)
    • sendKey

      void sendKey(int keyCode)
      Send a key press and release event for the given key.
      Parameters:
      keyCode - the key code (see KeyEvent)
    • sendKey

      void sendKey(int keyCode, boolean async)
      Send a key press and release event for the given key.
      Parameters:
      keyCode - the key code (see KeyEvent)
      async - whether to wait until the key is sent
    • sendText

      void sendText(String text, boolean pressEnter)
      Sends key events to type the given text.
      Parameters:
      text - the text to type
      pressEnter - true to press the enter key afterwards, false otherwise
    • sendText

      void sendText(String text, boolean pressEnter, boolean async)
      Sends key events to type the given text.
      Parameters:
      text - the text to type
      pressEnter - true to press the enter key afterwards, false otherwise
      async - whether to wait until all the keys are sent
    • holdKey

      void holdKey(int keyCode, int time)
      Hold a key for an amount of time.
      Parameters:
      keyCode - the key code (see KeyEvent)
      time - the time to hold the key for
    • holdKey

      void holdKey(int keyCode, int time, boolean async)
      Hold a key for an amount of time.
      Parameters:
      keyCode - the key code (see KeyEvent)
      time - the time to hold the key for
      async - whether to wait until all the keys are sent
    • holdKey

      void holdKey(int keyCode, int maxTime, Completable completable)
      Hold a key for a maximum amount of time or until the given Completable is done.
      Parameters:
      keyCode - the key code (see KeyEvent)
      maxTime - the maxiumum time to hold the key for
      completable - key will be hold until Completable.isDone() returns true
    • holdKey

      void holdKey(int keyCode, int maxTime, boolean async, Completable completable)
      Hold a key for a maximum amount of time or until the given Completable is done.
      Parameters:
      keyCode - the key code (see KeyEvent)
      maxTime - the maxiumum time to hold the key for
      async - whether to wait until all the keys are sent
      completable - key will be hold until Completable.isDone() returns true
    • pressKey

      void pressKey(int keyCode)
    • releaseKey

      void releaseKey(int keyCode)
    • typeKey

      void typeKey(int keyCode)