From 80cfce19e18b72101a209929c1c689b5c1d6e92f Mon Sep 17 00:00:00 2001
From: Super12138 <70494801+Super12138@users.noreply.github.com>
Date: Wed, 24 Jan 2024 14:56:09 +0800
Subject: [PATCH] Add new subject and animation of to-do list
---
.../cn/super12138/todo/views/todo/ToDoFragment.kt | 11 +++++++++++
app/src/main/res/layout/dialog_add_todo.xml | 11 +++++++++--
app/src/main/res/layout/fragment_todo.xml | 1 -
app/src/main/res/values-zh-rCN/strings.xml | 1 +
app/src/main/res/values/strings.xml | 1 +
5 files changed, 22 insertions(+), 3 deletions(-)
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 f0c85f1..9654c97 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
@@ -105,6 +105,7 @@ class ToDoFragment : Fragment() {
R.id.subject_history -> getString(R.string.subject_history)
R.id.subject_physics -> getString(R.string.subject_physics)
R.id.subject_law -> getString(R.string.subject_law)
+ R.id.subject_other -> getString(R.string.subject_other)
else -> getString(R.string.subject_unknown)
}
@@ -172,10 +173,20 @@ class ToDoFragment : Fragment() {
todoViewModel.emptyTipVis.observe(viewLifecycleOwner, Observer { visibility ->
if (visibility == View.VISIBLE) {
+ binding.todoList.alpha = 1f
+ binding.todoList.animate().alpha(0f).duration = 200
binding.todoList.visibility = View.GONE
+
+ binding.emptyTip.alpha = 0f
binding.emptyTip.visibility = View.VISIBLE
+ binding.emptyTip.animate().alpha(1f).duration = 200
} else {
+ binding.todoList.alpha = 0f
binding.todoList.visibility = View.VISIBLE
+ binding.todoList.animate().alpha(1f).duration = 200
+
+ binding.emptyTip.alpha = 1f
+ binding.emptyTip.animate().alpha(0f).duration = 200
binding.emptyTip.visibility = View.GONE
}
if (todoList.size == 0 && !binding.addItem.isShown) {
diff --git a/app/src/main/res/layout/dialog_add_todo.xml b/app/src/main/res/layout/dialog_add_todo.xml
index 8bdb3f9..a948457 100644
--- a/app/src/main/res/layout/dialog_add_todo.xml
+++ b/app/src/main/res/layout/dialog_add_todo.xml
@@ -1,5 +1,5 @@
-
@@ -106,6 +106,13 @@
android:layout_height="wrap_content"
android:text="@string/subject_law" />
+
+
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_todo.xml b/app/src/main/res/layout/fragment_todo.xml
index 5fa5749..80d80f8 100644
--- a/app/src/main/res/layout/fragment_todo.xml
+++ b/app/src/main/res/layout/fragment_todo.xml
@@ -3,7 +3,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:animateLayoutChanges="true"
android:orientation="vertical">
取消
确定
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 0c82272..c1e0eac 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -20,6 +20,7 @@
History
Geography
Law
+ Other
Cancel
OK