bgogetap / StickyHeaders

Easily add Sticky Headers to your RecyclerView
Apache License 2.0
521 stars 88 forks source link

Sync Header View and Normal View #28

Closed PrinceSachdeva closed 7 years ago

PrinceSachdeva commented 7 years ago

@bgogetap : I want to sync both the views i.e view in normal state and view in header state.Lets suppose there is a radio group on that view and i want to sync the selected radio button in synced state.

bgogetap commented 7 years ago

Since the sticky header is a new instance of the view, framework level view state won't be synced. If you want to keep them in sync, I would recommend holding the state elsewhere (possibly something like a BehaviorSubject/BehaviorRelay that's injected into the view, or use a view model type pattern).

PrinceSachdeva commented 7 years ago

@bgogetap how i can get that reference to the new instance of that view, so that i can update that view to keep them in sync.

bgogetap commented 7 years ago

A reference isn't needed if using a dependency injection framework like Dagger/Dagger 2. If this isn't something you're currently doing, I'd suggest looking into it.

However, I may look into adding a listener to the library that will notify when a header is attached/detached and pass the instance of the view (or the view holder) to that callback. Would something like that help you?

PrinceSachdeva commented 7 years ago

@bgogetap If you will add a listener then it would be great.Thanks for your support

bgogetap commented 7 years ago

Sure, I'll hopefully get to it this weekend. And I mean that more than I did when I said that in #27 ;)

PrinceSachdeva commented 7 years ago

Thanks @bgogetap