Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fragment issue #11

Open
shoesboy opened this issue Sep 15, 2021 · 1 comment
Open

fragment issue #11

shoesboy opened this issue Sep 15, 2021 · 1 comment

Comments

@shoesboy
Copy link

hello aghajari

I have a question
I'm using five "fragments" for one "activity" in my app.
One "fragment" is again using two "fragments". This "fragment" has two "fragments" doing "show/hide", not "attach" depending on the button.

In issue #4

return supportFragmentManager.findFragmentById(R.id.container)?.view?.let {
             ZoomHelper.getInstance().dispatchTouchEvent(ev!!, it)
           }!! || super.dispatchTouchEvent(ev)

You advised this code, it works very well when "fragment" is attached or detached
However, after attaching another fragment from the existing "fragment", if you detach the fragment and show "fragment", the displayed "fragment" does not zoom.

What should I do in this case?

@Aghajari
Copy link
Owner

Aghajari commented Sep 23, 2021

Hi, i couldn't understand what exactly do you mean, but here an idea that can solve any issue:

  1. Add ZoomLayout to your project
  2. Fragments should use this layout as the main layout
class ZoomLayout @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyle: Int = 0
) : FrameLayout(context, attrs, defStyle)

    override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
        return (context != null && ZoomHelper.getInstance().dispatchTouchEvent(ev!!, this))
                || super.dispatchTouchEvent(ev)
    }
}

You won't need to override dispatchTouchEvent on the Activity anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants