diff --git a/app/src/main/kotlin/cn/super12138/todo/views/fragments/ToDoFragment.kt b/app/src/main/kotlin/cn/super12138/todo/views/fragments/ToDoFragment.kt index 605a437..f0b3bae 100644 --- a/app/src/main/kotlin/cn/super12138/todo/views/fragments/ToDoFragment.kt +++ b/app/src/main/kotlin/cn/super12138/todo/views/fragments/ToDoFragment.kt @@ -86,7 +86,7 @@ class ToDoFragment : Fragment() { progressViewModel.updateProgress() } // 通知数据更改 - binding.todoList.adapter?.notifyItemRangeRemoved(0, todoList.size + 1) + binding.todoList.adapter?.notifyDataSetChanged() } .setNegativeButton(R.string.cancel, null) .show() @@ -108,16 +108,16 @@ class ToDoFragment : Fragment() { } }) - todoViewModel.addData.observe(viewLifecycleOwner, Observer { + todoViewModel.addData.observe(viewLifecycleOwner) { binding.todoList.adapter?.notifyItemInserted(todoList.size + 1) - }) + } - todoViewModel.removeData.observe(viewLifecycleOwner, Observer { + todoViewModel.removeData.observe(viewLifecycleOwner) { binding.todoList.adapter?.notifyItemRemoved(todoList.size + 1) - }) + } - todoViewModel.refreshData.observe(viewLifecycleOwner, Observer { + todoViewModel.refreshData.observe(viewLifecycleOwner) { binding.todoList.adapter?.notifyItemRangeChanged(0, todoList.size + 1) - }) + } } } diff --git a/app/src/main/res/layout/fragment_progress.xml b/app/src/main/res/layout/fragment_progress.xml index f556c49..fce80c1 100644 --- a/app/src/main/res/layout/fragment_progress.xml +++ b/app/src/main/res/layout/fragment_progress.xml @@ -40,41 +40,40 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_welcome_intro.xml b/app/src/main/res/layout/fragment_welcome_intro.xml index edce217..7204238 100644 --- a/app/src/main/res/layout/fragment_welcome_intro.xml +++ b/app/src/main/res/layout/fragment_welcome_intro.xml @@ -27,20 +27,20 @@ \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_welcome_progress.xml b/app/src/main/res/layout/fragment_welcome_progress.xml index 7cbc0b9..5b4d61b 100644 --- a/app/src/main/res/layout/fragment_welcome_progress.xml +++ b/app/src/main/res/layout/fragment_welcome_progress.xml @@ -13,11 +13,11 @@ android:padding="20dp"> - - \ No newline at end of file diff --git a/app/src/main/res/layout/item_empty.xml b/app/src/main/res/layout/item_empty.xml index 94f7b6d..72d1aba 100644 --- a/app/src/main/res/layout/item_empty.xml +++ b/app/src/main/res/layout/item_empty.xml @@ -6,6 +6,7 @@ + tools:text="Title" /> + android:textSize="11sp" + tools:text="Subject" />