airbnb / epoxy

Epoxy is an Android library for building complex screens in a RecyclerView
https://goo.gl/eIK82p
Apache License 2.0
8.51k stars 728 forks source link

implement a download list through epoxy,ui not refreshed #1377

Closed yihuajia closed 6 months ago

yihuajia commented 6 months ago

When I implement a download list through epoxy, there is a progress bar in each item in the list to indicate the download progress of the current item. Then when calling setData frequently, the progress bar is only updated when the progress reaches 100%. Before reaching 100%, in the requestDelayedModelBuild method, requestedModelBuildType == RequestedModelBuildType.NEXT_FRAME, it is returned directly.

withState(viewModel) { state -> Log.d("download","item progress in with state:${task.progress}") val list = state.result.invoke()?.update({it.copy(progress = task.progress)}, {it.key == task.key}) ?: arrayListOf() controller.setData(list) }