Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save worker8/95a5f1133eb6dbc3ba67b2a2f563542b to your computer and use it in GitHub Desktop.
Save worker8/95a5f1133eb6dbc3ba67b2a2f563542b to your computer and use it in GitHub Desktop.
override fun onTouchEvent(event: MotionEvent): Boolean {
// swapping the motionEvent's x and y, so that when finger moves right, it becomes moving down
// for VerticalViewPager effect
event.swapXY()
// this portion is used for injection ACTION_DOWN
if (firstTime && event.actionMasked == MotionEvent.ACTION_MOVE) {
injectActionDown(event)
firstTime = false
}
if (event.actionMasked == MotionEvent.ACTION_UP) {
firstTime = true
}
super.onTouchEvent(event)
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment