drakeet / MultiType

Flexible multiple types for Android RecyclerView.
Apache License 2.0
5.76k stars 751 forks source link

Headers and footers #203

Closed mac229 closed 6 years ago

mac229 commented 6 years ago

[ Feature Request]

I would like to have automatic support for headers and footers, but
onBindViewHolder() method is final so I cant override it. Of course it would be good, but in this case it is closed for customization.

drakeet commented 6 years ago

See #194

drakeet commented 6 years ago

The use of final is intended to avoid user-defined destruction of the package and boils down to the problem of being considered MultiType. If you need to override these final methods, you should consider combining rather than inheriting, that is, creating an Adapter that contains a MultiTypeAdapter instead of inheriting the MultiTypeAdapter.

drakeet commented 6 years ago

MultiTypeAdapter is not a class designed for inheritance. The book Effective Java states: Minimize the accessibility of classes and members, and either design for inheritance, provide documentation, or prohibit inheritance. In Kotlin language design, this principle is followed, all classes by default are final, all methods by default are final, unless specifically marked open.

mac229 commented 6 years ago

Yes, you are right. Thanks for reply.