I have implemente paging library 3 and it works and shows data , what i need to implement is loading more feature , so when the user scrolls down , it fetch a page 10 items , so basically between loading of new data i want to show a progressbar at the bottom but since it is my first using paging library 3 , i have no clue on how to do that , if someone could i'd appreciate it , thank you
- I tried to show and hide progress bar based on the loadstate of my adapter class but no luck
lifecycleScope.launch {
newsAdapter.loadStateFlow.collectLatest { loadingState ->
if(loadingState.refresh is LoadState.Loading){
binding.progressBar.visibility = View.GONE
}
if(loadingState.refresh is LoadState.Loading) {
binding.progressBar.visibility = View.VISIBLE
}
if(loadingState.refresh is LoadState.NotLoading){
binding.progressBar.visibility = View.GONE
}
}
}