An example of Hannes Dorfmann AdapterDelegate pattern impl.
The reason of this project is to show how simple is to design and write your own "AdapterDelegate" implementation.
There an example of using AdapterDelegate in simple Android project :sample.
- don't put
adapterintoviewmodel. it's ok to have link to viewmodel in adapter, but adapter shouldn't have link to viewmodel, bcs viewmodel have different scope and alive longer - each item should be possible to be compared - it's the same unit and it was changed. Easy way for it, set for same unit key
layout idand for was changed make delegatedata classand useAny::equals - remember, if you don't clear listeners on
onViewRecycled/onUnbindViewHolder, it could affect ononBindViewHolder/onBind DiffUtilwork rly slow on big diffs- don't make Entity an RecyclerViewDelegate for reusabilyty
- RecyclerViewDelegate has access to event listener only on bind state. otherwise user may create leak by refs viewmodel as event listener and delegates in livedata