From 7b05b2e754fcf5deb5dccc89f61701bfcb8d37ae Mon Sep 17 00:00:00 2001
From: Super12138 <70494801+Super12138@users.noreply.github.com>
Date: Thu, 15 Aug 2024 11:20:21 +0800
Subject: [PATCH] Add welcome page
---
app/src/main/AndroidManifest.xml | 5 +
.../main/kotlin/cn/super12138/todo/ToDoApp.kt | 10 ++
.../cn/super12138/todo/constant/Constants.kt | 6 +-
.../super12138/todo/constant/GlobalValues.kt | 3 +-
.../kotlin/cn/super12138/todo/utils/Toast.kt | 16 --
.../kotlin/cn/super12138/todo/utils/Utils.kt | 36 +++++
.../todo/views/all/AllTasksActivity.kt | 1 -
.../todo/views/main/MainActivity.kt | 9 +-
.../todo/views/progress/ProgressFragment.kt | 1 -
.../todo/views/settings/SettingsFragment.kt | 13 +-
.../todo/views/todo/ToDoFragment.kt | 1 -
.../todo/views/welcome/WelcomeActivity.kt | 140 ++++++++++++++++++
.../todo/views/welcome/WelcomeViewModel.kt | 8 +
.../todo/views/welcome/pages/BasePage.kt | 15 ++
.../todo/views/welcome/pages/IntroPage.kt | 21 +++
.../todo/views/welcome/pages/ProgressPage.kt | 21 +++
.../todo/views/welcome/pages/ToDoBtnPage.kt | 35 +++++
.../todo/views/welcome/pages/ToDoItemPage.kt | 32 ++++
.../main/res/drawable/bg_item_complete.xml | 3 +-
.../main/res/drawable/ic_arrow_forward.xml | 13 ++
app/src/main/res/drawable/ic_focus.xml | 12 ++
app/src/main/res/drawable/ic_next.xml | 13 ++
app/src/main/res/drawable/ic_previous.xml | 13 ++
app/src/main/res/layout/activity_welcome.xml | 58 ++++++++
app/src/main/res/layout/bottom_sheet_todo.xml | 7 +-
app/src/main/res/layout/fragment_progress.xml | 2 +-
.../res/layout/fragment_welcome_intro.xml | 46 ++++++
.../res/layout/fragment_welcome_progress.xml | 37 +++++
.../res/layout/fragment_welcome_todo_btn.xml | 40 +++++
.../res/layout/fragment_welcome_todo_item.xml | 91 ++++++++++++
app/src/main/res/layout/item_empty.xml | 3 +-
app/src/main/res/values-zh-rCN/strings.xml | 17 +++
app/src/main/res/values/strings.xml | 17 +++
app/src/main/res/xml/preferences.xml | 6 +
34 files changed, 718 insertions(+), 33 deletions(-)
delete mode 100644 app/src/main/kotlin/cn/super12138/todo/utils/Toast.kt
create mode 100644 app/src/main/kotlin/cn/super12138/todo/utils/Utils.kt
create mode 100644 app/src/main/kotlin/cn/super12138/todo/views/welcome/WelcomeActivity.kt
create mode 100644 app/src/main/kotlin/cn/super12138/todo/views/welcome/WelcomeViewModel.kt
create mode 100644 app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/BasePage.kt
create mode 100644 app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/IntroPage.kt
create mode 100644 app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/ProgressPage.kt
create mode 100644 app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/ToDoBtnPage.kt
create mode 100644 app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/ToDoItemPage.kt
create mode 100644 app/src/main/res/drawable/ic_arrow_forward.xml
create mode 100644 app/src/main/res/drawable/ic_focus.xml
create mode 100644 app/src/main/res/drawable/ic_next.xml
create mode 100644 app/src/main/res/drawable/ic_previous.xml
create mode 100644 app/src/main/res/layout/activity_welcome.xml
create mode 100644 app/src/main/res/layout/fragment_welcome_intro.xml
create mode 100644 app/src/main/res/layout/fragment_welcome_progress.xml
create mode 100644 app/src/main/res/layout/fragment_welcome_todo_btn.xml
create mode 100644 app/src/main/res/layout/fragment_welcome_todo_item.xml
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f7a8c8f..29798af 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -45,6 +45,11 @@
android:exported="false"
android:label="@string/about_label"
android:launchMode="singleTask" />
+
diff --git a/app/src/main/kotlin/cn/super12138/todo/ToDoApp.kt b/app/src/main/kotlin/cn/super12138/todo/ToDoApp.kt
index ab3db95..efe710d 100644
--- a/app/src/main/kotlin/cn/super12138/todo/ToDoApp.kt
+++ b/app/src/main/kotlin/cn/super12138/todo/ToDoApp.kt
@@ -3,8 +3,11 @@ package cn.super12138.todo
import android.annotation.SuppressLint
import android.app.Application
import android.content.Context
+import android.content.Intent
+import cn.super12138.todo.constant.GlobalValues
import cn.super12138.todo.logic.dao.ToDoRoomDB
import cn.super12138.todo.views.crash.CrashHandler
+import cn.super12138.todo.views.welcome.WelcomeActivity
import com.google.android.material.color.DynamicColors
class ToDoApp : Application() {
@@ -25,5 +28,12 @@ class ToDoApp : Application() {
Thread.setDefaultUncaughtExceptionHandler(crashHandler)
db = database
+
+ if (!GlobalValues.welcomePage) {
+ val intent = Intent(this, WelcomeActivity::class.java).apply {
+ flags = Intent.FLAG_ACTIVITY_NEW_TASK
+ }
+ startActivity(intent)
+ }
}
}
\ No newline at end of file
diff --git a/app/src/main/kotlin/cn/super12138/todo/constant/Constants.kt b/app/src/main/kotlin/cn/super12138/todo/constant/Constants.kt
index 80969cc..8a54be8 100644
--- a/app/src/main/kotlin/cn/super12138/todo/constant/Constants.kt
+++ b/app/src/main/kotlin/cn/super12138/todo/constant/Constants.kt
@@ -1,6 +1,8 @@
package cn.super12138.todo.constant
object Constants {
+ const val WELCOME_PAGE= "welcome_page"
+
const val AUTHOR_GITHUB_URL = "https://github.com/Super12138/"
const val REPO_GITHUB_URL = "https://github.com/Super12138/ToDo"
const val UPDATE_URL = "https://github.com/Super12138/ToDo/releases"
@@ -11,12 +13,14 @@ object Constants {
const val PREF_SECURE_MODE = "secure_mode"
const val PREF_HAPTIC_FEEDBACK = "haptic_feedback"
const val PREF_ALL_TASKS = "all_tasks"
+ const val PREF_REENTER_WELCOME_ACTIVITY = "reenter_welcome_activity"
const val PREF_ABOUT = "about"
const val PREF_DEV_MODE = "dev_mode"
- const val PREF_SPRING_FESTIVAL_THEME = "spring_festival_theme"
+ // const val PREF_SPRING_FESTIVAL_THEME = "spring_festival_theme"
const val PREF_BACKUP_DB = "backup_db"
const val PREF_RESTORE_DB = "restore_db"
+
const val STRING_DEV_MODE = "/DEV_MODE"
const val TAG_INFO_BOTTOM_SHEET = "InfoBottomSheet"
diff --git a/app/src/main/kotlin/cn/super12138/todo/constant/GlobalValues.kt b/app/src/main/kotlin/cn/super12138/todo/constant/GlobalValues.kt
index bfcb475..430ed93 100644
--- a/app/src/main/kotlin/cn/super12138/todo/constant/GlobalValues.kt
+++ b/app/src/main/kotlin/cn/super12138/todo/constant/GlobalValues.kt
@@ -3,9 +3,10 @@ package cn.super12138.todo.constant
import cn.super12138.todo.utils.sp.SPDelegates
object GlobalValues {
+ var welcomePage: Boolean by SPDelegates(Constants.WELCOME_PAGE, false)
var darkMode: String by SPDelegates(Constants.PREF_DARK_MODE, "0")
var devMode: Boolean by SPDelegates(Constants.PREF_DEV_MODE, false)
- var springFestivalTheme: Boolean by SPDelegates(Constants.PREF_SPRING_FESTIVAL_THEME, false)
+ // var springFestivalTheme: Boolean by SPDelegates(Constants.PREF_SPRING_FESTIVAL_THEME, false)
var secureMode: Boolean by SPDelegates(Constants.PREF_SECURE_MODE, false)
var hapticFeedback: Boolean by SPDelegates(Constants.PREF_HAPTIC_FEEDBACK, true)
}
\ No newline at end of file
diff --git a/app/src/main/kotlin/cn/super12138/todo/utils/Toast.kt b/app/src/main/kotlin/cn/super12138/todo/utils/Toast.kt
deleted file mode 100644
index 9a7fd0e..0000000
--- a/app/src/main/kotlin/cn/super12138/todo/utils/Toast.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-package cn.super12138.todo.utils
-
-import android.content.Context
-import android.widget.Toast
-import cn.super12138.todo.ToDoApp
-
-fun String.showToast(
- context: Context = ToDoApp.context,
- duration: Int = Toast.LENGTH_SHORT
-) {
- Toast.makeText(context, this, duration).show()
-}
-
-fun Int.showToast(context: Context = ToDoApp.context, duration: Int = Toast.LENGTH_SHORT) {
- Toast.makeText(context, this, duration).show()
-}
\ No newline at end of file
diff --git a/app/src/main/kotlin/cn/super12138/todo/utils/Utils.kt b/app/src/main/kotlin/cn/super12138/todo/utils/Utils.kt
new file mode 100644
index 0000000..039a134
--- /dev/null
+++ b/app/src/main/kotlin/cn/super12138/todo/utils/Utils.kt
@@ -0,0 +1,36 @@
+package cn.super12138.todo.utils
+
+import android.content.Context
+import android.os.SystemClock
+import android.view.View
+import android.widget.Toast
+import cn.super12138.todo.ToDoApp
+
+private var clickInterval = 400L
+private var lastTime = 0L
+
+/**
+ * 延迟点击
+ */
+fun View.setOnIntervalClickListener(onIntervalClickListener: (View) -> Unit) {
+ this.setOnClickListener {
+ if (SystemClock.elapsedRealtime() - lastTime > clickInterval) {
+ lastTime = SystemClock.elapsedRealtime()
+ onIntervalClickListener.invoke(it)
+ }
+ }
+}
+
+/**
+ * Toast
+ */
+fun String.showToast(
+ context: Context = ToDoApp.context,
+ duration: Int = Toast.LENGTH_SHORT
+) {
+ Toast.makeText(context, this, duration).show()
+}
+
+fun Int.showToast(context: Context = ToDoApp.context, duration: Int = Toast.LENGTH_SHORT) {
+ Toast.makeText(context, this, duration).show()
+}
\ No newline at end of file
diff --git a/app/src/main/kotlin/cn/super12138/todo/views/all/AllTasksActivity.kt b/app/src/main/kotlin/cn/super12138/todo/views/all/AllTasksActivity.kt
index 9d68e10..2502baa 100644
--- a/app/src/main/kotlin/cn/super12138/todo/views/all/AllTasksActivity.kt
+++ b/app/src/main/kotlin/cn/super12138/todo/views/all/AllTasksActivity.kt
@@ -1,7 +1,6 @@
package cn.super12138.todo.views.all
import android.os.Bundle
-import android.view.View
import android.view.WindowManager
import androidx.activity.viewModels
import androidx.lifecycle.Observer
diff --git a/app/src/main/kotlin/cn/super12138/todo/views/main/MainActivity.kt b/app/src/main/kotlin/cn/super12138/todo/views/main/MainActivity.kt
index 0ca19e4..8c941fb 100644
--- a/app/src/main/kotlin/cn/super12138/todo/views/main/MainActivity.kt
+++ b/app/src/main/kotlin/cn/super12138/todo/views/main/MainActivity.kt
@@ -4,16 +4,19 @@ import android.content.Intent
import android.os.Bundle
import android.view.WindowManager
import cn.super12138.todo.R
-import cn.super12138.todo.ToDoApp
import cn.super12138.todo.constant.GlobalValues
import cn.super12138.todo.databinding.ActivityMainBinding
import cn.super12138.todo.utils.VibrationUtils
import cn.super12138.todo.views.BaseActivity
import cn.super12138.todo.views.settings.SettingsActivity
+import cn.super12138.todo.views.welcome.WelcomeActivity
class MainActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
+
+ if(!GlobalValues.welcomePage) finish()
+
binding.toolBar.setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) {
R.id.item_settings -> {
@@ -38,6 +41,10 @@ class MainActivity : BaseActivity() {
false -> window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
}
+ if (!GlobalValues.welcomePage) {
+ val intent = Intent(this, WelcomeActivity::class.java)
+ startActivity(intent)
+ }
}
override fun getViewBinding(): ActivityMainBinding {
diff --git a/app/src/main/kotlin/cn/super12138/todo/views/progress/ProgressFragment.kt b/app/src/main/kotlin/cn/super12138/todo/views/progress/ProgressFragment.kt
index 09879e3..aede463 100644
--- a/app/src/main/kotlin/cn/super12138/todo/views/progress/ProgressFragment.kt
+++ b/app/src/main/kotlin/cn/super12138/todo/views/progress/ProgressFragment.kt
@@ -27,7 +27,6 @@ class ProgressFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
-
viewModel.progress.observe(viewLifecycleOwner, Observer { value ->
binding.progressBar.setProgressCompat(value, true)
})
diff --git a/app/src/main/kotlin/cn/super12138/todo/views/settings/SettingsFragment.kt b/app/src/main/kotlin/cn/super12138/todo/views/settings/SettingsFragment.kt
index e6e519b..2a91211 100644
--- a/app/src/main/kotlin/cn/super12138/todo/views/settings/SettingsFragment.kt
+++ b/app/src/main/kotlin/cn/super12138/todo/views/settings/SettingsFragment.kt
@@ -6,7 +6,6 @@ import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable
import android.os.Bundle
-import android.view.HapticFeedbackConstants
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatDelegate
import androidx.lifecycle.lifecycleScope
@@ -25,6 +24,7 @@ import cn.super12138.todo.utils.VibrationUtils
import cn.super12138.todo.views.about.AboutActivity
import cn.super12138.todo.views.all.AllTasksActivity
import cn.super12138.todo.views.main.MainActivity
+import cn.super12138.todo.views.welcome.WelcomeActivity
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar
import com.google.gson.Gson
@@ -177,7 +177,6 @@ class SettingsFragment : PreferenceFragmentCompat() {
setOnPreferenceClickListener {
startActivity(Intent(context, AllTasksActivity::class.java))
VibrationUtils.performHapticFeedback(view)
-
true
}
}
@@ -186,7 +185,17 @@ class SettingsFragment : PreferenceFragmentCompat() {
setOnPreferenceClickListener {
startActivity(Intent(context, AboutActivity::class.java))
VibrationUtils.performHapticFeedback(view)
+ true
+ }
+ }
+ findPreference(Constants.PREF_REENTER_WELCOME_ACTIVITY)?.apply {
+ setOnPreferenceClickListener {
+ val intent = Intent(context, WelcomeActivity::class.java).apply {
+ flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
+ }
+ startActivity(intent)
+ VibrationUtils.performHapticFeedback(view)
true
}
}
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 3971210..cbd2bf2 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
@@ -18,7 +18,6 @@ import cn.super12138.todo.ToDoApp
import cn.super12138.todo.databinding.FragmentTodoBinding
import cn.super12138.todo.logic.Repository
import cn.super12138.todo.utils.VibrationUtils
-import cn.super12138.todo.utils.showToast
import cn.super12138.todo.views.bottomsheet.ToDoBottomSheet
import cn.super12138.todo.views.progress.ProgressViewModel
import com.google.android.material.dialog.MaterialAlertDialogBuilder
diff --git a/app/src/main/kotlin/cn/super12138/todo/views/welcome/WelcomeActivity.kt b/app/src/main/kotlin/cn/super12138/todo/views/welcome/WelcomeActivity.kt
new file mode 100644
index 0000000..69b51c8
--- /dev/null
+++ b/app/src/main/kotlin/cn/super12138/todo/views/welcome/WelcomeActivity.kt
@@ -0,0 +1,140 @@
+package cn.super12138.todo.views.welcome
+
+import android.annotation.SuppressLint
+import android.content.Intent
+import android.os.Bundle
+import android.view.MotionEvent
+import android.view.View
+import androidx.activity.OnBackPressedCallback
+import androidx.activity.viewModels
+import androidx.appcompat.content.res.AppCompatResources
+import androidx.fragment.app.Fragment
+import androidx.fragment.app.commit
+import androidx.lifecycle.Observer
+import cn.super12138.todo.R
+import cn.super12138.todo.constant.GlobalValues
+import cn.super12138.todo.databinding.ActivityWelcomeBinding
+import cn.super12138.todo.utils.VibrationUtils
+import cn.super12138.todo.utils.setOnIntervalClickListener
+import cn.super12138.todo.views.BaseActivity
+import cn.super12138.todo.views.main.MainActivity
+import cn.super12138.todo.views.welcome.pages.IntroPage
+import cn.super12138.todo.views.welcome.pages.ProgressPage
+import cn.super12138.todo.views.welcome.pages.ToDoBtnPage
+import cn.super12138.todo.views.welcome.pages.ToDoItemPage
+
+class WelcomeActivity : BaseActivity() {
+ private val viewModel by viewModels()
+ @SuppressLint("ClickableViewAccessibility")
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ val previousBtn = binding.previousBtn
+ val nextBtn = binding.nextBtn
+ val centerBtn = binding.centerBtn
+
+ val currentPage = viewModel.currentPage // 0: Intro 1: Progress 2: ToDo Btn 3: ToDo Item
+
+ centerBtn.setOnIntervalClickListener {
+ VibrationUtils.performHapticFeedback(it)
+
+ centerBtn.hide()
+ nextBtn.show()
+ previousBtn.show()
+
+
+ if (currentPage.value == 3) {
+ GlobalValues.welcomePage = true
+ finish()
+ val intent = Intent(this, MainActivity::class.java)
+ startActivity(intent)
+ } else {
+ currentPage.value = 1
+ }
+ }
+
+ previousBtn.setOnIntervalClickListener {
+ VibrationUtils.performHapticFeedback(it)
+
+ currentPage.value = currentPage.value?.minus(1)
+ }
+
+ nextBtn.setOnIntervalClickListener {
+ VibrationUtils.performHapticFeedback(it)
+
+ currentPage.value = currentPage.value?.plus(1)
+ }
+
+ currentPage.observe(this, Observer { page ->
+ supportFragmentManager.commit {
+ addToBackStack(System.currentTimeMillis().toString())
+ hide(supportFragmentManager.fragments.last())
+ add(R.id.welcome_page_container, getCurrentPage(page))
+ }
+
+ when (page) {
+ 0 -> {
+ centerBtn.apply {
+ text = getString(R.string.start)
+ icon = AppCompatResources.getDrawable(
+ this@WelcomeActivity,
+ R.drawable.ic_arrow_forward
+ )
+ show()
+ }
+ nextBtn.hide()
+ previousBtn.hide()
+ }
+
+ in 1..2 -> {
+ centerBtn.hide()
+ previousBtn.show()
+ nextBtn.show()
+ }
+
+ 3 -> {
+ centerBtn.apply {
+ text = getString(R.string.enter_app)
+ icon = AppCompatResources.getDrawable(
+ this@WelcomeActivity,
+ R.drawable.ic_focus
+ )
+ show()
+ }
+ previousBtn.show()
+ nextBtn.hide()
+ }
+
+ else -> {
+ if (page > 3) currentPage.value = 3
+
+ if (page < 0) currentPage.value = 0
+ }
+ }
+ })
+
+ onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
+ override fun handleOnBackPressed() {
+ if (currentPage.value == 0) {
+ finish()
+ } else {
+ currentPage.value = currentPage.value?.minus(1)
+ }
+ }
+ })
+ }
+
+ override fun getViewBinding(): ActivityWelcomeBinding {
+ return ActivityWelcomeBinding.inflate(layoutInflater)
+ }
+
+ private fun getCurrentPage(pageIndex: Int): Fragment {
+ return when (pageIndex) {
+ 0 -> IntroPage()
+ 1 -> ProgressPage()
+ 2 -> ToDoBtnPage()
+ 3 -> ToDoItemPage()
+ else -> IntroPage()
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/kotlin/cn/super12138/todo/views/welcome/WelcomeViewModel.kt b/app/src/main/kotlin/cn/super12138/todo/views/welcome/WelcomeViewModel.kt
new file mode 100644
index 0000000..5d3f1d9
--- /dev/null
+++ b/app/src/main/kotlin/cn/super12138/todo/views/welcome/WelcomeViewModel.kt
@@ -0,0 +1,8 @@
+package cn.super12138.todo.views.welcome
+
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.ViewModel
+
+class WelcomeViewModel : ViewModel() {
+ val currentPage = MutableLiveData(0)
+}
\ No newline at end of file
diff --git a/app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/BasePage.kt b/app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/BasePage.kt
new file mode 100644
index 0000000..449636e
--- /dev/null
+++ b/app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/BasePage.kt
@@ -0,0 +1,15 @@
+package cn.super12138.todo.views.welcome.pages
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import com.google.android.material.transition.MaterialSharedAxis
+
+open class BasePage : Fragment() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ enterTransition = MaterialSharedAxis(MaterialSharedAxis.X, /* forward= */ true)
+ returnTransition = MaterialSharedAxis(MaterialSharedAxis.X, /* forward= */ false)
+ exitTransition = MaterialSharedAxis(MaterialSharedAxis.X, /* forward= */ true)
+ reenterTransition = MaterialSharedAxis(MaterialSharedAxis.X, /* forward= */ false)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/IntroPage.kt b/app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/IntroPage.kt
new file mode 100644
index 0000000..9d46cdf
--- /dev/null
+++ b/app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/IntroPage.kt
@@ -0,0 +1,21 @@
+package cn.super12138.todo.views.welcome.pages
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import cn.super12138.todo.databinding.FragmentWelcomeIntroBinding
+
+class IntroPage : BasePage() {
+ private lateinit var binding: FragmentWelcomeIntroBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater,
+ container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ binding = FragmentWelcomeIntroBinding.inflate(inflater, container, false)
+
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/ProgressPage.kt b/app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/ProgressPage.kt
new file mode 100644
index 0000000..a8be0a8
--- /dev/null
+++ b/app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/ProgressPage.kt
@@ -0,0 +1,21 @@
+package cn.super12138.todo.views.welcome.pages
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import cn.super12138.todo.databinding.FragmentWelcomeProgressBinding
+
+class ProgressPage : BasePage() {
+ private lateinit var binding: FragmentWelcomeProgressBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater,
+ container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ binding = FragmentWelcomeProgressBinding.inflate(inflater, container, false)
+
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/ToDoBtnPage.kt b/app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/ToDoBtnPage.kt
new file mode 100644
index 0000000..fa6ad2a
--- /dev/null
+++ b/app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/ToDoBtnPage.kt
@@ -0,0 +1,35 @@
+package cn.super12138.todo.views.welcome.pages
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import cn.super12138.todo.databinding.FragmentWelcomeTodoBtnBinding
+import cn.super12138.todo.utils.VibrationUtils
+
+class ToDoBtnPage : BasePage() {
+ private lateinit var binding: FragmentWelcomeTodoBtnBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater,
+ container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ binding = FragmentWelcomeTodoBtnBinding.inflate(inflater, container, false)
+
+ return binding.root
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+
+ binding.addItem.setOnClickListener {
+ VibrationUtils.performHapticFeedback(it)
+ }
+
+ binding.addItem.setOnLongClickListener {
+ true
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/ToDoItemPage.kt b/app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/ToDoItemPage.kt
new file mode 100644
index 0000000..5bead18
--- /dev/null
+++ b/app/src/main/kotlin/cn/super12138/todo/views/welcome/pages/ToDoItemPage.kt
@@ -0,0 +1,32 @@
+package cn.super12138.todo.views.welcome.pages
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import cn.super12138.todo.databinding.FragmentWelcomeTodoItemBinding
+import cn.super12138.todo.utils.VibrationUtils
+
+class ToDoItemPage : BasePage() {
+ private lateinit var binding: FragmentWelcomeTodoItemBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater,
+ container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+ binding = FragmentWelcomeTodoItemBinding.inflate(inflater, container, false)
+
+ return binding.root
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ binding.checkItemBtn.setOnClickListener {
+ VibrationUtils.performHapticFeedback(it)
+ }
+ binding.todoItem.setOnLongClickListener {
+ true
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/bg_item_complete.xml b/app/src/main/res/drawable/bg_item_complete.xml
index 37a9aeb..fc21ed9 100644
--- a/app/src/main/res/drawable/bg_item_complete.xml
+++ b/app/src/main/res/drawable/bg_item_complete.xml
@@ -1,5 +1,4 @@
-
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_arrow_forward.xml b/app/src/main/res/drawable/ic_arrow_forward.xml
new file mode 100644
index 0000000..9e27d98
--- /dev/null
+++ b/app/src/main/res/drawable/ic_arrow_forward.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_focus.xml b/app/src/main/res/drawable/ic_focus.xml
new file mode 100644
index 0000000..39fe24b
--- /dev/null
+++ b/app/src/main/res/drawable/ic_focus.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_next.xml b/app/src/main/res/drawable/ic_next.xml
new file mode 100644
index 0000000..0f71f1d
--- /dev/null
+++ b/app/src/main/res/drawable/ic_next.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_previous.xml b/app/src/main/res/drawable/ic_previous.xml
new file mode 100644
index 0000000..2e0b029
--- /dev/null
+++ b/app/src/main/res/drawable/ic_previous.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_welcome.xml b/app/src/main/res/layout/activity_welcome.xml
new file mode 100644
index 0000000..0dcb47a
--- /dev/null
+++ b/app/src/main/res/layout/activity_welcome.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/bottom_sheet_todo.xml b/app/src/main/res/layout/bottom_sheet_todo.xml
index f249a23..66a85ef 100644
--- a/app/src/main/res/layout/bottom_sheet_todo.xml
+++ b/app/src/main/res/layout/bottom_sheet_todo.xml
@@ -1,7 +1,6 @@
@@ -18,9 +17,9 @@
+ android:paddingRight="20dp">
+ android:visibility="gone" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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
new file mode 100644
index 0000000..de431a2
--- /dev/null
+++ b/app/src/main/res/layout/fragment_welcome_progress.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_welcome_todo_btn.xml b/app/src/main/res/layout/fragment_welcome_todo_btn.xml
new file mode 100644
index 0000000..633b222
--- /dev/null
+++ b/app/src/main/res/layout/fragment_welcome_todo_btn.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_welcome_todo_item.xml b/app/src/main/res/layout/fragment_welcome_todo_item.xml
new file mode 100644
index 0000000..0a50b15
--- /dev/null
+++ b/app/src/main/res/layout/fragment_welcome_todo_item.xml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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 4712af9..2b594b5 100644
--- a/app/src/main/res/layout/item_empty.xml
+++ b/app/src/main/res/layout/item_empty.xml
@@ -1,6 +1,5 @@
-
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index b4b2001..2fe0693 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -73,4 +73,21 @@
更新
触感反馈
部分点按操作会有轻微震动
+ 上一页
+ 下一页
+ 开始
+ 欢迎
+ 欢迎使用待办
+ 一个轻量且易用的待办应用
+ 立即进入
+ 再次进入欢迎页面
+ 定睛看
+ 这是待办进度条,它会提示你任务完成进度。当你添加待办或把待办标记成已完成时,它都会更新。左边的数字是你完成的任务数,右边的数字是全部的任务数;它也会在它们下面显示一行小字来提示你剩余任务数。
+ 掌控尽在指尖
+ 这是添加待办的按钮,点击它你就可以添加一个新的待办事项了。长按它你就可以删除你目前所有的待办(这不能恢复,谨慎点击哦!)。
+ 长按一下,功能多多
+ 这是待办内容
+ 这是待办学科
+ 这是待办列表的项目。点击右边的 √ 就可以把这个待办标记为已完成。如果你需要修改这个待办,只需长按即可修改。
+ 以上就是待办的主要功能。当然,待办应用还有丰富的个性化选项和功能供你使用,立即点击下方按钮来进入应用吧!
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 2d9cb61..eae2cba 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -73,4 +73,21 @@
Update
Haptic feedback
Some tap operations will cause a slight vibration
+ Previous page
+ Next page
+ Start
+ Welcome
+ Welcome to use To Do
+ A lite and useful to-do app
+ Enter at once
+ Reenter welcome page
+ Take a look!
+ 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.
+ Control is at your fingertips!
+ 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!).
+ Long press for more options!
+ This is the task content
+ This is the task subject
+ "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. "
+ 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!
\ No newline at end of file
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
index 84314e4..8e645de 100644
--- a/app/src/main/res/xml/preferences.xml
+++ b/app/src/main/res/xml/preferences.xml
@@ -50,6 +50,12 @@
app:key="all_tasks"
app:summary="@string/view_all_tasks_summary"
app:title="@string/view_all_tasks_label" />
+
+
+