From c36f8b0df3603e91cbc1efaff51456ce939eeff0 Mon Sep 17 00:00:00 2001 From: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> Date: Fri, 4 Apr 2025 17:51:27 +0800 Subject: [PATCH] Opt the transparency slider display logic with `AnimatedVisibility` and update the formatting in the Chinese string resource. Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> --- .../zako/sukisu/ui/screen/MoreSettings.kt | 72 ++++++++++--------- .../src/main/res/values-zh-rCN/strings.xml | 4 +- 2 files changed, 41 insertions(+), 35 deletions(-) diff --git a/manager/app/src/main/java/shirkneko/zako/sukisu/ui/screen/MoreSettings.kt b/manager/app/src/main/java/shirkneko/zako/sukisu/ui/screen/MoreSettings.kt index bdd0a777..7b36e75b 100644 --- a/manager/app/src/main/java/shirkneko/zako/sukisu/ui/screen/MoreSettings.kt +++ b/manager/app/src/main/java/shirkneko/zako/sukisu/ui/screen/MoreSettings.kt @@ -407,39 +407,45 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) { ) } ) - - if (ThemeConfig.customBackgroundUri != null && showCardSettings) { // 透明度 Slider - ListItem( - leadingContent = { Icon(Icons.Filled.Opacity, null) }, - headlineContent = { Text(stringResource(R.string.settings_card_alpha)) }, - supportingContent = { - Slider( - value = cardAlpha, - onValueChange = { newValue -> - cardAlpha = newValue - CardConfig.cardAlpha = newValue - CardConfig.isCustomAlphaSet = true - prefs.edit { putBoolean("is_custom_alpha_set", true) } - prefs.edit { putFloat("card_alpha", newValue) } - }, - onValueChangeFinished = { - CoroutineScope(Dispatchers.IO).launch { - saveCardConfig(context) + AnimatedVisibility( + visible = ThemeConfig.customBackgroundUri != null && showCardSettings, + modifier = Modifier.fillMaxWidth().padding(horizontal = 24.dp) + ) { + ListItem( + leadingContent = { Icon(Icons.Filled.Opacity, null) }, + headlineContent = { Text(stringResource(R.string.settings_card_alpha)) }, + supportingContent = { + Slider( + value = cardAlpha, + onValueChange = { newValue -> + cardAlpha = newValue + CardConfig.cardAlpha = newValue + CardConfig.isCustomAlphaSet = true + prefs.edit { putBoolean("is_custom_alpha_set", true) } + prefs.edit { putFloat("card_alpha", newValue) } + }, + onValueChangeFinished = { + CoroutineScope(Dispatchers.IO).launch { + saveCardConfig(context) + } + }, + valueRange = 0f..1f, + colors = getSliderColors(cardAlpha, useCustomColors = true), + thumb = { + SliderDefaults.Thumb( + interactionSource = remember { MutableInteractionSource() }, + thumbSize = DpSize(0.dp, 0.dp) + ) } - }, - valueRange = 0f..1f, - colors = getSliderColors(cardAlpha, useCustomColors = true), - thumb = { - SliderDefaults.Thumb( - interactionSource = remember { MutableInteractionSource() }, - thumbSize = DpSize(0.dp, 0.dp) - ) - } - ) - } - ) - + ) + } + ) + } + AnimatedVisibility( + visible = ThemeConfig.customBackgroundUri != null && showCardSettings, + modifier = Modifier.fillMaxWidth().padding(horizontal = 24.dp) + ){ ListItem( leadingContent = { Icon(Icons.Filled.DarkMode, null) }, headlineContent = { Text(stringResource(R.string.theme_mode)) }, @@ -448,7 +454,7 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) { showThemeModeDialog = true } ) - + } // 主题模式选择对话框 if (showThemeModeDialog) { @@ -511,7 +517,7 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) { } } } - } + @Composable private fun getSliderColors(cardAlpha: Float, useCustomColors: Boolean = false): SliderColors { diff --git a/manager/app/src/main/res/values-zh-rCN/strings.xml b/manager/app/src/main/res/values-zh-rCN/strings.xml index cbfdf3d5..c2f97114 100644 --- a/manager/app/src/main/res/values-zh-rCN/strings.xml +++ b/manager/app/src/main/res/values-zh-rCN/strings.xml @@ -244,8 +244,8 @@ KPM 文件无效 内核未进行补丁 内核未配置 - 以下内核模块功能由KernelPatch开发,经过修改后加入SukiSU Ultra的内核模块功能 + 以下内核模块功能由 KernelPatch 开发,经过修改后加入 SukiSU Ultra 的内核模块功能 SukiSU Ultra展望 - SukiSU Ultra未来将会成为一个相对独立的KSU分支,但是依然感谢官方KernelSU和MKSU等做出的贡献 + SukiSU Ultra 未来将会成为一个相对独立的 KSU 分支,但是依然感谢官方 KernelSU 和 MKSU 等做出的贡献 简洁模式