Optimize icon handling for settings cards

Allow icons to be optional and remove redundant group title displays
This commit is contained in:
ShirkNeko
2025-06-01 21:24:21 +08:00
parent 8a6116b4ec
commit 2817583e3c
2 changed files with 12 additions and 25 deletions

View File

@@ -510,7 +510,6 @@ fun MoreSettingsScreen() {
// 外观设置部分 // 外观设置部分
SettingsCard( SettingsCard(
title = stringResource(R.string.appearance_settings), title = stringResource(R.string.appearance_settings),
icon = Icons.Default.Palette
) { ) {
// 语言设置 // 语言设置
SettingItem( SettingItem(
@@ -846,8 +845,7 @@ fun MoreSettingsScreen() {
// 自定义设置部分 // 自定义设置部分
SettingsCard( SettingsCard(
title = stringResource(R.string.custom_settings), title = stringResource(R.string.custom_settings)
icon = Icons.Default.Settings
) { ) {
// 添加简洁模式开关 // 添加简洁模式开关
SwitchItem( SwitchItem(
@@ -914,8 +912,7 @@ fun MoreSettingsScreen() {
// 高级设置部分 // 高级设置部分
SettingsCard( SettingsCard(
title = stringResource(R.string.advanced_settings), title = stringResource(R.string.advanced_settings)
icon = Icons.Default.AdminPanelSettings
) { ) {
// SELinux 开关 // SELinux 开关
KsuIsValid { KsuIsValid {
@@ -1164,7 +1161,7 @@ fun MoreSettingsScreen() {
@Composable @Composable
fun SettingsCard( fun SettingsCard(
title: String, title: String,
icon: ImageVector, icon: ImageVector? = null,
content: @Composable () -> Unit content: @Composable () -> Unit
) { ) {
Card( Card(
@@ -1180,6 +1177,7 @@ fun SettingsCard(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp) modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp)
) { ) {
if (icon != null) {
Icon( Icon(
imageVector = icon, imageVector = icon,
contentDescription = null, contentDescription = null,
@@ -1187,6 +1185,7 @@ fun SettingsCard(
modifier = Modifier.size(24.dp) modifier = Modifier.size(24.dp)
) )
Spacer(modifier = Modifier.width(12.dp)) Spacer(modifier = Modifier.width(12.dp))
}
Text( Text(
text = title, text = title,
style = MaterialTheme.typography.titleLarge, style = MaterialTheme.typography.titleLarge,

View File

@@ -493,10 +493,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
// 显示ROOT权限应用组 // 显示ROOT权限应用组
if (rootApps.isNotEmpty()) { if (rootApps.isNotEmpty()) {
item {
GroupHeader(title = stringResource(R.string.apps_with_root))
}
items(rootApps, key = { "root_" + it.packageName + it.uid }) { app -> items(rootApps, key = { "root_" + it.packageName + it.uid }) { app ->
AppItem( AppItem(
app = app, app = app,
@@ -532,10 +528,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
// 显示自定义配置应用组 // 显示自定义配置应用组
if (customApps.isNotEmpty()) { if (customApps.isNotEmpty()) {
item {
GroupHeader(title = stringResource(R.string.apps_with_custom_profile))
}
items(customApps, key = { "custom_" + it.packageName + it.uid }) { app -> items(customApps, key = { "custom_" + it.packageName + it.uid }) { app ->
AppItem( AppItem(
app = app, app = app,
@@ -571,10 +563,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
// 显示其他应用组 // 显示其他应用组
if (otherApps.isNotEmpty()) { if (otherApps.isNotEmpty()) {
item {
GroupHeader(title = stringResource(R.string.other_apps))
}
items(otherApps, key = { "other_" + it.packageName + it.uid }) { app -> items(otherApps, key = { "other_" + it.packageName + it.uid }) { app ->
AppItem( AppItem(
app = app, app = app,