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:
parent
e41ca6318a
commit
fb78676a81
1 changed files with 5 additions and 4 deletions
|
@ -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 ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue