Created
August 15, 2017 10:45
-
-
Save sagar-viradiya/9451d391d7fe4b43c7ef5db46a27ed2b 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
val gestureListener = object : GestureDetector.SimpleOnGestureListener() { | |
override fun onDown(e: MotionEvent?): Boolean { | |
return true | |
} | |
override fun onFling(e1: MotionEvent?, e2: MotionEvent?, velocityX: Float, velocityY: Float): Boolean { | |
flingAnimationX.setStartVelocity(velocityX) | |
flingAnimationY.setStartVelocity(velocityY) | |
flingAnimationX.start() | |
flingAnimationY.start() | |
return true | |
} | |
} | |
val gestureDetector = GestureDetector(context, gestureListener) | |
android_bot.setOnTouchListener { _, motionEvent -> | |
gestureDetector.onTouchEvent(motionEvent) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment