I have implemented search contacts applications. Contact list may be very large. For implementation I used kotlin flow
, RecyclerView
and AsyncListDiffer
. Initially, I used diff util, but after that I noticed that on some devices, lags began when searching and updating the list. I understand that this is due to the fact that the list is updated in the ui thread and because of this, ui is blocked. So I decided to use AsyncListDiffer
. After that, the lags stopped. But now my list is updated with a slight delay. That is, in the search field, I enter the numbers of the contact and only after a few seconds my list is updated according to the number entered in the edit text. I use the progress bar, but how do I know when ui has updated and can I stop the progress bar?
Please, help me.
Use ListAdapter here example usage and documentation -> https://developer.android.com/reference/androidx/recyclerview/widget/ListAdapter
after you submitList you can hide your progressbar when recyclerView is ready
adapter.submitList(myList) {
// TODO: HIDE THE PROGRESS BAR
}