Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not getting notified on PagedList updates

I am using the PagedList library in my app.

It all works as expected, using the PagedListAdapter. However, I am not able to find how I can get a callback and be notified that the PagedList has been updated.

At list's ItemKeyedDataSource is used to fetch the list's data from the network. At that point, the PagedListAdapter's submitList is called, providing a PagedList of length 0. When the DataSource has fetched the data from the network, its callback.onResult() is executed and the list's UI is updated showing the fetched items. However, this does not call the submitList method, and I have not found a way to be notified in the adapter of this update, as the onCurrentListChanged is neither called. How can the Adapter be notified of such changes?

Thank you :)

like image 960
Sarquella Avatar asked Nov 08 '22 05:11

Sarquella


1 Answers

You can use PagedList.addWeakCallback. You can pass a PagedList.Callback to it and listen to events such as onInserted, onChanged or onRemoved. More detail can be found in this answer

like image 111
Hellious Avatar answered Dec 04 '22 15:12

Hellious