mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-06-05 17:00:23 +02:00
tweaking the way checklist items are moved to the top or bottom
This commit is contained in:
@ -148,26 +148,25 @@ class ChecklistAdapter(activity: BaseSimpleActivity, var items: ArrayList<Checkl
|
||||
}
|
||||
|
||||
private fun moveSelectedItemsToTop() {
|
||||
selectedKeys.withIndex()
|
||||
.reversed()
|
||||
.forEach { keys ->
|
||||
val position = items.indexOfFirst { it.id == keys.value }
|
||||
val tempItem = items[position]
|
||||
items.removeAt(position)
|
||||
items.add(0, tempItem)
|
||||
}
|
||||
selectedKeys.reversed().forEach { checklistId ->
|
||||
val position = items.indexOfFirst { it.id == checklistId }
|
||||
val tempItem = items[position]
|
||||
items.removeAt(position)
|
||||
items.add(0, tempItem)
|
||||
}
|
||||
|
||||
notifyDataSetChanged()
|
||||
listener?.saveChecklist()
|
||||
}
|
||||
|
||||
private fun moveSelectedItemsToBottom() {
|
||||
selectedKeys.withIndex()
|
||||
.forEach { keys ->
|
||||
val position = items.indexOfFirst { it.id == keys.value }
|
||||
val tempItem = items[position]
|
||||
items.removeAt(position)
|
||||
items.add(items.size, tempItem)
|
||||
}
|
||||
selectedKeys.forEach { checklistId ->
|
||||
val position = items.indexOfFirst { it.id == checklistId }
|
||||
val tempItem = items[position]
|
||||
items.removeAt(position)
|
||||
items.add(items.size, tempItem)
|
||||
}
|
||||
|
||||
notifyDataSetChanged()
|
||||
listener?.saveChecklist()
|
||||
}
|
||||
|
Reference in New Issue
Block a user