Skip to content

Instantly share code, notes, and snippets.

@mhrpatel12
Last active December 12, 2020 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhrpatel12/85e7067e6ced9f6b57a850bc9d6b76fe to your computer and use it in GitHub Desktop.
Save mhrpatel12/85e7067e6ced9f6b57a850bc9d6b76fe to your computer and use it in GitHub Desktop.
private fun buildClick(x: Float, y: Float): GestureDescription {
val clickPath = Path()
clickPath.moveTo(x, y)
val clickStroke = StrokeDescription(clickPath, 0, 1)
val clickBuilder = GestureDescription.Builder()
clickBuilder.addStroke(clickStroke)
return clickBuilder.build()
}
private fun buildSwipe(
startX: Float,
startY: Float,
endX: Float,
endY: Float,
duration: Long
): GestureDescription {
val swipePath = Path()
swipePath.moveTo(startX, startY)
swipePath.lineTo(endX, endY)
val swipeBuilder = GestureDescription.Builder()
swipeBuilder.addStroke(StrokeDescription(swipePath, 0, duration))
return gestureBuilder.build()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment