3
3
Fork 1
mirror of https://github.com/recloudstream/cloudstream.git synced 2024-08-15 01:53:11 +00:00

Use indices.forEach rather than forEachIndexed when we don't need item

This commit is contained in:
Luna712 2024-07-16 17:35:15 -06:00 committed by GitHub
parent e41ca6318a
commit fb78676a81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -349,16 +349,17 @@ class DownloadAdapter(
if (isMultiDeleteState == value) return
isMultiDeleteState = value
if (!value) {
currentList.forEachIndexed { index, _ ->
currentList.indices.forEach { index ->
notifyItemChanged(index)
}
} else notifyItemRangeChanged(0, itemCount)
}
fun notifyAllSelected() {
currentList.forEachIndexed { index, item ->
if (item.isSelected) return@forEachIndexed
notifyItemChanged(index)
currentList.indices.forEach { index ->
if (!currentList[index].isSelected) {
notifyItemChanged(index)
}
}
}