reddit / IndicatorFastScroll

Android library providing a simple UI control for scrolling through RecyclerViews
MIT License
707 stars 58 forks source link

Wrong Fast Scroll indicators when changing adapter's data #24

Closed enricocid closed 5 years ago

enricocid commented 5 years ago

Hello,

This is happening when changing adapter's data to be the results of search view filtering. Video showing the issue:

https://youtu.be/bXNZBMeEgSE

Not a critical problem, don't know if I'm doing something wrong.

You can have a look at filtering utility here

Setup of IFS here

To setup RV I'm using recyclical by @afollestad which uses DataSource for the construction and manipulation of data.

Probably I will remove IFS while filtering...

Lib version: 1.2.0 Android 9 Sept. patch (Mi A2 lite)

DSteve595 commented 5 years ago

Will take a look.

DSteve595 commented 5 years ago

Checked it out. The problem comes from the fact that when you call processQuery(), you're setting a new list of artists on the adapter; however, the fast scroller is still looking at mArtists, which contains all the unfiltered artists and isn't being updated. I'd recommend changing how you handle setQueryResults in your adapter, because it can save you from other bugs down the line. There are a lot of ways to fix it. Made https://github.com/enricocid/Music-Player-GO/pull/91 with an example of one.