diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7604bf6..afedb45 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -23,7 +23,7 @@ android { minSdk = 24 targetSdk = 35 versionCode = 67 - versionName = "2.3-alpha07" + versionName = "2.3-beta01" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { @@ -147,21 +147,21 @@ tasks.withType(KotlinCompile::class.java).configureEach { dependencies { implementation("androidx.core:core-ktx:1.13.1") - implementation("androidx.compose.ui:ui:1.7.3") + implementation("androidx.compose.ui:ui:1.7.4") implementation("androidx.compose.material3:material3:1.3.0") implementation("androidx.compose.material3:material3-window-size-class:1.3.0") - implementation("androidx.compose.material:material:1.7.3") - implementation("androidx.compose.material:material-icons-extended:1.7.3") - implementation("androidx.compose.ui:ui-tooling-preview:1.7.3") + implementation("androidx.compose.material:material:1.7.4") + implementation("androidx.compose.material:material-icons-extended:1.7.4") + implementation("androidx.compose.ui:ui-tooling-preview:1.7.4") implementation("com.google.android.material:material:1.12.0") implementation("androidx.lifecycle:lifecycle-runtime-compose:2.8.6") implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.6") - implementation("androidx.activity:activity-compose:1.9.2") + implementation("androidx.activity:activity-compose:1.9.3") implementation("androidx.palette:palette-ktx:1.0.0") implementation("com.google.dagger:hilt-android:2.52") ksp("com.google.dagger:hilt-android-compiler:2.52") implementation("androidx.hilt:hilt-navigation-compose:1.2.0") - implementation("androidx.navigation:navigation-compose:2.8.2") + implementation("androidx.navigation:navigation-compose:2.8.3") implementation("androidx.security:security-crypto:1.1.0-alpha06") implementation("com.google.accompanist:accompanist-drawablepainter:0.36.0") implementation("io.coil-kt:coil-compose:2.7.0") @@ -173,8 +173,8 @@ dependencies { implementation("androidx.room:room-ktx:2.6.1") ksp("androidx.room:room-compiler:2.6.1") implementation("com.github.thegrizzlylabs:sardine-android:0.8") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.2") - implementation("com.materialkolor:material-kolor:1.7.0") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3") + implementation("com.materialkolor:material-kolor:2.0.0") implementation("androidx.datastore:datastore-preferences:1.1.1") implementation("com.airbnb.android:lottie-compose:6.5.2") @@ -195,6 +195,6 @@ dependencies { implementation("com.github.penfeizhou.android.animation:apng:3.0.1") - debugImplementation("androidx.compose.ui:ui-tooling:1.7.3") - debugImplementation("androidx.compose.ui:ui-test-manifest:1.7.3") + debugImplementation("androidx.compose.ui:ui-tooling:1.7.4") + debugImplementation("androidx.compose.ui:ui-test-manifest:1.7.4") } \ No newline at end of file diff --git a/app/src/main/java/com/skyd/rays/ext/PreferenceExt.kt b/app/src/main/java/com/skyd/rays/ext/PreferenceExt.kt index 01e7506..a4fff24 100644 --- a/app/src/main/java/com/skyd/rays/ext/PreferenceExt.kt +++ b/app/src/main/java/com/skyd/rays/ext/PreferenceExt.kt @@ -28,6 +28,7 @@ import com.skyd.rays.model.preference.search.UseRegexSearchPreference import com.skyd.rays.model.preference.share.CopyStickerToClipboardWhenSharingPreference import com.skyd.rays.model.preference.share.StickerExtNamePreference import com.skyd.rays.model.preference.share.UriStringSharePreference +import com.skyd.rays.model.preference.theme.AmoledDarkModePreference import com.skyd.rays.model.preference.theme.CustomPrimaryColorPreference import com.skyd.rays.model.preference.theme.DarkModePreference import com.skyd.rays.model.preference.theme.StickerColorThemePreference @@ -39,6 +40,7 @@ fun Preferences.toSettings(): Settings { themeName = ThemeNamePreference.fromPreferences(this), customPrimaryColor = CustomPrimaryColorPreference.fromPreferences(this), darkMode = DarkModePreference.fromPreferences(this), + amoledDarkMode = AmoledDarkModePreference.fromPreferences(this), stickerColorTheme = StickerColorThemePreference.fromPreferences(this), // Theme diff --git a/app/src/main/java/com/skyd/rays/model/preference/Settings.kt b/app/src/main/java/com/skyd/rays/model/preference/Settings.kt index 1493759..e7f6263 100644 --- a/app/src/main/java/com/skyd/rays/model/preference/Settings.kt +++ b/app/src/main/java/com/skyd/rays/model/preference/Settings.kt @@ -23,10 +23,12 @@ import com.skyd.rays.model.preference.search.UseRegexSearchPreference import com.skyd.rays.model.preference.share.CopyStickerToClipboardWhenSharingPreference import com.skyd.rays.model.preference.share.StickerExtNamePreference import com.skyd.rays.model.preference.share.UriStringSharePreference +import com.skyd.rays.model.preference.theme.AmoledDarkModePreference import com.skyd.rays.model.preference.theme.CustomPrimaryColorPreference import com.skyd.rays.model.preference.theme.DarkModePreference import com.skyd.rays.model.preference.theme.StickerColorThemePreference import com.skyd.rays.model.preference.theme.ThemeNamePreference +import com.skyd.rays.ui.local.LocalAmoledDarkMode import com.skyd.rays.ui.local.LocalApiGrant import com.skyd.rays.ui.local.LocalAutoShareIgnoreStrategy import com.skyd.rays.ui.local.LocalBlurSticker @@ -65,6 +67,7 @@ data class Settings( val themeName: String = ThemeNamePreference.default, val customPrimaryColor: String = CustomPrimaryColorPreference.default, val darkMode: Int = DarkModePreference.default, + val amoledDarkMode: Boolean = AmoledDarkModePreference.default, val stickerColorTheme: Boolean = StickerColorThemePreference.default, // Update val ignoreUpdateVersion: Long = IgnoreUpdateVersionPreference.default, @@ -118,6 +121,7 @@ fun SettingsProvider( LocalThemeName provides settings.themeName, LocalCustomPrimaryColor provides settings.customPrimaryColor, LocalDarkMode provides settings.darkMode, + LocalAmoledDarkMode provides settings.amoledDarkMode, LocalStickerColorTheme provides settings.stickerColorTheme, // Update LocalIgnoreUpdateVersion provides settings.ignoreUpdateVersion, diff --git a/app/src/main/java/com/skyd/rays/model/preference/theme/AmoledDarkModePreference.kt b/app/src/main/java/com/skyd/rays/model/preference/theme/AmoledDarkModePreference.kt new file mode 100644 index 0000000..a483091 --- /dev/null +++ b/app/src/main/java/com/skyd/rays/model/preference/theme/AmoledDarkModePreference.kt @@ -0,0 +1,26 @@ +package com.skyd.rays.model.preference.theme + +import android.content.Context +import androidx.datastore.preferences.core.Preferences +import androidx.datastore.preferences.core.booleanPreferencesKey +import com.skyd.rays.ext.dataStore +import com.skyd.rays.ext.put +import com.skyd.rays.model.preference.BasePreference +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch + +object AmoledDarkModePreference : BasePreference { + private const val AMOLED_DARK_MODE = "amoledDarkMode" + override val default = false + + val key = booleanPreferencesKey(AMOLED_DARK_MODE) + + fun put(context: Context, scope: CoroutineScope, value: Boolean) { + scope.launch(Dispatchers.IO) { + context.dataStore.put(key, value) + } + } + + override fun fromPreferences(preferences: Preferences): Boolean = preferences[key] ?: default +} \ No newline at end of file diff --git a/app/src/main/java/com/skyd/rays/ui/local/LocalValue.kt b/app/src/main/java/com/skyd/rays/ui/local/LocalValue.kt index 56327ab..d148cab 100644 --- a/app/src/main/java/com/skyd/rays/ui/local/LocalValue.kt +++ b/app/src/main/java/com/skyd/rays/ui/local/LocalValue.kt @@ -29,6 +29,7 @@ import com.skyd.rays.model.preference.search.UseRegexSearchPreference import com.skyd.rays.model.preference.share.CopyStickerToClipboardWhenSharingPreference import com.skyd.rays.model.preference.share.StickerExtNamePreference import com.skyd.rays.model.preference.share.UriStringSharePreference +import com.skyd.rays.model.preference.theme.AmoledDarkModePreference import com.skyd.rays.model.preference.theme.CustomPrimaryColorPreference import com.skyd.rays.model.preference.theme.DarkModePreference import com.skyd.rays.model.preference.theme.StickerColorThemePreference @@ -44,6 +45,7 @@ val LocalWindowSizeClass = compositionLocalOf { // Theme val LocalDarkMode = compositionLocalOf { DarkModePreference.default } +val LocalAmoledDarkMode = compositionLocalOf { AmoledDarkModePreference.default } val LocalThemeName = compositionLocalOf { ThemeNamePreference.default } val LocalCustomPrimaryColor = compositionLocalOf { CustomPrimaryColorPreference.default } val LocalStickerColorTheme = compositionLocalOf { StickerColorThemePreference.default } diff --git a/app/src/main/java/com/skyd/rays/ui/screen/detail/DetailScreen.kt b/app/src/main/java/com/skyd/rays/ui/screen/detail/DetailScreen.kt index 43b71f6..5e9617c 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/detail/DetailScreen.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/detail/DetailScreen.kt @@ -20,7 +20,6 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.rememberScrollState @@ -376,9 +375,7 @@ fun MainCard( FlowRow( modifier = Modifier .padding(vertical = 6.dp, horizontal = 16.dp) - .fillMaxWidth() - .heightIn(max = 150.dp) - .verticalScroll(rememberScrollState()), + .fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(5.dp) ) { repeat(tags.size) { index -> diff --git a/app/src/main/java/com/skyd/rays/ui/screen/settings/appearance/AppearanceScreen.kt b/app/src/main/java/com/skyd/rays/ui/screen/settings/appearance/AppearanceScreen.kt index d755608..33a452c 100644 --- a/app/src/main/java/com/skyd/rays/ui/screen/settings/appearance/AppearanceScreen.kt +++ b/app/src/main/java/com/skyd/rays/ui/screen/settings/appearance/AppearanceScreen.kt @@ -29,6 +29,7 @@ import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Check +import androidx.compose.material.icons.outlined.Contrast import androidx.compose.material.icons.outlined.DarkMode import androidx.compose.material.icons.outlined.Palette import androidx.compose.material.icons.outlined.Search @@ -67,6 +68,7 @@ import com.skyd.rays.ext.checkColorHex import com.skyd.rays.ext.dataStore import com.skyd.rays.ext.onDark import com.skyd.rays.ext.toColorOrNull +import com.skyd.rays.model.preference.theme.AmoledDarkModePreference import com.skyd.rays.model.preference.theme.CustomPrimaryColorPreference import com.skyd.rays.model.preference.theme.DarkModePreference import com.skyd.rays.model.preference.theme.StickerColorThemePreference @@ -80,6 +82,7 @@ import com.skyd.rays.ui.component.RaysTopBar import com.skyd.rays.ui.component.RaysTopBarStyle import com.skyd.rays.ui.component.SwitchSettingsItem import com.skyd.rays.ui.component.dialog.TextFieldDialog +import com.skyd.rays.ui.local.LocalAmoledDarkMode import com.skyd.rays.ui.local.LocalCustomPrimaryColor import com.skyd.rays.ui.local.LocalDarkMode import com.skyd.rays.ui.local.LocalNavController @@ -152,6 +155,20 @@ fun AppearanceScreen() { onClick = { openDarkBottomSheet = true } ) } + item { + SwitchSettingsItem( + imageVector = Icons.Outlined.Contrast, + text = stringResource(id = R.string.appearance_screen_amoled_dark), + checked = LocalAmoledDarkMode.current, + onCheckedChange = { + AmoledDarkModePreference.put( + context = context, + scope = scope, + value = it, + ) + } + ) + } item { SwitchSettingsItem( imageVector = Icons.Outlined.Palette, diff --git a/app/src/main/java/com/skyd/rays/ui/theme/Theme.kt b/app/src/main/java/com/skyd/rays/ui/theme/Theme.kt index 6e599e2..ef89901 100644 --- a/app/src/main/java/com/skyd/rays/ui/theme/Theme.kt +++ b/app/src/main/java/com/skyd/rays/ui/theme/Theme.kt @@ -19,6 +19,7 @@ import com.skyd.rays.ext.activity import com.skyd.rays.ext.toColorOrNull import com.skyd.rays.model.preference.theme.DarkModePreference import com.skyd.rays.model.preference.theme.ThemeNamePreference +import com.skyd.rays.ui.local.LocalAmoledDarkMode import com.skyd.rays.ui.local.LocalCustomPrimaryColor import com.skyd.rays.ui.local.LocalThemeName @@ -47,14 +48,15 @@ fun RaysTheme( } val themeName = LocalThemeName.current + val amoledDarkMode = LocalAmoledDarkMode.current MaterialTheme( - colorScheme = remember(themeName, LocalCustomPrimaryColor.current) { + colorScheme = remember(themeName, LocalCustomPrimaryColor.current, amoledDarkMode) { wallpaperColors.getOrElse(themeName) { dynamicColorScheme( seedColor = ThemeNamePreference.values[0].keyColor, isDark = darkTheme, - isAmoled = false, + isAmoled = amoledDarkMode, ) } }, @@ -88,12 +90,19 @@ fun extractAllColors(darkTheme: Boolean): Map { @Composable fun extractColors(darkTheme: Boolean): Map { return ThemeNamePreference.values.associate { - it.name to rememberDynamicColorScheme(it.keyColor, isDark = darkTheme) + it.name to rememberDynamicColorScheme( + primary = it.keyColor, + isDark = darkTheme, + isAmoled = LocalAmoledDarkMode.current, + ) }.toMutableMap().also { map -> val customPrimaryColor = LocalCustomPrimaryColor.current.toColorOrNull() ?: Color.Transparent - map[ThemeNamePreference.CUSTOM_THEME_NAME] = - rememberDynamicColorScheme(customPrimaryColor, isDark = darkTheme) + map[ThemeNamePreference.CUSTOM_THEME_NAME] = rememberDynamicColorScheme( + primary = customPrimaryColor, + isDark = darkTheme, + isAmoled = LocalAmoledDarkMode.current, + ) } } @@ -113,18 +122,24 @@ fun extractColorsFromWallpaper(darkTheme: Boolean): Map { preset["WallpaperPrimary"] = rememberSystemDynamicColorScheme(isDark = darkTheme) } else { preset["WallpaperPrimary"] = rememberDynamicColorScheme( - seedColor = Color(primary), isDark = darkTheme, + primary = Color(primary), + isDark = darkTheme, + isAmoled = LocalAmoledDarkMode.current, ) } } if (secondary != null) { preset["WallpaperSecondary"] = rememberDynamicColorScheme( - seedColor = Color(secondary), isDark = darkTheme, + primary = Color(secondary), + isDark = darkTheme, + isAmoled = LocalAmoledDarkMode.current, ) } if (tertiary != null) { preset["WallpaperTertiary"] = rememberDynamicColorScheme( - seedColor = Color(tertiary), isDark = darkTheme, + primary = Color(tertiary), + isDark = darkTheme, + isAmoled = LocalAmoledDarkMode.current, ) } } diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 207172c..b94d3c2 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -358,4 +358,5 @@ 已复制 日志 复制日志 + Amoled 深色 \ 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 be08ba3..9d8c5c2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -351,4 +351,5 @@ Copied Log Copy log + Amoled dark \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index f487baa..e4fb8db 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,10 +1,10 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id("com.android.application") version "8.5.2" apply false - id("com.android.library") version "8.5.2" apply false - id("org.jetbrains.kotlin.android") version "2.0.20" apply false - id("org.jetbrains.kotlin.plugin.compose") version "2.0.20" - id("org.jetbrains.kotlin.plugin.serialization") version "2.0.20" + id("com.android.application") version "8.7.1" apply false + id("com.android.library") version "8.7.1" apply false + id("org.jetbrains.kotlin.android") version "2.0.21" apply false + id("org.jetbrains.kotlin.plugin.compose") version "2.0.21" + id("org.jetbrains.kotlin.plugin.serialization") version "2.0.21" id("com.google.dagger.hilt.android") version "2.51.1" apply false - id("com.google.devtools.ksp") version "2.0.20-1.0.24" apply false + id("com.google.devtools.ksp") version "2.0.21-1.0.25" apply false } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 795f692..8429e8c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ #Mon Jul 29 23:47:06 CST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME