sticky-index icon indicating copy to clipboard operation
sticky-index copied to clipboard

Fading title issue for sections with only one item

Open Nams29 opened this issue 6 years ago • 3 comments

Hi @edsilfer

I noticed that if the user scrolls fast, the fading of some section titles doesn't have the time to update its alpha value : it stays a bit faded or even completely transparent. It seems to happen only for sections with one item, regardless of their position in the list. This bug was also present on the previous version of the library.

Here are two examples : 'J' and 'K' are faded 'D' is invisible and 'G' is faded

Here is an example project : http://www.mediafire.com/file/15xbax4y2mk9wjv/MyApplication.zip

Do you have any idea how to fix this behavior ?

Nams29 avatar May 07 '18 08:05 Nams29

Hi @Nams29 , this is how the alpha is computed so far:

private fun computeAlpha(row: View, idx: TextView) = 1 - abs(row.y) / idx.height

I think a possible fix for this bug would be adding a threshold, i.e. if computed alpha is greater than 80%, return 100%. Could you test this approach for the scenario you've described - and also for the general case of fast scrolling with multiple items in a section?

If that doesn't work we might have to start thinking about fancier situations - like computing the scroll speed and disabling the effect for speed greater than a given value. If that is the case the fix will have to wait a little bit.

edsilfer avatar May 07 '18 09:05 edsilfer

While this issue is still occurring why not to add new attribute in StickyIndex for disabling fading? Awesome library though!

zkvarz avatar May 25 '18 14:05 zkvarz

@edsilfer I am also having the same issue. Do you have any plans to fix that issue? Also there is a flickering issue while scrolling the bubble, I've tried to fix it but no luck :/

Swisyn avatar Jul 17 '19 15:07 Swisyn