You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to ask why is onScrollListener removed in FastScroller#onDetachedToWindow? I mean, if it's for preventing leaks when the window is detached, why remove only the onScrollListener? How about the other listeners like OnLayoutChangeListener and OnPreDrawListener? Or how about adding it again in FastScroller#onAttachedToWindow?
For context, I use FastScroller in views on a ViewPager. Then, I change the PagerAdapter in runtime. This causes the FastScroller#onDetachedToWindowto be called. Eventually, FastScroller#onAttachedToWindow is called. But since the onScrollListener is not re-added, I no longer receive onScrolled callbacks. Hence, FastScroller will no longer be displayed (unless the view is recreated).
The text was updated successfully, but these errors were encountered:
@arpinca, the first version was took from another project, changing the ViewPager Adapter wasn't foreseen.
I will fix it. But a question:
I checked that swiping the ViewPager it detaches the old fastcroller, and the new one is added when RecyclerView is created for that fragment. I noticed that onAttachedToWindow is triggered before RecyclerView is created, Does your issue come only when you change the Adapter of the pager and not of the RecyclerView?
davideas
changed the title
[Question][FastScroller] OnScrollListener removed onDetachedToWindow?
[FastScroller] OnScrollListener removed onDetachedToWindow?
May 22, 2017
Since I do not have example to swap the ViewPager Adapter at runtime and I cannot publish a new Snapshot, could you please check if adding the following in your version resolves the issue, if you can?
@OverrideprotectedvoidonAttachedToWindow() {
super.onAttachedToWindow();
if (recyclerView != null) {
// Occurs only when a new ViewPager is changed at runtimerecyclerView.addOnScrollListener(onScrollListener);
}
}
Hi,
I'd like to ask why is
onScrollListener
removed inFastScroller#onDetachedToWindow
? I mean, if it's for preventing leaks when the window is detached, why remove only the onScrollListener? How about the other listeners like OnLayoutChangeListener and OnPreDrawListener? Or how about adding it again inFastScroller#onAttachedToWindow
?For context, I use FastScroller in views on a ViewPager. Then, I change the PagerAdapter in runtime. This causes the
FastScroller#onDetachedToWindow
to be called. Eventually,FastScroller#onAttachedToWindow
is called. But since the onScrollListener is not re-added, I no longer receive onScrolled callbacks. Hence, FastScroller will no longer be displayed (unless the view is recreated).The text was updated successfully, but these errors were encountered: