okaybroda / ImageZoom

An Android library that makes any view to be zoomable.
GNU General Public License v3.0
120 stars 25 forks source link

Set ImageZoom on RecyclerView Adapter #18

Open edicybereye opened 6 years ago

edicybereye commented 6 years ago

Hi I'm really proud and apprciate it about this library help me on Activity, can you give me knowledge how to setup in RecyclerView Adapter event we have create adapter on Class? Because I didn't know how to setup ImageZoomHelper imageZoomHelper; and imageZoomHelper = new ImageZoomHelper(this); also for dispatchTouchEvent.

Thanks and Regards Edi Kurniawan

edicybereye commented 6 years ago

because RecyclerAdapter need setup on Fragment and also how to call dispatchTouchEvent?

a-bahmani commented 6 years ago

Hi, I had this problem. I fixed it with this solution. For problem 1: pass the activity from your Activity class to adapter and then set it in the ImageZoomHelper. problem 2: assume that you want to zoom an imageView. ImageZoomHelper.setViewZoomable(imageView);
then instead of dispathTouchEvent use below: imageView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { return view == imageView && imageZoomHelper.onDispatchTouchEvent(motionEvent); } });