I am currently creating an accessibility service and am working on performing gestures and taps on the screen.
I am doing it like this:
Path swipePath = new Path();
//Simply using MoveTo if I want to only tap at certain coordinates
swipePath.MoveTo(500, 500);
//Also using LineTo to create gestures
swipePath.LineTo(500, 1000);
GestureDescription.Builder gestureBuilder = new GestureDescription.Builder();
//The third parameter (1000) is the duration of the gesture in milliseconds, if it is a tap then the screen will be tapped and held for that amount of time, if a gesture, then the gesture will be performed over that amount of time
gestureBuilder.AddStroke(new GestureDescription.StrokeDescription(swipePath, 0, 1000));
DispatchGesture(gestureBuilder.Build(), null, null);
This is decent and it works fine when I want to execute simple gestures, but the problem is I am converting game controller (and other types) input into screen input. This means that the user will press a button for an indefinite amount of time, and when say moving the joystick around I will need to have that area constantly being pressed and moved around.
Is there a way to recreate a tap and hold gesture, so that I can start the tap when the user presses the button down, and releases the tap when the button is released? Something similar for the joystick, where it moves around on the screen by add more LineTos? How would I go about doing this?
Even a simple way to cancel a gesture would be okay, as then I could start a gesture that holds for a long time and cancel it when the button is released.