Skip to content

Commit 74cdea8

Browse files
committed
tweaking some things about checklist item removal
1 parent e9b5efa commit 74cdea8

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/ChecklistFragment.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
129129

130130
saveNote()
131131
setupAdapter()
132-
133-
(view.checklist_list.adapter as? ChecklistAdapter)?.notifyDataSetChanged()
134132
}
135133
}
136134

@@ -173,14 +171,13 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
173171
}
174172

175173
fun removeDoneItems() {
176-
items.removeIf { it.isDone }
177-
updateUIVisibility()
178-
view.checklist_list.adapter?.notifyDataSetChanged()
174+
items = items.filter { !it.isDone }.toMutableList() as ArrayList<ChecklistItem>
179175
saveNote()
176+
setupAdapter()
180177
}
181178

182179
private fun updateUIVisibility() {
183-
with(view) {
180+
view.apply {
184181
fragment_placeholder.beVisibleIf(items.isEmpty())
185182
fragment_placeholder_2.beVisibleIf(items.isEmpty())
186183
checklist_list.beVisibleIf(items.isNotEmpty())

0 commit comments

Comments
 (0)