Aghajari / ZoomHelper

ZoomHelper will make any view to be zoomable just like Instagram pinch-to-zoom
Apache License 2.0
247 stars 21 forks source link

ZoomHelper shows old view #4

Closed androidiapp closed 3 years ago

androidiapp commented 3 years ago

First of all , Thank you for this awesome library (helps me a lot meeting my requirement in project) , But having one road block explained below -

I am having two RecylerViews in Two Different Fragments inside a same Activity .

Activity -> Fragment1 -> RecyclerView1 -> add ZoomHelper to recyclerview1's item .

Click on bottom Tab and navigate to other fragment (fragment2 is over fragment1).

Activity -> Fragment2 -> Recyclerview2 -> add ZoomHelper to recyclerview2 item

now when zooming recyclerview2's item , i am getting preview of (recyclerview1's item) , if older view is just below new item .

can you please help me with this .

its a requirement .

let me know if you need any further information .

Aghajari commented 3 years ago

Hi @androidiapp ,

try to set the fragment as ZoomHelper parent instead of Activity

look at this

override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
    return ZoomHelper.getInstance().dispatchTouchEvent(ev!!, VIEW ) || super.dispatchTouchEvent(ev)
}

VIEW = the view of the showing fragment

or simply :

override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
    return supportFragmentManager.findFragmentById(R.id.fragment_container)?.view?.let {
        ZoomHelper.getInstance().dispatchTouchEvent(ev!!, it) 
    }!! || super.dispatchTouchEvent(ev)
}
androidiapp commented 3 years ago

Hi @Aghajari

Thanks for the feedback .

i will check it and let you know .

androidiapp commented 3 years ago

Hi @Aghajari

It is working for me . Thank you so much .

just one query : size of view got smaller than original when release touch .

zoomHelper.minScale = 1f
its default .

Aghajari commented 3 years ago

Hello again @androidiapp , can you upload a video ? MinScale is the minimum scale of zooming. not when touch released

androidiapp commented 3 years ago

[Uploading ZoomHelper.mp4.zip…]()

Hi @Aghajari

Please find the attached video .

androidiapp commented 3 years ago

Uploading ZoomHelper.mp4.zip…

Hi @Aghajari

Please find the attached video .

This is resolved at my end , it was due to style used in library .

i have changed it to android.R.style.Theme_Translucent_NoTitleBar_Fullscreen and it works .