Skip to main content

Interactive Headers for StickyGridHeaders

Tonight, I added touch events to the section headers for StickyGridHeadersGridView. Unfortunately, as the headers in the StickyGridHeadersGridView live outside the internal GridView list implementation, I had to implement my own touch event handling rather than simply wrapping around that which is provided by GridView. Unfortunately, adding tap and long press actions in a ViewGroup is moderately complicated and in this case it is made considerable more complicated as StickyGridHeadersGridView is a subclass of AbsListView. AbsListView takes over the touch events at various stages and has an internal state tracker for determining the current user action, be it flinging, scrolling, long pressing, or tapping, there are some other internal states too. Anyway, the solution to correctly implementing interactive headers for StickyGridHeaders' was to read the events before the underlying GridView receives them and block (consume) the specific cases where the user is tapping or long pressing the headers.

For the user of the StickGridHeadersGridView library this means that, with the simple addition of an OnHeaderClickListener, or an OnHeaderLongClickListener, the headers can now be made interactive.

Comments

Popular posts from this blog

SuperSLiM 'should've been a weekly' update