turing-tech / MaterialScrollBar

An Android library that brings the Material Design 5.1 sidebar to pre-5.1 devices.
Apache License 2.0
778 stars 126 forks source link

Wrong drag fast scroll section #93

Open hendrawd opened 7 years ago

hendrawd commented 7 years ago

I am testing recyclerview with header with google default example project, so i am following https://github.com/turing-tech/MaterialScrollBar/wiki/Header-Tutorial

But the result of the drag scroller text when expanded is wrong

It should show "This is element #9999 - act as content" instead of "This is element #9981 - act as content"

What am i doing wrong here? Here is my test project https://github.com/hendrawd/drag-fast-scroller-test

marbat87 commented 7 years ago

@hendrawd I think that the element reported in the bubble is the first visible one.

hendrawd commented 7 years ago

"Item #9981" isn't even visible on the screen

hendrawd commented 7 years ago

I already tried with GridLayoutManager with 1 span count, but the problem still exist, especially if there are many items there. If the items is not many, then the bug isn't noticeable

marbat87 commented 7 years ago

@hendrawd There is the last word regarding "item #9981" ("content" ad the top"). isn't it?

hendrawd commented 7 years ago

The top left content word is "item #9983"

hendrawd commented 7 years ago

Is using int accurate for the height of IHeaderAdapter.getHeaderHeight() and IHeaderAdapter.getRowHeight()? Because i am afraid it can lead to wrong calculation. For example i have RecyclerView with GridLayoutManager. It has 3 items in a row with square items inside it, so the height of each item is screen width in pixel / 3. If i do the calculation and convert it to int, it will be rounded automatically, that will lead to higher height.

turing-tech commented 7 years ago

If you'd like to try using floats feel free to fork the library and try it out for yourself.