reddit/IndicatorFastScroll

Indicators are not updated upon 'swapAdapter'

Closed this issue · 3 comments

Hello and thank you for this great library!

I have a project that uses a SortedList for handling sorting and filtering logic in my RecyclerView using different comparators to enable different sorting modes. This works great apart from the fact that a SortedList cannot be resorted, so when the user changes the sorting mode I create a new Adapter and calls swapAdapter() which efficiently changes the adapter of the RecyclerView and does not clear the RecycledViewPool.

Calls to setAdapter() or swapAdapter() is currently not supported by this library and does not update the fast scroll-indicators. Since it is currently also not possible to "re-setup" an IndicatorFastScrollView, it would be great if you could create a public method which refreshes the reference to the adapter and updates the item indicators.

Thanks!

Definitely an issue, the view wasn't built to support switching adapters. It shouldn't be too much work to hook that up. I'll take a look. Thanks for the report!

@gustavaa Try version 1.2.0-beta01 and let me know how it goes!

@DSteve595 After some testing it seems to work perfectly. Thanks a lot for fixing this!