airbnb / airbnb/epoxy

How to use SimpleEpoxyModel

Open
#950 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
8.6k
Forks
734
PR merge metrics
No merged PRs in 30d

Description

I found this file which is supposed to give a sample for SimpleEpoxyModel but, well, it doesn't.
https://github.com/airbnb/epoxy/blob/master/epoxy-sample/src/main/java/com/airbnb/epoxy/sample/models/ColorModel.kt

~I can't figure out why SimpleExpoyModel is not working for me. My usage is this.~
```
fun EpoxyController.divider(addIf: Boolean = true) {
SimpleEpoxyModel(R.layout.list_item_vertical_divider).addIf(addIf, this)
}
```
```

```
```
override fun buildModels(list: List) {
list.forEachIndexed { index, item ->
// list stuff
divider(addIf = index < list.lastIndex)
}
}
```
~I get a blank recyclerView with nothing on it.~
~If I remove the divider line, everything works fine, but without any divider, of course.~

Contributor guide

Open the contributing guide

Research direction

Open epoxy-sample/src/main/java/com/airbnb/epoxy/sample/models/ColorModel.kt and compare its contents with the issue's SimpleEpoxyModel divider example. Use the provided snippets as the reproduction case; done means the sample clearly demonstrates a working SimpleEpoxyModel usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
documentation, mobile
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.