I used onTouch() to record all points of a gesture, but StrokeDescription has a duration. The shorter the duration, the rougher the gesture I can see. When I executed it, it wasn't the points I recorded.
Then I saw the continueStroke method. It looks like it can set the time of each period carefully, but it doesn't work.
Who can give an example of using the continueStroke method? thank you.
@RequiresApi(api = Build.VERSION_CODES.O)
static public GestureDescription CreateGestureDescription(){
Path dragRightPath = new Path();
dragRightPath.moveTo(200, 200);
dragRightPath.lineTo(400, 200);
long dragRightDuration = 500L; // 0.5 second
Path dragDownPath = new Path();
dragDownPath.moveTo(400, 200);
dragDownPath.lineTo(400, 400);
long dragDownDuration = 500L;
GestureDescription.StrokeDescription rightThenDownDrag =
new GestureDescription.StrokeDescription(dragRightPath, 0L,
dragRightDuration, true);
rightThenDownDrag.continueStroke(dragDownPath, dragRightDuration,
dragDownDuration, false);
GestureDescription.Builder clickBuilder = new GestureDescription.Builder();
return clickBuilder.addStroke(rightThenDownDrag).build();
}