mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Fix
This commit is contained in:
parent
6ee2a54e7a
commit
14c1a36f82
1 changed files with 9 additions and 5 deletions
|
@ -311,11 +311,13 @@ class DownloadAdapter(
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
fun setIsMultiDeleteState(value: Boolean) {
|
||||
if (isMultiDeleteState == value) return
|
||||
isMultiDeleteState = value
|
||||
if (!value) {
|
||||
clearSelectedItems()
|
||||
selectedIds.clear()
|
||||
notifyDataSetChanged()
|
||||
} else notifyItemRangeChanged(0, itemCount)
|
||||
}
|
||||
|
||||
|
@ -329,11 +331,13 @@ class DownloadAdapter(
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
fun clearSelectedItems() {
|
||||
if (selectedIds.isNotEmpty()) {
|
||||
selectedIds.clear()
|
||||
notifyDataSetChanged()
|
||||
val selectedPositions = selectedIds.keys.mapNotNull { id ->
|
||||
currentList.indexOfFirst { it.data.id == id }.takeIf { it != -1 }
|
||||
}
|
||||
selectedIds.clear()
|
||||
selectedPositions.forEach {
|
||||
notifyItemChanged(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue