Updated agp version to 8.9.1, added white color theme
This commit is contained in:
@@ -49,8 +49,7 @@ import shirkneko.zako.sukisu.ui.util.getSuSFSFeatures
|
||||
import shirkneko.zako.sukisu.ui.util.susfsSUS_SU_0
|
||||
import shirkneko.zako.sukisu.ui.util.susfsSUS_SU_2
|
||||
import shirkneko.zako.sukisu.ui.util.susfsSUS_SU_Mode
|
||||
import androidx.compose.foundation.gestures.detectTapGestures
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.core.content.edit
|
||||
|
||||
|
||||
fun saveCardConfig(context: Context) {
|
||||
@@ -72,7 +71,7 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
||||
val prefs = remember { context.getSharedPreferences("settings", Context.MODE_PRIVATE) }
|
||||
// 主题模式选择
|
||||
var themeMode by remember {
|
||||
mutableStateOf(
|
||||
mutableIntStateOf(
|
||||
when(ThemeConfig.forceDarkMode) {
|
||||
true -> 2 // 深色
|
||||
false -> 1 // 浅色
|
||||
@@ -101,7 +100,7 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
||||
|
||||
// 更新简洁模块开关状态
|
||||
val onSimpleModeChange = { newValue: Boolean ->
|
||||
prefs.edit().putBoolean("is_simple_mode", newValue).apply()
|
||||
prefs.edit { putBoolean("is_simple_mode", newValue) }
|
||||
isSimpleMode = newValue
|
||||
}
|
||||
|
||||
@@ -111,7 +110,7 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
||||
}
|
||||
|
||||
// 卡片配置状态
|
||||
var cardAlpha by rememberSaveable { mutableStateOf(CardConfig.cardAlpha) }
|
||||
var cardAlpha by rememberSaveable { mutableFloatStateOf(CardConfig.cardAlpha) }
|
||||
var showCardSettings by remember { mutableStateOf(false) }
|
||||
var isCustomBackgroundEnabled by rememberSaveable {
|
||||
mutableStateOf(ThemeConfig.customBackgroundUri != null)
|
||||
@@ -122,7 +121,7 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
||||
LaunchedEffect(Unit) {
|
||||
CardConfig.apply {
|
||||
cardAlpha = prefs.getFloat("card_alpha", 0.65f)
|
||||
cardElevation = if (prefs.getBoolean("custom_background_enabled", false)) 0.dp else CardConfig.defaultElevation
|
||||
cardElevation = if (prefs.getBoolean("custom_background_enabled", false)) 0.dp else defaultElevation
|
||||
isCustomAlphaSet = prefs.getBoolean("is_custom_alpha_set", false)
|
||||
|
||||
// 如果没有手动设置透明度,且是深色模式,则使用默认值
|
||||
@@ -149,6 +148,7 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
||||
stringResource(R.string.color_orange) to ThemeColors.Orange,
|
||||
stringResource(R.string.color_pink) to ThemeColors.Pink,
|
||||
stringResource(R.string.color_gray) to ThemeColors.Gray,
|
||||
stringResource(R.string.color_yellow) to ThemeColors.Yellow
|
||||
)
|
||||
|
||||
var showThemeColorDialog by remember { mutableStateOf(false) }
|
||||
@@ -226,7 +226,7 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
||||
val wasManuallyDisabled = prefs.getBoolean("enable_sus_su", true)
|
||||
if (currentMode != "2" && wasManuallyDisabled) {
|
||||
susfsSUS_SU_2() // 强制切换到模式2
|
||||
prefs.edit().putBoolean("enable_sus_su", true).apply()
|
||||
prefs.edit { putBoolean("enable_sus_su", true) }
|
||||
}
|
||||
isEnabled = currentMode == "2"
|
||||
}
|
||||
@@ -240,11 +240,11 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
||||
if (it) {
|
||||
// 手动启用
|
||||
susfsSUS_SU_2()
|
||||
prefs.edit().putBoolean("enable_sus_su", true).apply()
|
||||
prefs.edit { putBoolean("enable_sus_su", true) }
|
||||
} else {
|
||||
// 手动关闭
|
||||
susfsSUS_SU_0()
|
||||
prefs.edit().putBoolean("enable_sus_su", false).apply()
|
||||
prefs.edit { putBoolean("enable_sus_su", false) }
|
||||
}
|
||||
isEnabled = it
|
||||
}
|
||||
@@ -277,6 +277,7 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
||||
is ThemeColors.Orange -> stringResource(R.string.color_orange)
|
||||
is ThemeColors.Pink -> stringResource(R.string.color_pink)
|
||||
is ThemeColors.Gray -> stringResource(R.string.color_gray)
|
||||
is ThemeColors.Yellow -> stringResource(R.string.color_yellow)
|
||||
else -> stringResource(R.string.color_default)
|
||||
}
|
||||
Text(currentThemeName)
|
||||
@@ -303,6 +304,7 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
||||
ThemeColors.Orange -> "orange"
|
||||
ThemeColors.Pink -> "pink"
|
||||
ThemeColors.Gray -> "gray"
|
||||
ThemeColors.Yellow -> "yellow"
|
||||
else -> "default"
|
||||
})
|
||||
showThemeColorDialog = false
|
||||
@@ -377,8 +379,8 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
||||
cardAlpha = newValue
|
||||
CardConfig.cardAlpha = newValue
|
||||
CardConfig.isCustomAlphaSet = true
|
||||
prefs.edit().putBoolean("is_custom_alpha_set", true).apply()
|
||||
prefs.edit().putFloat("card_alpha", newValue).apply()
|
||||
prefs.edit { putBoolean("is_custom_alpha_set", true) }
|
||||
prefs.edit { putFloat("card_alpha", newValue) }
|
||||
},
|
||||
onValueChangeFinished = {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
|
||||
@@ -21,18 +21,18 @@ sealed class ThemeColors {
|
||||
|
||||
// Default Theme (Yellow)
|
||||
object Default : ThemeColors() {
|
||||
override val Primary = Color(0xFFFFD700)
|
||||
override val Secondary = Color(0xFFFFBC52)
|
||||
override val Tertiary = Color(0xFF795548)
|
||||
override val OnPrimary = Color(0xFFFFFFFF)
|
||||
override val OnSecondary = Color(0xFFFFFFFF)
|
||||
override val OnTertiary = Color(0xFFFFFFFF)
|
||||
override val PrimaryContainer = Color(0xFFFFF7D6)
|
||||
override val SecondaryContainer = Color(0xFFFFE6B3)
|
||||
override val TertiaryContainer = Color(0xFFD7CCC8)
|
||||
override val OnPrimaryContainer = Color(0xFF1A1600)
|
||||
override val OnSecondaryContainer = Color(0xFF1A1100)
|
||||
override val OnTertiaryContainer = Color(0xFF1A1717)
|
||||
override val Primary = Color(0xFFFFFFFF)
|
||||
override val Secondary = Color(0xFFF5F5F5)
|
||||
override val Tertiary = Color(0xFFE0E0E0)
|
||||
override val OnPrimary = Color(0xFF616161)
|
||||
override val OnSecondary = Color(0xFF616161)
|
||||
override val OnTertiary = Color(0xFF616161)
|
||||
override val PrimaryContainer = Color(0xFFF5F5F5)
|
||||
override val SecondaryContainer = Color(0xFFEEEEEE)
|
||||
override val TertiaryContainer = Color(0xFFE0E0E0)
|
||||
override val OnPrimaryContainer = Color(0xFF000000)
|
||||
override val OnSecondaryContainer = Color(0xFF000000)
|
||||
override val OnTertiaryContainer = Color(0xFF000000)
|
||||
}
|
||||
|
||||
// Blue Theme
|
||||
@@ -131,6 +131,21 @@ sealed class ThemeColors {
|
||||
override val OnTertiaryContainer = Color(0xFF141414)
|
||||
}
|
||||
|
||||
object Yellow : ThemeColors() {
|
||||
override val Primary = Color(0xFFFFD700)
|
||||
override val Secondary = Color(0xFFFFBC52)
|
||||
override val Tertiary = Color(0xFF795548)
|
||||
override val OnPrimary = Color(0xFFFFFFFF)
|
||||
override val OnSecondary = Color(0xFFFFFFFF)
|
||||
override val OnTertiary = Color(0xFFFFFFFF)
|
||||
override val PrimaryContainer = Color(0xFFFFF7D6)
|
||||
override val SecondaryContainer = Color(0xFFFFE6B3)
|
||||
override val TertiaryContainer = Color(0xFFD7CCC8)
|
||||
override val OnPrimaryContainer = Color(0xFF1A1600)
|
||||
override val OnSecondaryContainer = Color(0xFF1A1100)
|
||||
override val OnTertiaryContainer = Color(0xFF1A1717)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun fromName(name: String): ThemeColors = when (name.lowercase()) {
|
||||
"blue" -> Blue
|
||||
@@ -139,6 +154,7 @@ sealed class ThemeColors {
|
||||
"orange" -> Orange
|
||||
"pink" -> Pink
|
||||
"gray" -> Gray
|
||||
"white" -> Yellow
|
||||
else -> Default
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ import androidx.compose.ui.graphics.luminance
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.io.InputStream
|
||||
import androidx.core.content.edit
|
||||
import androidx.core.net.toUri
|
||||
|
||||
object ThemeConfig {
|
||||
var customBackgroundUri by mutableStateOf<Uri?>(null)
|
||||
@@ -243,27 +245,29 @@ fun KernelSUTheme(
|
||||
fun Context.saveCustomBackground(uri: Uri?) {
|
||||
val newUri = uri?.let { copyImageToInternalStorage(it) }
|
||||
getSharedPreferences("theme_prefs", Context.MODE_PRIVATE)
|
||||
.edit()
|
||||
.putString("custom_background", newUri?.toString())
|
||||
.apply()
|
||||
.edit {
|
||||
putString("custom_background", newUri?.toString())
|
||||
}
|
||||
ThemeConfig.customBackgroundUri = newUri
|
||||
}
|
||||
|
||||
fun Context.loadCustomBackground() {
|
||||
val uriString = getSharedPreferences("theme_prefs", Context.MODE_PRIVATE)
|
||||
.getString("custom_background", null)
|
||||
ThemeConfig.customBackgroundUri = uriString?.let { Uri.parse(it) }
|
||||
ThemeConfig.customBackgroundUri = uriString?.toUri()
|
||||
}
|
||||
|
||||
fun Context.saveThemeMode(forceDark: Boolean?) {
|
||||
getSharedPreferences("theme_prefs", Context.MODE_PRIVATE)
|
||||
.edit()
|
||||
.putString("theme_mode", when(forceDark) {
|
||||
.edit {
|
||||
putString(
|
||||
"theme_mode", when (forceDark) {
|
||||
true -> "dark"
|
||||
false -> "light"
|
||||
null -> "system"
|
||||
})
|
||||
.apply()
|
||||
}
|
||||
)
|
||||
}
|
||||
ThemeConfig.forceDarkMode = forceDark
|
||||
}
|
||||
|
||||
@@ -279,9 +283,9 @@ fun Context.loadThemeMode() {
|
||||
|
||||
fun Context.saveThemeColors(themeName: String) {
|
||||
getSharedPreferences("theme_prefs", Context.MODE_PRIVATE)
|
||||
.edit()
|
||||
.putString("theme_colors", themeName)
|
||||
.apply()
|
||||
.edit {
|
||||
putString("theme_colors", themeName)
|
||||
}
|
||||
|
||||
ThemeConfig.currentTheme = when(themeName) {
|
||||
"blue" -> ThemeColors.Blue
|
||||
@@ -290,6 +294,7 @@ fun Context.saveThemeColors(themeName: String) {
|
||||
"orange" -> ThemeColors.Orange
|
||||
"pink" -> ThemeColors.Pink
|
||||
"gray" -> ThemeColors.Gray
|
||||
"yellow" -> ThemeColors.Yellow
|
||||
else -> ThemeColors.Default
|
||||
}
|
||||
}
|
||||
@@ -305,15 +310,16 @@ fun Context.loadThemeColors() {
|
||||
"orange" -> ThemeColors.Orange
|
||||
"pink" -> ThemeColors.Pink
|
||||
"gray" -> ThemeColors.Gray
|
||||
"yellow" -> ThemeColors.Yellow
|
||||
else -> ThemeColors.Default
|
||||
}
|
||||
}
|
||||
|
||||
fun Context.saveDynamicColorState(enabled: Boolean) {
|
||||
getSharedPreferences("theme_prefs", Context.MODE_PRIVATE)
|
||||
.edit()
|
||||
.putBoolean("use_dynamic_color", enabled)
|
||||
.apply()
|
||||
.edit {
|
||||
putBoolean("use_dynamic_color", enabled)
|
||||
}
|
||||
ThemeConfig.useDynamicColor = enabled
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
<string name="dynamic_color_title">动态颜色</string>
|
||||
<string name="dynamic_color_summary">使用系统主题的动态颜色</string>
|
||||
<string name="choose_theme_color">选择主题色</string>
|
||||
<string name="color_default">黄色</string>
|
||||
<string name="color_default">白色</string>
|
||||
<string name="color_blue">蓝色</string>
|
||||
<string name="color_green">绿色</string>
|
||||
<string name="color_purple">紫色</string>
|
||||
@@ -217,4 +217,5 @@
|
||||
<string name="failed_reboot">重启失败</string>
|
||||
<string name="batch_authorization">批量授权</string>
|
||||
<string name="batch_cancel_authorization">批量取消授权</string>
|
||||
<string name="color_yellow">黄色</string>
|
||||
</resources>
|
||||
@@ -198,7 +198,7 @@
|
||||
<string name="dynamic_color_title">Dynamic colours</string>
|
||||
<string name="dynamic_color_summary">Dynamic colours using system themes</string>
|
||||
<string name="choose_theme_color">Choose a theme colour</string>
|
||||
<string name="color_default">yellow</string>
|
||||
<string name="color_default">White</string>
|
||||
<string name="color_blue">blue</string>
|
||||
<string name="color_green">green</string>
|
||||
<string name="color_purple">purple</string>
|
||||
@@ -219,4 +219,5 @@
|
||||
<string name="batch_authorization">bulk license</string>
|
||||
<string name="batch_cancel_authorization">Batch cancel authorization</string>
|
||||
<string name="backup">Backup</string>
|
||||
<string name="color_yellow">Yellow</string>
|
||||
</resources>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[versions]
|
||||
agp = "8.8.1"
|
||||
agp = "8.9.1"
|
||||
kotlin = "2.1.10"
|
||||
ksp = "2.1.10-1.0.30"
|
||||
compose-bom = "2025.02.00"
|
||||
|
||||
Reference in New Issue
Block a user