I'm try to add separators to my list e.g A, "Apple", "Anaconda", B "Boys", "Bostwana" however, insertSeparators
doesn't seem to indicate when we are at the beginning or end.
adapter.submitData(pagingData.insertSeparators { before, after ->
val afterDate = DateItem().withDate(after?.transactionDate)
val beforeDate = DateItem().withDate(before?.transactionDate)
if (after != null && (before == null || afterDate.toString() != beforeDate?.toString())) {
return@insertSeparators afterDate
}
return@insertSeparators null
})
My expectations are that before
will be null at the beginning while after
will be null at the end of the list. But it's never null thus hard to know when we are at the beginning or end.
Apparently this is a known bug on the paging3 library 3.0.0alpha10 version.
https://issuetracker.google.com/issues/172254056