mikepenz/FastAdapter

[Question] DiffUtil for ModelAdapter (like in ModelItemActivity)?

marius-zilinskas opened this issue · 1 comments

About this issue

I am trying to figure out how to use FastAdapterDiffUtil when using GenericModelAdapter.

Let's use as an example ModelItemActivity. It has IconModel, which does not extend GenericItem. I have the exact same situation in my code.

How to calculate Diff in ModelItemActivity when you have a list of IconModels for adapter which is ModelAdapter?

All FastAdapterDiffUtil calculateDiff methods require that provided items must extend GenericItem 😕

Checklist

@Mariius the FastAdapterDiffUtil takes a ModelAdapter.

The GenericModelAdapter is just a specific variant of the ModelAdapter e.g. with the generic types pre-filled for you

typealias GenericModelAdapter<Model> = ModelAdapter<Model, GenericItem>

The type should be dependent on the adapter you use with it. as you can see the GenericItem is just a base type alias with the lowest possible generic type

typealias GenericItem = IItem<out RecyclerView.ViewHolder>

the DiffUtilActivity for example does it with SimpleItem