Skip to content

Commit

Permalink
[ADD] #307 스와이프 리프레시 직후에 각 멀티뷰 타입의 리스트를 비우고 notify 하는 함수 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
leeeha committed Feb 10, 2024
1 parent 81afcd0 commit 0dce6cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ class DiscoverFragment : BindingFragment<FragmentDiscoverBinding>(R.layout.fragm

private fun initRefreshLayoutListener() {
binding.refreshLayout.setOnRefreshListener {
multiViewAdapter.initMarathonCourses(emptyList())
multiViewAdapter.initRecommendCourses(emptyList())

viewModel.refreshDiscoverCourses()
binding.refreshLayout.isRefreshing = false
}
Expand Down Expand Up @@ -354,8 +357,11 @@ class DiscoverFragment : BindingFragment<FragmentDiscoverBinding>(R.layout.fragm
is UiStateV2.Loading -> showLoadingProgressBar()

is UiStateV2.Success -> {
dismissLoadingProgressBar()
// todo: 리프레시에 의한 추천코스 어댑터의 submitList 동작이 완료되고 나서
multiViewAdapter.initRecommendCourses(state.data)

// todo: 로딩 프로그레스바를 삭제해야 한다.
dismissLoadingProgressBar()
}

is UiStateV2.Failure -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import com.runnect.runnect.util.custom.deco.DiscoverMarathonItemDecoration
import com.runnect.runnect.util.custom.deco.DiscoverRecommendItemDecoration
import com.runnect.runnect.util.extension.colorOf
import com.runnect.runnect.util.extension.fontOf
import timber.log.Timber

sealed class DiscoverMultiViewHolder(binding: ViewDataBinding) :
RecyclerView.ViewHolder(binding.root) {
Expand Down Expand Up @@ -88,7 +89,10 @@ sealed class DiscoverMultiViewHolder(binding: ViewDataBinding) :
binding.rvDiscoverRecommend.apply {
layoutManager = GridLayoutManager(context, 2)
adapter = recommendAdapter.apply {
submitList(courses)
Timber.e("refresh before item count: ${itemCount}")
submitList(courses) {
Timber.e("refresh after item count: ${itemCount}")
}
}
addItemDecorationOnlyOnce(this)
}
Expand Down

0 comments on commit 0dce6cf

Please sign in to comment.