1

My app is doing a gallery which uses TouchImageView on RecyclerView.

I was trying to use this class to display multiple fullscreen images in a RecyclerView attached with PageSnapHelper

This works fine, but the zooming is very awkward to use .If I try to pinch zoom , the image moving left and right but not zooming. Only double Tap works.

I think there is a conflict with the swiping and scrolling of the RecyclerView attached with PageSnapHelper .

How can I make the TouchImageView touch events override the PageSnapHelper events when pinch zoomed byt swiping also works when swiped?

To be simple , I want the same behavior of Chat Apps(Whatsapp and telegram) Image Slider which supports both swiping and pinch zooming

Note , I searched the stackoverflow but there are only solutions for ViewPagers but no recyclerview

RagAnt
  • 1,064
  • 2
  • 17
  • 35

2 Answers2

1

You can use try this library Subsampling-scale-imageview https://github.com/davemorrissey/subsampling-scale-image-view/tree/master

Megala Mani
  • 97
  • 2
  • 2
  • 8
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 27 '23 at 14:32
0

Im not exactly sure what you are asking here, but if I got it right, the problem is you can't pinch zoom because the RecyclerView is recognising your pinch action as a swipe. If you wanted, you could always disallow the RecyclerView from intercepting the touch event (and handle the event yourself) by calling:

view.parent.requestDisallowInterceptTouchEvent(true)

inside the onTouch method of the PrivateOnTouchListener.

If you want a simpler solution, you could also check if the current view is zoomed or if at least 2 fingers are touching the view. If yes, disallow the parent to intercept the touch event. The inside the PrivateOnTouchListener code would then look like this:

     if (isZoomed || event.pointerCount >= 2) {
        v.parent.requestDisallowInterceptTouchEvent(true)
     }

The parent will now only be allowed to intercept the touch event if the view isn't zoomed and if only one finger is touching the view.