Fix empty history view when all history is removed

`onChanged()` is trigered when `notifyDataSetChanged()` is called. Since `notifyItemRemoved(Int)` is used override `onItemRangeRemoved()`.
This commit is contained in:
Krunal Patel 2022-11-28 20:21:00 +05:30
parent f76da90447
commit 7d878476d1

View File

@ -89,7 +89,7 @@ class WatchHistoryFragment : BaseFragment() {
// observe changes
watchHistoryAdapter.registerAdapterDataObserver(object :
RecyclerView.AdapterDataObserver() {
override fun onChanged() {
override fun onItemRangeRemoved(positionStart: Int, itemCount: Int) {
if (watchHistoryAdapter.itemCount == 0) {
binding.watchHistoryRecView.visibility = View.GONE
binding.historyEmpty.visibility = View.VISIBLE