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,18 +349,19 @@ class DownloadAdapter(
if (isMultiDeleteState == value) return if (isMultiDeleteState == value) return
isMultiDeleteState = value isMultiDeleteState = value
if (!value) { if (!value) {
currentList.forEachIndexed { index, _ -> currentList.indices.forEach { index ->
notifyItemChanged(index) notifyItemChanged(index)
} }
} else notifyItemRangeChanged(0, itemCount) } else notifyItemRangeChanged(0, itemCount)
} }
fun notifyAllSelected() { fun notifyAllSelected() {
currentList.forEachIndexed { index, item -> currentList.indices.forEach { index ->
if (item.isSelected) return@forEachIndexed if (!currentList[index].isSelected) {
notifyItemChanged(index) notifyItemChanged(index)
} }
} }
}
fun notifySelectionStates() { fun notifySelectionStates() {
currentList.indices.forEach { index -> currentList.indices.forEach { index ->