From 74cdea8cfb7889f1830330bbeb4c8bb461d94010 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 10 Jan 2021 19:16:23 +0100 Subject: [PATCH] tweaking some things about checklist item removal --- .../notes/pro/fragments/ChecklistFragment.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/ChecklistFragment.kt b/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/ChecklistFragment.kt index 77d72205..81e653e7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/ChecklistFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/pro/fragments/ChecklistFragment.kt @@ -129,8 +129,6 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener { saveNote() setupAdapter() - - (view.checklist_list.adapter as? ChecklistAdapter)?.notifyDataSetChanged() } } @@ -173,14 +171,13 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener { } fun removeDoneItems() { - items.removeIf { it.isDone } - updateUIVisibility() - view.checklist_list.adapter?.notifyDataSetChanged() + items = items.filter { !it.isDone }.toMutableList() as ArrayList saveNote() + setupAdapter() } private fun updateUIVisibility() { - with(view) { + view.apply { fragment_placeholder.beVisibleIf(items.isEmpty()) fragment_placeholder_2.beVisibleIf(items.isEmpty()) checklist_list.beVisibleIf(items.isNotEmpty())