https://kotlinlang.org logo
#compose
Title
# compose
s

Socheat KHAUV

10/08/2020, 9:59 AM
Any example about LazyColumnFor + LiveData + Pagination (Page3, LoadMore) etc ?
g

Gabriel

10/08/2020, 10:46 AM
I haven't don't it with livedata, but
Copy code
@Composable
fun ImageListColumn(
	items: List<ImageItem>,
	fetchNextDataPage: () -> Unit
) {
	val lastIndex = items.lastIndex

	LazyColumnForIndexed(items = items, contentPadding = PaddingValues(5.dp)) { index, item ->
		if (lastIndex == index) {
			onActive {
				fetchNextDataPage()
			}
		}
		ImageItem(item)
	}
}
this might give you a starting point
👍 1
a

Andrey Kulikov

10/08/2020, 10:47 AM
paging integration has been just merged(not yet released, but soon). it has some samples: https://android-review.googlesource.com/c/platform/frameworks/support/+/1428676
👍 6
g

Gabriel

10/08/2020, 10:56 AM
neat
4 Views