Closed dsantix closed 2 years ago
The file you mentioned shows the example directly under the comment:
val itemAdapter = ModelAdapter { element: IconModel ->
if (element is RightIconModel) {
RightModelIconItem(element)
} else {
ModelIconItem(element)
}
}
based on the Model
s type a different item will be used
I see, but in the example RightModelIconItem and ModelIconItem use the same IconModel. In my case I use a Header that has the Model different from ItemA and ItemB.
I want something like:
Am I using it the wrong way?
In the sample both have a base class IconModel
but one is of type RightIconModel
, as you can see in the type check.
Do you want your headers to be sticky or stay as part of the list? (Sticky headers are not part of this library, as this is usually handled by decorators or such) -> there's one sample activity in the sample app using an external library
for your order. you can surely achieve this either by having different model types (and in any case the top parent type could by Any
if nothing else common applies) and then map to the target items you expect.
In case you do not want to split Model
and Item
you can also achieve this.
Checklist