discord / OverlappingPanels

Overlapping Panels is a gestures-driven navigation UI library for Android
Apache License 2.0
420 stars 27 forks source link

PanelsChildGestureRegionObserver not working properly #23

Open im244 opened 3 years ago

im244 commented 3 years ago

Hey guys, first let me thank you for making this library opened sourced.

The problem I am facing is the following: one of my fargments is basically a full page recyclerview that every row of that recyclerview host another horizontal recyclerview, so my fragment is filled with horizontal scrollable recyclerviews. As the suggestion and following the example app, I added view.addOnLayoutChangeListener(PanelsChildGestureRegionObserver.Provider.get()) to the entire fragment view.

The issues is that sometimes it works and sometimes it does not work, when it works everything is perfect, when it doesn't the horizontal recyclerview is un scrollable and the panels won't open. The weird thing is that when it's not working, either locking the phones and opening it again will fix it (without closing the app), or even pressing the Home button and then going back to the app will fix it.

Any suggestiongs?

codeaskush commented 3 years ago

Hey guys, first let me thank you for making this library opened sourced.

The problem I am facing is the following: one of my fargments is basically a full page recyclerview that every row of that recyclerview host another horizontal recyclerview, so my fragment is filled with horizontal scrollable recyclerviews. As the suggestion and following the example app, I added view.addOnLayoutChangeListener(PanelsChildGestureRegionObserver.Provider.get()) to the entire fragment view.

The issues is that sometimes it works and sometimes it does not work, when it works everything is perfect, when it doesn't the horizontal recyclerview is un scrollable and the panels won't open. The weird thing is that when it's not working, either locking the phones and opening it again will fix it (without closing the app), or even pressing the Home button and then going back to the app will fix it.

Any suggestiongs?

Hi @ , I was thinking about the implementation, can you share the code where you setChildGestureRegions for the view. Would help me a lot.

sdex commented 3 years ago

I've figured out that isTouchingChildGestureRegion() returns the wrong value when using the library with fragments. To work around the issue I clear childGestureRegions list in each fragment onStop method:

    override fun onStop() {
        super.onStop()
        PanelsChildGestureRegionObserver.Provider.get()
            .removeGestureRegionsUpdateListener(this)
        onGestureRegionsUpdate(emptyList()) // this calls overlappingPanels.setChildGestureRegions(gestureRegions)
    }