Add welcome page
This commit is contained in:
parent
231e6871d0
commit
7b05b2e754
34 changed files with 718 additions and 33 deletions
|
|
@ -45,6 +45,11 @@
|
|||
android:exported="false"
|
||||
android:label="@string/about_label"
|
||||
android:launchMode="singleTask" />
|
||||
<activity
|
||||
android:name=".views.welcome.WelcomeActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/welcome_label"
|
||||
android:launchMode="singleTask" />
|
||||
<activity
|
||||
android:name=".views.crash.CrashActivity"
|
||||
android:exported="false" />
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
@ -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()
|
||||
}
|
||||
36
app/src/main/kotlin/cn/super12138/todo/utils/Utils.kt
Normal file
36
app/src/main/kotlin/cn/super12138/todo/utils/Utils.kt
Normal file
|
|
@ -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()
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<ActivityMainBinding>() {
|
||||
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<ActivityMainBinding>() {
|
|||
|
||||
false -> window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||
}
|
||||
if (!GlobalValues.welcomePage) {
|
||||
val intent = Intent(this, WelcomeActivity::class.java)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getViewBinding(): ActivityMainBinding {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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<Preference>(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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<ActivityWelcomeBinding>() {
|
||||
private val viewModel by viewModels<WelcomeViewModel>()
|
||||
@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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package cn.super12138.todo.views.welcome
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
|
||||
class WelcomeViewModel : ViewModel() {
|
||||
val currentPage = MutableLiveData<Int>(0)
|
||||
}
|
||||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid
|
||||
android:color="@color/item_complete_color" />
|
||||
<solid android:color="@color/item_complete_color" />
|
||||
</shape>
|
||||
13
app/src/main/res/drawable/ic_arrow_forward.xml
Normal file
13
app/src/main/res/drawable/ic_arrow_forward.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:autoMirrored="true"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,4l-1.41,1.41L16.17,11H4v2h12.17l-5.58,5.59L12,20l8,-8z" />
|
||||
|
||||
</vector>
|
||||
12
app/src/main/res/drawable/ic_focus.xml
Normal file
12
app/src/main/res/drawable/ic_focus.xml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="#FFFFFF"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M5,15L3,15v4c0,1.1 0.9,2 2,2h4v-2L5,19v-4zM5,5h4L9,3L5,3c-1.1,0 -2,0.9 -2,2v4h2L5,5zM19,3h-4v2h4v4h2L21,5c0,-1.1 -0.9,-2 -2,-2zM19,19h-4v2h4c1.1,0 2,-0.9 2,-2v-4h-2v4zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z" />
|
||||
|
||||
</vector>
|
||||
13
app/src/main/res/drawable/ic_next.xml
Normal file
13
app/src/main/res/drawable/ic_next.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:autoMirrored="true"
|
||||
android:tint="#FFFFFF"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M10.02,6L8.61,7.41 13.19,12l-4.58,4.59L10.02,18l6,-6 -6,-6z" />
|
||||
|
||||
</vector>
|
||||
13
app/src/main/res/drawable/ic_previous.xml
Normal file
13
app/src/main/res/drawable/ic_previous.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:autoMirrored="true"
|
||||
android:tint="#FFFFFF"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M15.61,7.41L14.2,6l-6,6 6,6 1.41,-1.41L11.03,12l4.58,-4.59z" />
|
||||
|
||||
</vector>
|
||||
58
app/src/main/res/layout/activity_welcome.xml
Normal file
58
app/src/main/res/layout/activity_welcome.xml
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/welcome_page_container"
|
||||
android:name="cn.super12138.todo.views.welcome.pages.IntroPage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/control_area"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:layout="@layout/fragment_welcome_intro" />
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:id="@+id/control_area"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/welcome_page_container">
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/previous_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|start"
|
||||
android:layout_margin="16dp"
|
||||
android:contentDescription="@string/previous_page"
|
||||
android:visibility="invisible"
|
||||
app:srcCompat="@drawable/ic_previous" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/center_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center"
|
||||
android:layout_margin="16dp"
|
||||
android:text="@string/start"
|
||||
app:icon="@drawable/ic_arrow_forward" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/next_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="16dp"
|
||||
android:contentDescription="@string/next_page"
|
||||
android:visibility="invisible"
|
||||
app:srcCompat="@drawable/ic_next" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
|
@ -18,9 +17,9 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:orientation="vertical">
|
||||
android:paddingRight="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/todo_sheet_title"
|
||||
|
|
@ -140,7 +139,7 @@
|
|||
android:layout_marginTop="8dp"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="15sp"
|
||||
android:visibility="gone"/>
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||
android:layout_height="280dp"
|
||||
android:animateLayoutChanges="true">
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
|
|
|
|||
46
app/src/main/res/layout/fragment_welcome_intro.xml
Normal file
46
app/src/main/res/layout/fragment_welcome_intro.xml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="@style/Widget.Material3.CardView.Elevated"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="128dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/app_name"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<TextView
|
||||
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
|
||||
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>
|
||||
37
app/src/main/res/layout/fragment_welcome_progress.xml
Normal file
37
app/src/main/res/layout/fragment_welcome_progress.xml
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="100dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<TextView
|
||||
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
|
||||
android:id="@+id/welcome_progress"
|
||||
android:name="cn.super12138.todo.views.progress.ProgressFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:layout="@layout/fragment_progress" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/progress_description"
|
||||
android:textAlignment="center"
|
||||
android:textColor="?attr/colorOnSurfaceVariant" />
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
40
app/src/main/res/layout/fragment_welcome_todo_btn.xml
Normal file
40
app/src/main/res/layout/fragment_welcome_todo_btn.xml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="100dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<TextView
|
||||
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
|
||||
android:id="@+id/add_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:contentDescription="@string/add_task"
|
||||
android:text="@string/add_task"
|
||||
app:icon="@drawable/ic_add" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/todo_btn_description"
|
||||
android:textAlignment="center"
|
||||
android:textColor="?attr/colorOnSurfaceVariant" />
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
91
app/src/main/res/layout/fragment_welcome_todo_item.xml
Normal file
91
app/src/main/res/layout/fragment_welcome_todo_item.xml
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="100dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<TextView
|
||||
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
|
||||
android:id="@+id/todo_item"
|
||||
style="?attr/materialCardViewElevatedStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/todo_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:text="@string/todo_item_item_title"
|
||||
android:textColor="?attr/colorOnSurface"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/todo_subject"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dp"
|
||||
android:text="@string/todo_item_item_subject"
|
||||
android:textColor="?attr/colorOnSurface"
|
||||
android:textSize="11sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/check_item_btn"
|
||||
style="?attr/materialIconButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:tooltipText="@string/check_one"
|
||||
app:icon="@drawable/ic_check" />
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<TextView
|
||||
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>
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
|
|
|||
|
|
@ -73,4 +73,21 @@
|
|||
<string name="update">更新</string>
|
||||
<string name="haptic_feedback">触感反馈</string>
|
||||
<string name="haptic_feedback_summary">部分点按操作会有轻微震动</string>
|
||||
<string name="previous_page">上一页</string>
|
||||
<string name="next_page">下一页</string>
|
||||
<string name="start">开始</string>
|
||||
<string name="welcome_label">欢迎</string>
|
||||
<string name="intro_title">欢迎使用待办</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="todo_btn_title">掌控尽在指尖</string>
|
||||
<string name="todo_btn_description">这是添加待办的按钮,点击它你就可以添加一个新的待办事项了。长按它你就可以删除你目前所有的待办(这不能恢复,谨慎点击哦!)。</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>
|
||||
</resources>
|
||||
|
|
@ -73,4 +73,21 @@
|
|||
<string name="update">Update</string>
|
||||
<string name="haptic_feedback">Haptic feedback</string>
|
||||
<string name="haptic_feedback_summary">Some tap operations will cause a slight vibration</string>
|
||||
<string name="previous_page">Previous page</string>
|
||||
<string name="next_page">Next page</string>
|
||||
<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="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="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_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>
|
||||
|
|
@ -50,6 +50,12 @@
|
|||
app:key="all_tasks"
|
||||
app:summary="@string/view_all_tasks_summary"
|
||||
app:title="@string/view_all_tasks_label" />
|
||||
|
||||
<Preference
|
||||
app:icon="@drawable/ic_arrow_forward"
|
||||
app:key="reenter_welcome_activity"
|
||||
app:title="@string/reenter_welcome_activity" />
|
||||
|
||||
<Preference
|
||||
app:icon="@drawable/ic_about"
|
||||
app:key="about"
|
||||
|
|
|
|||
Loading…
Reference in a new issue