diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a10005d..4579ead 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -38,8 +38,8 @@ android { applicationId = "cn.super12138.todo" minSdk = 24 targetSdk = 36 - versionCode = 998 - versionName = "3.0.0" + versionCode = 999 + versionName = "3.0.1" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/kotlin/cn/super12138/todo/ui/activities/MainActivity.kt b/app/src/main/kotlin/cn/super12138/todo/ui/activities/MainActivity.kt index 6b60c67..5f0ae04 100644 --- a/app/src/main/kotlin/cn/super12138/todo/ui/activities/MainActivity.kt +++ b/app/src/main/kotlin/cn/super12138/todo/ui/activities/MainActivity.kt @@ -29,8 +29,8 @@ import cn.super12138.todo.logic.model.DarkMode import cn.super12138.todo.logic.model.PaletteStyle import cn.super12138.todo.ui.VerveDoDefaults import cn.super12138.todo.ui.components.Konfetti -import cn.super12138.todo.ui.navigation.VerveDoDestinations import cn.super12138.todo.ui.navigation.TopNavigation +import cn.super12138.todo.ui.navigation.VerveDoDestinations import cn.super12138.todo.ui.theme.VerveDoTheme import cn.super12138.todo.ui.viewmodels.MainViewModel import cn.super12138.todo.utils.VibrationUtils diff --git a/app/src/main/kotlin/cn/super12138/todo/ui/components/Konfetti.kt b/app/src/main/kotlin/cn/super12138/todo/ui/components/Konfetti.kt index 0aa33fa..103b31e 100644 --- a/app/src/main/kotlin/cn/super12138/todo/ui/components/Konfetti.kt +++ b/app/src/main/kotlin/cn/super12138/todo/ui/components/Konfetti.kt @@ -1,6 +1,5 @@ package cn.super12138.todo.ui.components -import androidx.annotation.FloatRange import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState @@ -10,7 +9,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.toArgb -import androidx.core.graphics.ColorUtils +import cn.super12138.todo.utils.blend import nl.dionsegijn.konfetti.compose.KonfettiView import nl.dionsegijn.konfetti.compose.OnParticleSystemUpdateListener import nl.dionsegijn.konfetti.core.Angle @@ -98,8 +97,3 @@ private fun particles(primary: Int) = listOf( position = Position.Relative(1.0, 1.0) ) ) - -fun Int.blend( - color: Int, - @FloatRange(from = 0.0, to = 1.0) fraction: Float = 0.5f, -): Int = ColorUtils.blendARGB(this, color, fraction) diff --git a/app/src/main/kotlin/cn/super12138/todo/ui/pages/overview/components/StatusCard.kt b/app/src/main/kotlin/cn/super12138/todo/ui/pages/overview/components/StatusCard.kt index b720ebb..f6239f2 100644 --- a/app/src/main/kotlin/cn/super12138/todo/ui/pages/overview/components/StatusCard.kt +++ b/app/src/main/kotlin/cn/super12138/todo/ui/pages/overview/components/StatusCard.kt @@ -47,7 +47,8 @@ fun RoundedCornerCardLarge( ) { val interactionSource = remember { MutableInteractionSource() } val pressed by interactionSource.collectIsPressedAsState() - val animatedShape = shapeByInteraction(shapes, pressed, VerveDoDefaults.shapesDefaultAnimationSpec) + val animatedShape = + shapeByInteraction(shapes, pressed, VerveDoDefaults.shapesDefaultAnimationSpec) val cardColors = CardDefaults.cardColors(containerColor = containerColor) Card( diff --git a/app/src/main/kotlin/cn/super12138/todo/ui/pages/settings/components/SettingsItem.kt b/app/src/main/kotlin/cn/super12138/todo/ui/pages/settings/components/SettingsItem.kt index f4938ed..3b822f2 100644 --- a/app/src/main/kotlin/cn/super12138/todo/ui/pages/settings/components/SettingsItem.kt +++ b/app/src/main/kotlin/cn/super12138/todo/ui/pages/settings/components/SettingsItem.kt @@ -32,6 +32,8 @@ import cn.super12138.todo.ui.VerveDoDefaults import cn.super12138.todo.ui.theme.shapeByInteraction import cn.super12138.todo.utils.VibrationUtils +//TODO: MaterialTheme.colorscheme.surfaceContainer.blend(Color.Red, 0.7) 作为新的leading图标后背景色 + // Leading icon as drawable resource @OptIn(ExperimentalMaterial3ExpressiveApi::class) @Composable @@ -213,7 +215,8 @@ fun SettingsItem( val view = LocalView.current val userInteractionSource = interactionSource ?: remember { MutableInteractionSource() } val pressed by userInteractionSource.collectIsPressedAsState() - val animatedShape = shapeByInteraction(shapes, pressed, VerveDoDefaults.shapesDefaultAnimationSpec) + val animatedShape = + shapeByInteraction(shapes, pressed, VerveDoDefaults.shapesDefaultAnimationSpec) Row( modifier = modifier diff --git a/app/src/main/kotlin/cn/super12138/todo/ui/pages/settings/components/appearance/darkmode/DarkModeItem.kt b/app/src/main/kotlin/cn/super12138/todo/ui/pages/settings/components/appearance/darkmode/DarkModeItem.kt index ca170ce..4e35a7c 100644 --- a/app/src/main/kotlin/cn/super12138/todo/ui/pages/settings/components/appearance/darkmode/DarkModeItem.kt +++ b/app/src/main/kotlin/cn/super12138/todo/ui/pages/settings/components/appearance/darkmode/DarkModeItem.kt @@ -48,7 +48,8 @@ fun DarkModeItem( val interactionSource = remember { MutableInteractionSource() } val pressed by interactionSource.collectIsPressedAsState() - val animatedShape = shapeByInteraction(shapes, pressed, VerveDoDefaults.shapesDefaultAnimationSpec) + val animatedShape = + shapeByInteraction(shapes, pressed, VerveDoDefaults.shapesDefaultAnimationSpec) val borderWidth by animateDpAsState(if (selected) 3.dp else (-1).dp) Column( diff --git a/app/src/main/kotlin/cn/super12138/todo/ui/pages/settings/components/appearance/palette/PaletteItem.kt b/app/src/main/kotlin/cn/super12138/todo/ui/pages/settings/components/appearance/palette/PaletteItem.kt index 348e966..9036dc7 100644 --- a/app/src/main/kotlin/cn/super12138/todo/ui/pages/settings/components/appearance/palette/PaletteItem.kt +++ b/app/src/main/kotlin/cn/super12138/todo/ui/pages/settings/components/appearance/palette/PaletteItem.kt @@ -55,7 +55,8 @@ fun PaletteItem( val view = LocalView.current val interactionSource = remember { MutableInteractionSource() } val pressed by interactionSource.collectIsPressedAsState() - val animatedShape = shapeByInteraction(shapes, pressed, VerveDoDefaults.shapesDefaultAnimationSpec) + val animatedShape = + shapeByInteraction(shapes, pressed, VerveDoDefaults.shapesDefaultAnimationSpec) Column( modifier = modifier diff --git a/app/src/main/kotlin/cn/super12138/todo/ui/viewmodels/MainViewModel.kt b/app/src/main/kotlin/cn/super12138/todo/ui/viewmodels/MainViewModel.kt index 1f10c91..207baec 100644 --- a/app/src/main/kotlin/cn/super12138/todo/ui/viewmodels/MainViewModel.kt +++ b/app/src/main/kotlin/cn/super12138/todo/ui/viewmodels/MainViewModel.kt @@ -14,8 +14,8 @@ import cn.super12138.todo.logic.Repository import cn.super12138.todo.logic.database.TodoEntity import cn.super12138.todo.logic.datastore.DataStoreManager import cn.super12138.todo.logic.model.SortingMethod -import cn.super12138.todo.ui.navigation.VerveDoScreen import cn.super12138.todo.ui.navigation.TopLevelBackStack +import cn.super12138.todo.ui.navigation.VerveDoScreen import cn.super12138.todo.utils.FileUtils import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -55,41 +55,34 @@ class MainViewModel : ViewModel() { SortingMethod.Category -> list.sortedWith( comparator = compareBy { it.isCompleted } - .thenByDescending { it.priority } .thenBy { it.category } ) SortingMethod.Priority -> list.sortedWith( comparator = compareBy { it.isCompleted } .thenByDescending { it.priority } - .thenBy { it.category } ) // 优先级高的在前 SortingMethod.Completion -> list.sortedWith( comparator = compareBy { it.isCompleted } .thenBy { it.category } - .thenBy { it.content } .thenByDescending { it.priority } ) // 未完成的在前 SortingMethod.AlphabeticalAscending -> list.sortedWith( comparator = compareBy { it.isCompleted } - .thenBy { it.category } .thenBy { it.content } .thenByDescending { it.priority } ) SortingMethod.AlphabeticalDescending -> list.sortedWith( comparator = compareBy { it.isCompleted } - .thenByDescending { it.category } .thenByDescending { it.content } .thenByDescending { it.priority } ) SortingMethod.DueDate -> list.sortedWith( comparator = compareBy { it.isCompleted } - .thenBy { it.category } .thenBy { it.dueDate } - .thenByDescending { it.priority } ) } } diff --git a/app/src/main/kotlin/cn/super12138/todo/utils/TodoExt.kt b/app/src/main/kotlin/cn/super12138/todo/utils/VerveDoExt.kt similarity index 96% rename from app/src/main/kotlin/cn/super12138/todo/utils/TodoExt.kt rename to app/src/main/kotlin/cn/super12138/todo/utils/VerveDoExt.kt index 6819422..d0a9132 100644 --- a/app/src/main/kotlin/cn/super12138/todo/utils/TodoExt.kt +++ b/app/src/main/kotlin/cn/super12138/todo/utils/VerveDoExt.kt @@ -1,6 +1,7 @@ package cn.super12138.todo.utils import android.content.Context +import androidx.annotation.FloatRange import androidx.compose.foundation.shape.CornerBasedShape import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable @@ -12,6 +13,7 @@ import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.drawscope.ContentDrawScope import androidx.compose.ui.unit.Dp +import androidx.core.graphics.ColorUtils import cn.super12138.todo.R import cn.super12138.todo.logic.model.Priority import java.text.SimpleDateFormat @@ -20,6 +22,11 @@ import java.util.Locale import kotlin.time.Duration.Companion.days import kotlin.time.Duration.Companion.milliseconds +fun Int.blend( + color: Int, + @FloatRange(from = 0.0, to = 1.0) fraction: Float = 0.5f, +): Int = ColorUtils.blendARGB(this, color, fraction) + @Composable @Stable fun Priority.containerColor(): Color =