-
Notifications
You must be signed in to change notification settings - Fork 81
Description
Actual Behavior
I implemented in my app a fullscreen RecyclerView with getPopupText support. It looks like this:
The problem is, the position provided by getPopupText is the first visible item in the Adapter. Though as you can see here, this item (framed in red) is actually barely visible. So while the user only sees items starting with "L", the popup still shows "K", because the very last "K" item still hasn't been recycled.
I was thinking maybe there is a smarter way than getFirstItemAdapterPosition() to get this position.
As I'm a bit curious, I investigated how other fast scrollers handle this issue. For instance, Nova Launcher's widget list uses a fast scroll which applies some kind of padding to this position, proportional to how low you are in the list (the more you scroll, the lower the item targeted by getPopupText is on the screen). Which enables their popup to use the very first item's position when you're at the top, the very last item's position when you're at the bottom, and the position of an item which is always visible when you're anywhere in between.
It's kinda hard to explain with words. Actually experimenting with it helps to understand.
I am also aware that the Google Contacts app works in a similar way (using the first visible item), though it's not a problem because their list is not full screen, and the list snaps when fast scrolling, to make sure the first item is always fully visible. Not all lists can mimic this behavior though.
Expected Behavior
The position provided by getPopupText should target an item which is always (clearly) visible to the user.
Steps to Reproduce the Problem
- Create a
RecyclerViewand simply bind a FastScroller withFastScrollerBuilder(recyclerView).build()(the issue is more visible with a full screen RV). - Implement
PopupTextProviderin the Adapter. - Scroll.
Specifications
- Version: v1.1.0
- Platform: Android 10, OnePlus 6 OxygenOS 10.3.1, no root
Don't hesitate to ask for more details if it wasn't clear. :)
Thanks!

