Fix the downloads empty indicator

This commit is contained in:
Bnyro 2023-02-07 19:36:59 +01:00
parent b5e7aeb5cd
commit fb0054d15e

View File

@ -108,11 +108,11 @@ class DownloadsFragment : BaseFragment() {
binding.downloads.adapter?.registerAdapterDataObserver( binding.downloads.adapter?.registerAdapterDataObserver(
object : RecyclerView.AdapterDataObserver() { object : RecyclerView.AdapterDataObserver() {
override fun onItemRangeRemoved(positionStart: Int, itemCount: Int) { override fun onItemRangeRemoved(positionStart: Int, itemCount: Int) {
if (itemCount == 0) { super.onItemRangeRemoved(positionStart, itemCount)
if (binding.downloads.adapter?.itemCount == 0) {
binding.downloads.visibility = View.GONE binding.downloads.visibility = View.GONE
binding.downloadsEmpty.visibility = View.VISIBLE binding.downloadsEmpty.visibility = View.VISIBLE
} }
super.onItemRangeRemoved(positionStart, itemCount)
} }
} }
) )