Created
December 8, 2020 14:38
-
-
Save enginebai/89b6cb85a7b79f7d089033374e63fb9e to your computer and use it in GitHub Desktop.
MovieHunt blog part5. epoxy model and controller sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LargeEpoxyModel : EpoxyModel { | |
override fun bind() { | |
// binding implementation | |
} | |
} | |
class NormalEpoxyModel : EpoxyModel { | |
override fun bind() { | |
// binding implementation | |
} | |
} | |
class ModelController(private val movieList: List<MovieModel>): EpoxyController() { | |
override fun buildModels() { | |
movieList.orEachIndexed { index, movie -> | |
if (index == 0) { | |
LargeEpoxyModel_() | |
.addTo(this) | |
} else { | |
NormalEpoxyModel_() | |
.addTo(this) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment