From 60b23f1cf4be716256588dba9f1daa2d8d89f72c Mon Sep 17 00:00:00 2001 From: Super12138 <70494801+Super12138@users.noreply.github.com> Date: Fri, 5 Jan 2024 22:01:56 +0800 Subject: [PATCH] Fix fab hide when list empty --- .../main/kotlin/cn/super12138/todo/views/todo/ToDoFragment.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoFragment.kt b/app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoFragment.kt index 7358376..2669830 100644 --- a/app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoFragment.kt +++ b/app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoFragment.kt @@ -160,6 +160,9 @@ class ToDoFragment : Fragment() { binding.todoList.visibility = View.VISIBLE binding.emptyTip.visibility = View.GONE } + if (todoList.size == 0 && !binding.addItem.isShown) { + binding.addItem.show() + } }) todoViewModel.refreshData.observe(viewLifecycleOwner, Observer { binding.todoList.adapter?.notifyItemInserted(todoList.size + 1)