ListViewVariants icon indicating copy to clipboard operation
ListViewVariants copied to clipboard

header view should be invisible for top item (when the pinned header goes from an invisible to visible state)

Open cliffsun91 opened this issue 9 years ago • 8 comments

Hi, great little library btw, we've had some issues with the default android listviews and different height cells (some cells are header sections) with, which has caused bugs on some devices when using fastscroll (with certain datasets in the list). Your little POC library is great because its fits in with the new android design and also works great as all the cells are the same heights.

I've been trying to integrate your code into an application I am working on, however I noticed that there are a few small tweaks that are needed. The main one being that if you were to set the backgroundColor of the header views to transparent/null (comment out 'mAdapter.setPinnedHeaderBackgroundColor(pinnedHeaderBackgroundColor);' in MainActivity), you'll notice that when you scroll up so that the first item of an alphabetical section becomes 'pinned' (i.e. the pinned header view becomes visible in that locked position on the screen), you'll see the header view for the cell behind it still. Your sample app doesn't show this normally as you explicitly set the background colour for the header views, however if you have an app with a common background (which has a gradient for example), you'd want to allow the background of the header view to be transparent.

I suspect that all we would need to do is in PinnedHeaderListView.configureHeaderView(int position) in the PINNED_HEADER_VISIBLE state is find the first visible element of the list and make the header view in that invisible. Oppositely when the pinned header goes into the PINNED_HEADER_GONE state (which seems to only happen when scrolling up between the beginning of a section and the end of the previous section) we should then find the first visible element of the list and make the header view visible.

cliffsun91 avatar May 19 '15 10:05 cliffsun91