Skip to content

Commit

Permalink
Do not add delay for single key press
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensousa committed Jun 19, 2024
1 parent 420528b commit 69e9d2c
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ object KeyEvents {
fun pressKey(key: Int, times: Int = 1, delay: Long = DEFAULT_KEY_PRESS_DELAY) {
repeat(times) {
device.pressKeyCode(key)
val actualDelay = max(25L, delay)
SystemClock.sleep(actualDelay)
if (times > 1) {
val actualDelay = max(25L, delay)
SystemClock.sleep(actualDelay)
}
}
}

Expand Down

0 comments on commit 69e9d2c

Please sign in to comment.