Closed mpivchev closed 4 years ago
hi! you can have any units in list wich you sent to adapter. so just add aditional method in unit factory:
interface UnitsFactory<T> {
fun createItemTile(data: T): CollectionUnitItem
fun createLoadingTile(): CollectionUnitItem
}
and then just combine this items in List:
myData.map { unitsFactory.createItemTile(it) }.plus(unitsFactory.createLoadingTile())
for example.
also pagination sample with moko-units
already exist in moko-paging
- https://github.com/icerockdev/moko-paging/blob/master/sample/mpp-library/src/commonMain/kotlin/com/icerockdev/library/ListViewModel.kt
I'd like to implement pagination on the RV, however I am not sure how to add a second unit (or a viewholder) for the loading view , that I then remove when more items are loaded.
Currently I only have a method to create a single ViewHolder (tile)