DevAhamed / MultiViewAdapter

Easily create complex recyclerview adapters in android
https://devahamed.github.io/MultiViewAdapter
Apache License 2.0
818 stars 149 forks source link

Effect of expanding and collapsing an item on the holder's itemView #57

Closed premacck closed 6 years ago

premacck commented 6 years ago

When an item in the expandable list is expanded or collapsed, most of the contents of the holder's itemView are not affected (except the expand/contract indicator). I have a holder which has many complex views (including a TextureView) that do not need to be refreshed every time I expand or collapse that item. So I was thinking that shouldn't there be an alternative abstract method in the ItemBinder class which should get invoked instead of invoking the bind() method when expanding or collapsgin an item, where we put the views that get changed only on expanding/collapsing? I think the impact on performance could be reduced by this.

DevAhamed commented 6 years ago

Hi! Thanks for your interest in this library!

Yes, that would increase the performance. This can be achieved with DiffUtil class. Please take a look into this wiki - https://github.com/DevAhamed/MultiViewAdapter/wiki/DiffUtil-and-Payload

premacck commented 6 years ago

Thanks, that really solved my issue!