Skip to content

Commit

Permalink
Add new subject and animation of to-do list
Browse files Browse the repository at this point in the history
  • Loading branch information
Super12138 committed Jan 24, 2024
1 parent 435b2fc commit 80cfce1
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
11 changes: 11 additions & 0 deletions app/src/main/kotlin/cn/super12138/todo/views/todo/ToDoFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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) {
Expand Down
11 changes: 9 additions & 2 deletions app/src/main/res/layout/dialog_add_todo.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
Expand Down Expand Up @@ -106,6 +106,13 @@
android:layout_height="wrap_content"
android:text="@string/subject_law" />

<com.google.android.material.chip.Chip
android:id="@+id/subject_other"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/subject_other" />

</com.google.android.material.chip.ChipGroup>
</LinearLayout>
</ScrollView>
</androidx.core.widget.NestedScrollView>
1 change: 0 additions & 1 deletion app/src/main/res/layout/fragment_todo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">

<!--<LinearLayout
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<string name="subject_history">历史</string>
<string name="subject_geography">地理</string>
<string name="subject_law">道法</string>
<string name="subject_other">其它</string>
<!--UI-->
<string name="cancel">取消</string>
<string name="ok">确定</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<string name="subject_history">History</string>
<string name="subject_geography">Geography</string>
<string name="subject_law">Law</string>
<string name="subject_other">Other</string>
<!--UI-->
<string name="cancel">Cancel</string>
<string name="ok">OK</string>
Expand Down

0 comments on commit 80cfce1

Please sign in to comment.