0

PagingDataAdapter from Paging3 library internally manages two semantically different lists. adapter.snapshot() returns a ItemSnapshotList which includes placeholder elements. adapter.snapshot().items return a List which excludes placeholder items.

Now I had to update an element using it's id. Should find and pass the index based on ItemSnapshotList or List? Eg:

adapter.notifyItemChanged(
    adapter.snapshot().indexOfFirst { it!!.id == id } // is this correct ?
    adapter.snapshot().items.indexOfFirst { it.id == id } // or is this ?
    , PAYLOAD_STATUS to Status.Active  // payloads
)
Sourav Kannantha B
  • 2,860
  • 1
  • 11
  • 35

1 Answers1

0

I think it's impossible. Any change on your item,you need to destroy and rebuild the pagingList.

I think the best practice is change in your room, and the list observe the room.

pnkj
  • 406
  • 5
  • 17