Perform Touch Interaction
There are 3 type of touch interactions in Android Macro
Clicks
To perform tap behaviour in your screen, you can use Screen:click()
function which is available in Screen
class. For Example
Equivalent Code
Screen:click(Point(200, 250))
# or
Screen:click(200, 250)
Equivalent Block Builder
Swipes
To perform swipe behaviour in your screen, you can use Screen:swipe()
function which is available in Screen
class. The Screen:swipe()
function requires a list of SwipePoint(x: int, y: int, holdDuration: int, swipeDuration: int)
Equivalent Code
Screen:swipe({
SwipePoint(200, 250, 1, 2),
SwipePoint(500, 230, 1, 2),
})
Equivalent Block Builder
Hold Clicks
To perform hold clicks, you can use Screen:click()
function but this time, we can laveraging the ClickParams()
function to modify
the press and hold duration. For Example
Equivalent Code
Screen:click(Point(200, 250), ClickParams():setDuration(2000))
Equivalent Block Builder
The 2000
value is the duration of the press in milliseconds. If you run this code/builder, the macro will do hold click at X: 200, Y: 250 with duration press of 2 seconds.