-
Notifications
You must be signed in to change notification settings - Fork 271
Description
I wrap the RecyclerView with a SwipeRefreshLayout, when first enter the list page, set the SwipeRefreshLayout to loading progress, then do the paging refresh call like this,
@ExperimentalCoroutinesApi
private fun searchHistoryData() {
swipe_container.isRefreshing = true
searchJob?.cancel()
searchJob = lifecycleScope.launch {
viewModel?.refreshGameHistory()?.collect {
swipe_container.isRefreshing = false
adapter.submitData(it)
}
}
}Found the loading components not showing expected. profile the process via Android Studio, the RPC call executed after the adapter.submitData() calling, and it's running upon the main thread.
Since the PRC logics are in PagingSource load() suspend function. I can't decide the load function execute in which thread. my PRC function is a GRPC function, If I convert it to an async function, it will not convenient to handle the result.
In addition, the same as loading views, the footer view LoadState also been blocked.
And how should I do about this issue? If can consider adding an IO thread way to support it?
dependencies:
implementation "androidx.paging:paging-runtime:3.0.0-alpha01"
thanks!