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>
This commit is contained in:
ShirkNeko
2025-04-04 17:51:27 +08:00
parent 5ccec93940
commit c36f8b0df3
2 changed files with 41 additions and 35 deletions

View File

@@ -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 {

View File

@@ -244,8 +244,8 @@
<string name="kpm_invalid_file">KPM 文件无效</string>
<string name="kernel_patched">内核未进行补丁</string>
<string name="kernel_not_enabled">内核未配置</string>
<string name="kernel_module_notice">以下内核模块功能由KernelPatch开发经过修改后加入SukiSU Ultra的内核模块功能</string>
<string name="kernel_module_notice">以下内核模块功能由 KernelPatch 开发,经过修改后加入 SukiSU Ultra 的内核模块功能</string>
<string name="home_ContributionCard_kernelsu">SukiSU Ultra展望</string>
<string name="home_click_to_ContributionCard_kernelsu">SukiSU Ultra未来将会成为一个相对独立的KSU分支但是依然感谢官方KernelSUMKSU等做出的贡献</string>
<string name="home_click_to_ContributionCard_kernelsu">SukiSU Ultra 未来将会成为一个相对独立的 KSU 分支,但是依然感谢官方 KernelSUMKSU 等做出的贡献</string>
<string name="more_settings_simplicity_mode">简洁模式</string>
</resources>