ebarrenechea / header-decor

A couple of sticky header decorations for android's recycler view.
Apache License 2.0
879 stars 159 forks source link

No way to invalidate header once it has been created #76

Closed gregghz closed 6 years ago

gregghz commented 7 years ago

StickyHeaderDecoration.getHeader has the section:

if (mHeaderCache.containsKey(key)) {
    return mHeaderCache.get(key);
} else {

Thus once a header has been added to the cache there it will never be regenerated. Calling any of the notify* methods on the adapter have no effect.

plzen commented 7 years ago

You can call clearHeaderCache:

decorator.clearHeaderCache()

https://github.com/edubarr/header-decor/blob/master/lib/src/main/java/ca/barrenechea/widget/recyclerview/decoration/StickyHeaderDecoration.java#L89

gregghz commented 7 years ago

thanks, that will be helpful. A way to invalidate a header specifically (like notifyItemChange(i)) would be a nice optimization.