Last active
December 12, 2020 11:24
-
-
Save mhrpatel12/85e7067e6ced9f6b57a850bc9d6b76fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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