I’m a Senior Android developer and an happy Monzo user!
I like to explore Monzo app features and while doing so I noticed a place for improvement.
Like in my Place of work, you probably have the same no 3rd party library policy.
(unless it’s absolutely essential)
Lately, I had a task to implement sticky headers functionality and this is why I noticed your implementation.
Most likely, you’re using recycler view item decoration to create this sticky header behaviour. There are tons of how-to’s articles online and this is where I started to look for a solution.
It’s not a show stopper but when you click the sticky header (the top most header), the click is transferred to the item below. It’s how I expect it to behave because the sticky header is not a view but just a drawing.
Like I said, It’s not a show stopper but it really bugs me, and moreover I needed to scroll to a selected item position in the list which is not possible with this implementation because when you invoke scroll to position it will draw the item below the sticky header…
My solution was also based on item decoration but instead of implementing a listener in the adapter (like most online articles do), I extended recycler view and implemented the item decoration listener there.
I also override onInterceptTouchEvent And check if the motion event is inside the sticky header box- If it does I block and ignore it. This is how you prevent the clicks to go through the sticky header to the item below.
For the scroll to position I just override scrollToPosition method and called the layout manager scroll to position with offset.
Pretty simple right?
Hope it helps