Optimize text style

This commit is contained in:
Super12138 2024-11-09 17:32:48 +08:00
parent 9bd6452246
commit 35f8f69ddc
10 changed files with 33 additions and 36 deletions

View file

@ -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)
})
}
}
}

View file

@ -40,41 +40,40 @@
<TextView
android:id="@+id/complete_count"
style="?attr/textAppearanceDisplaySmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="0"
android:textAppearance="?attr/textAppearanceDisplaySmall"
android:textColor="?attr/colorOnSurface"
android:textStyle="bold" />
<TextView
style="?attr/textAppearanceDisplayMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="/"
android:textAppearance="?attr/textAppearanceDisplayMedium"
android:textColor="?attr/colorOnSurface"
android:textStyle="bold" />
<TextView
android:id="@+id/total_count"
style="?attr/textAppearanceDisplayMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:text="0"
android:textAppearance="?attr/textAppearanceDisplayMedium"
android:textColor="?attr/colorOnSurface"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/remain_count"
style="?attr/textAppearanceLabelMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="12sp"
android:visibility="gone" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -27,20 +27,20 @@
</com.google.android.material.card.MaterialCardView>
<TextView
style="?attr/textAppearanceHeadlineMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="@string/intro_title"
android:textAlignment="center"
android:textAppearance="?attr/textAppearanceHeadlineMedium"
android:textColor="?attr/colorOnSurface" />
<TextView
style="?attr/textAppearanceBodyMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/intro_description"
android:textAlignment="center"
android:textAppearance="?attr/textAppearanceBodyMedium"
android:textColor="?attr/colorOnSurfaceVariant" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View file

@ -13,11 +13,11 @@
android:padding="20dp">
<TextView
style="?attr/textAppearanceHeadlineMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/progress_title"
android:textAlignment="center"
android:textAppearance="?attr/textAppearanceHeadlineMedium"
android:textColor="?attr/colorOnSurface" />
<androidx.fragment.app.FragmentContainerView
@ -28,6 +28,7 @@
tools:layout="@layout/fragment_progress" />
<TextView
style="?attr/textAppearanceBodyMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/progress_description"

View file

@ -13,11 +13,11 @@
android:padding="20dp">
<TextView
style="?attr/textAppearanceHeadlineMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/todo_btn_title"
android:textAlignment="center"
android:textAppearance="?attr/textAppearanceHeadlineMedium"
android:textColor="?attr/colorOnSurface" />
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
@ -31,6 +31,7 @@
app:icon="@drawable/ic_add" />
<TextView
style="?attr/textAppearanceBodyMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/todo_btn_description"

View file

@ -13,11 +13,11 @@
android:padding="20dp">
<TextView
style="?attr/textAppearanceHeadlineMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/todo_item_title"
android:textAlignment="center"
android:textAppearance="?attr/textAppearanceHeadlineMedium"
android:textColor="?attr/colorOnSurface" />
<com.google.android.material.card.MaterialCardView
@ -74,18 +74,11 @@
</com.google.android.material.card.MaterialCardView>
<TextView
style="?attr/textAppearanceBodyMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/todo_item_description_1"
android:textAlignment="center"
android:textColor="?attr/colorOnSurfaceVariant" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="@string/todo_item_description_2"
android:textAlignment="center"
android:textColor="?attr/colorOnSurfaceVariant" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View file

@ -6,6 +6,7 @@
<TextView
android:id="@+id/empty_tip"
style="?attr/textAppearanceLabelLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/no_tasks"

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
style="?attr/materialCardViewElevatedStyle"
android:layout_width="match_parent"
android:layout_height="80dp"
@ -26,6 +27,7 @@
<TextView
android:id="@+id/todo_content"
style="?attr/textAppearanceTitleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
@ -33,16 +35,18 @@
android:ellipsize="marquee"
android:singleLine="true"
android:textColor="?attr/colorOnSurface"
android:textSize="20sp" />
tools:text="Title" />
<TextView
android:id="@+id/todo_subject"
style="?attr/textAppearanceLabelLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:singleLine="true"
android:textColor="?attr/colorOnSurface"
android:textSize="11sp" />
android:textSize="11sp"
tools:text="Subject" />
</LinearLayout>
<Button

View file

@ -79,16 +79,15 @@
<string name="start">开始</string>
<string name="welcome_label">欢迎</string>
<string name="intro_title">欢迎使用待办</string>
<string name="intro_description">一个轻量且易用的待办应用</string>
<string name="intro_description">一个简单的待办应用</string>
<string name="enter_app">立即进入</string>
<string name="reenter_welcome_activity">再次进入欢迎页面</string>
<string name="progress_title">定睛看</string>
<string name="progress_description">这是待办进度条,它会提示你任务完成进度。当你添加待办或把待办标记成已完成时,它都会更新。左边的数字是你完成的任务数,右边的数字是全部的任务数;它也会在它们下面显示一行小字来提示你剩余任务数。</string>
<string name="progress_description">这是待办进度条,它会提示你任务完成进度。\n当你添加待办或把待办标记成已完成时,它都会更新。\n左边的数字是你完成的任务数,右边的数字是全部的任务数;它也会在它们下面显示一行小字来提示你剩余任务数。</string>
<string name="todo_btn_title">掌控尽在指尖</string>
<string name="todo_btn_description">这是添加待办的按钮,点击它你就可以添加一个新的待办事项了。长按它你就可以删除你目前所有的待办(这不能恢复,谨慎点击哦)。</string>
<string name="todo_btn_description">这是添加待办的按钮,点击它你就可以添加一个新的待办事项了。\n长按它你就可以删除你目前所有的待办(这不能恢复,谨慎点击哦)。</string>
<string name="todo_item_title">长按一下,功能多多</string>
<string name="todo_item_item_title">这是待办内容</string>
<string name="todo_item_item_subject">这是待办学科</string>
<string name="todo_item_description_1">这是待办列表的项目。点击右边的 √ 就可以把这个待办标记为已完成。如果你需要修改这个待办,只需长按即可修改。</string>
<string name="todo_item_description_2">以上就是待办的主要功能。当然,待办应用还有丰富的个性化选项和功能供你使用,立即点击下方按钮来进入应用吧!</string>
<string name="todo_item_description_1">这是待办列表的项目。\n点击右边的 √ 就可以把这个待办标记为已完成。\n如果你需要修改这个待办只需长按即可修改。</string>
</resources>

View file

@ -79,16 +79,15 @@
<string name="start">Start</string>
<string name="welcome_label">Welcome</string>
<string name="intro_title">Welcome to use To Do</string>
<string name="intro_description">A lite and useful to-do app</string>
<string name="intro_description">A simple to-do app</string>
<string name="enter_app">Enter at once</string>
<string name="reenter_welcome_activity">Reenter welcome page</string>
<string name="progress_title">Take a look!</string>
<string name="progress_description">This is the to-do progress bar that tracks your task completion. It updates when you add or mark tasks as done. The number on the left shows your completed tasks, while the number on the right indicates the total tasks. Below these numbers, a small line of text will show how many tasks are remaining.</string>
<string name="progress_description">This is the to-do progress bar that tracks your task completion.\n It updates when you add or mark tasks as done.\n The number on the left shows your completed tasks, while the number on the right indicates the total tasks. Below these numbers, a small line of text will show how many tasks are remaining.</string>
<string name="todo_btn_title">Control is at your fingertips!</string>
<string name="todo_btn_description">This is the button to add new to-dos. Click it to create a new task. Long press to delete all your current to-dos (this action cannot be undone, so be cautious!).</string>
<string name="todo_btn_description">This is the button to add new to-dos. Click it to create a new task. Long press to delete all your current to-dos (this action cannot be undone, so be cautious).</string>
<string name="todo_item_title">Long press for more options!</string>
<string name="todo_item_item_title">This is the task content</string>
<string name="todo_item_item_subject">This is the task subject</string>
<string name="todo_item_description_1">"This is an item in your to-do list. Click the checkmark on the right to mark it as completed. If you need to edit this to-do, just long press to make changes. "</string>
<string name="todo_item_description_2">That covers the main features of the to-do list. Of course, the app also offers a range of personalization options and additional features. Click the button below to explore the app now!</string>
</resources>