Open sam-devstudio opened 4 years ago
Did you have a look at #37?
Did you have a look at #37?
Yes @markusressel before opening the issue I have searched for existing issues that one is for ViewPager and I have also tried the solutions that were provided there but none worked.
Sorry, but I'm not sure how to help with this without a reproducable setup, and I'm very limited on time. I'll label this as a bug though so it won't be closed automatically. If you do find a solution, please let us know.
Sorry, but I'm not sure how to help with this without a reproducable setup, and I'm very limited on time. I'll label this as a bug though so it won't be closed automatically. If you do find a solution, please let us know.
Sure @markusressel I will definitely share the solution if I got one.
I edit the onTouchEvent()
function of ZoomLayout, and it works fine inside ViewPager2 with horizontal scroll.
override fun onTouchEvent(ev: MotionEvent): Boolean {
val interceptByEngine = engine.onTouchEvent(ev)
if (ev.pointerCount > 1) {
parent.requestDisallowInterceptTouchEvent(true)
}else{
if (engine.realZoom <= 1f){
parent.requestDisallowInterceptTouchEvent(false)
}else {
val maxAvailableOffset = engine.computeHorizontalScrollRange() - width
val isScrolledToViewEnd = engine.computeHorizontalScrollOffset().absoluteValue >= maxAvailableOffset
parent.requestDisallowInterceptTouchEvent(!isScrolledToViewEnd)
}
}
if (ev.actionMasked == MotionEvent.ACTION_UP){
parent.requestDisallowInterceptTouchEvent(false)
}
return interceptByEngine || hasClickableChildren && super.onTouchEvent(ev)
}
Describe the bug
Please add a clear description of what the bug is, and fill the list below.
To Reproduce
Expected behavior
Full Image should be shown on each page with Zooming allowed
XML layout
Screenshots