Closed niamh-power closed 7 years ago
Using this library in an external project we have found out that we receive lots of events from the onGlobalLayoutListener
onGlobalLayoutListener
This is causing the application to trigger events for views that don't exist anymore and lingering listeners from views that never get detached
viewPager
LandingStrip.detach(viewPager)
Paired with @joetimmins @zegnus
nice find! I never thought about the case where notifydatachanged would be called more than once
notifydatachanged
Problem
Using this library in an external project we have found out that we receive lots of events from the
onGlobalLayoutListener
This is causing the application to trigger events for views that don't exist anymore and lingering listeners from views that never get detached
Solution
onGlobalLayoutListener
by enqueing a runnable in the UI thread of the views.viewPager
so that the view doesn't hold invalid listeners.LandingStrip.detach(viewPager)
meant to destroy all listeners in order to prevent possible memory leaks.Paired with @joetimmins @zegnus