Add Double Tab Listner
I want to customize double tab listener to move to next image , But not able to do as listener is observed.
Do you mean double tap?
Ya I want to Implement click Listener to implement Double Tab. I want custom listeners in Library to listen to Double Tab Events and Execute my own logic.
@santhoshdasari786 Current code base doesn't provide any mean to listen to Zoom changes neither to listen to gesture detector. @jsibbold please advise
Okay, I can look into adding some sort of listener to zoom changes and tap events. Currently my time to work on this library is scarce because of work, but I will do my best to put in some work on this.
Okay, I can look into adding some sort of listener to zoom changes and tap events. Currently my time to work on this library is scarce because of work, but I will do my best to put in some work on this.
I could do that via a pull request.
@santhoshdasari786 you can use something like this (Kotlin): Create this class:
class GestureListener(): GestureDetector.SimpleOnGestureListener() {
override fun onDoubleTap(e: MotionEvent?): Boolean {
super.onDoubleTap(e)
// Do whatever you want
return true;
}
}
And when you want to set the listener:
val detector = GestureDetectorCompat(context, GestureListener()) // Change context with the context you use, it can be 'this' if on an activity
// zoomage_view is your Zoomage image view, you can use it directly from the activity class, or with findViewById
zoomage_view.setOnTouchListener { v, event ->
v.performClick() // On touch lambda should run performClick on the view.
detector.onTouchEvent(event)
}
And with just this you should be able to go. Also, for a shorter version, without creating extra classes, you can use:
zoomage_view.setOnTouchListener { v, event ->
GestureDetectorCompat(this@MainActivity,
object : GestureDetector.SimpleOnGestureListener() {
override fun onDoubleTap(e: MotionEvent?): Boolean {
super.onDoubleTap(e)
// Do whatever you want
return true
}
}
).onTouchEvent(event)
}
Hope this can help you ;)