Skip to content

Commit 7740a3c

Browse files
committed
tweaking the way checklist items are moved to the top or bottom
1 parent 39e48b8 commit 7740a3c

File tree

16 files changed

+37
-42
lines changed

16 files changed

+37
-42
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ android {
5757
}
5858

5959
dependencies {
60-
implementation 'com.simplemobiletools:commons:5.32.24'
60+
implementation 'com.simplemobiletools:commons:5.33.7'
6161
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
6262
implementation 'androidx.documentfile:documentfile:1.0.1'
6363

app/src/main/kotlin/com/simplemobiletools/notes/pro/adapters/ChecklistAdapter.kt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -148,26 +148,25 @@ class ChecklistAdapter(activity: BaseSimpleActivity, var items: ArrayList<Checkl
148148
}
149149

150150
private fun moveSelectedItemsToTop() {
151-
selectedKeys.withIndex()
152-
.reversed()
153-
.forEach { keys ->
154-
val position = items.indexOfFirst { it.id == keys.value }
155-
val tempItem = items[position]
156-
items.removeAt(position)
157-
items.add(0, tempItem)
158-
}
151+
selectedKeys.reversed().forEach { checklistId ->
152+
val position = items.indexOfFirst { it.id == checklistId }
153+
val tempItem = items[position]
154+
items.removeAt(position)
155+
items.add(0, tempItem)
156+
}
157+
159158
notifyDataSetChanged()
160159
listener?.saveChecklist()
161160
}
162161

163162
private fun moveSelectedItemsToBottom() {
164-
selectedKeys.withIndex()
165-
.forEach { keys ->
166-
val position = items.indexOfFirst { it.id == keys.value }
167-
val tempItem = items[position]
168-
items.removeAt(position)
169-
items.add(items.size, tempItem)
170-
}
163+
selectedKeys.forEach { checklistId ->
164+
val position = items.indexOfFirst { it.id == checklistId }
165+
val tempItem = items[position]
166+
items.removeAt(position)
167+
items.add(items.size, tempItem)
168+
}
169+
171170
notifyDataSetChanged()
172171
listener?.saveChecklist()
173172
}

app/src/main/res/drawable-anydpi/ic_move_to_bottom.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.

app/src/main/res/drawable-anydpi/ic_move_to_top.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.
-188 Bytes
Binary file not shown.
-182 Bytes
Binary file not shown.
-119 Bytes
Binary file not shown.
-116 Bytes
Binary file not shown.
-162 Bytes
Binary file not shown.
-161 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)