mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Fix adapter bug (maybe)
This commit is contained in:
parent
7804da72b3
commit
0d868da5fc
2 changed files with 5 additions and 2 deletions
|
@ -290,10 +290,11 @@ class DownloadAdapter(
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
fun setDeleteCheckboxVisibility(visible: Boolean) {
|
||||
if (showDeleteCheckbox == visible) return
|
||||
showDeleteCheckbox = visible
|
||||
notifyItemRangeChanged(0, itemCount)
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
fun updateSelectedItem(id: Int, isSelected: Boolean) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.lagradost.cloudstream3.ui.download
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.app.Dialog
|
||||
import android.content.ClipboardManager
|
||||
|
@ -191,6 +192,7 @@ class DownloadFragment : Fragment() {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
private fun handleSelectedChange(selected: HashMap<Int, String>) {
|
||||
val adapter = binding?.downloadList?.adapter as? DownloadAdapter
|
||||
if (selected.isNotEmpty()) {
|
||||
|
@ -202,7 +204,7 @@ class DownloadFragment : Fragment() {
|
|||
binding?.downloadDeleteToolbar?.btnCancel?.setOnClickListener {
|
||||
adapter?.setDeleteCheckboxVisibility(false)
|
||||
adapter?.clearSelectedIds()
|
||||
adapter?.notifyItemRangeChanged(0, adapter.itemCount)
|
||||
adapter?.notifyDataSetChanged()
|
||||
|
||||
downloadsViewModel.clearSelectedIds()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue