Modify UI layout

- Adjust the maximum number of SwitchItem rows to optimize the layout and spacing of interface buttons
This commit is contained in:
ShirkNeko
2025-05-11 23:30:48 +08:00
parent 59e3675a36
commit 2eeddcfa80
5 changed files with 11 additions and 18 deletions

View File

@@ -70,7 +70,7 @@ fun SwitchItem(
text = it, text = it,
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant, color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 3, maxLines = Int.MAX_VALUE,
overflow = TextOverflow.Ellipsis overflow = TextOverflow.Ellipsis
) )
} }

View File

@@ -110,7 +110,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
} }
} }
// 设置分组卡片 - 配置 // 配置
Card( Card(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()

View File

@@ -166,7 +166,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
snackbarHost = { SnackbarHost(snackBarHostState) }, snackbarHost = { SnackbarHost(snackBarHostState) },
contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal), contentWindowInsets = WindowInsets.safeDrawing.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal),
bottomBar = { bottomBar = {
// 批量操作按钮,直接放在底部栏
AnimatedVisibility( AnimatedVisibility(
visible = viewModel.showBatchActions && viewModel.selectedApps.isNotEmpty(), visible = viewModel.showBatchActions && viewModel.selectedApps.isNotEmpty(),
enter = slideInVertically(initialOffsetY = { it }), enter = slideInVertically(initialOffsetY = { it }),
@@ -181,15 +180,13 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding(16.dp), .padding(16.dp),
horizontalArrangement = Arrangement.spacedBy(16.dp) horizontalArrangement = Arrangement.SpaceEvenly
) { ) {
OutlinedButton( OutlinedButton(
onClick = { onClick = {
// 修改为重新赋值为空集合
viewModel.selectedApps = emptySet() viewModel.selectedApps = emptySet()
viewModel.showBatchActions = false viewModel.showBatchActions = false
}, },
modifier = Modifier.weight(1f),
colors = ButtonDefaults.outlinedButtonColors( colors = ButtonDefaults.outlinedButtonColors(
contentColor = MaterialTheme.colorScheme.primary contentColor = MaterialTheme.colorScheme.primary
) )
@@ -197,9 +194,9 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
Icon( Icon(
imageVector = Icons.Filled.Close, imageVector = Icons.Filled.Close,
contentDescription = null, contentDescription = null,
modifier = Modifier.size(18.dp) modifier = Modifier.size(16.dp)
) )
Spacer(modifier = Modifier.width(8.dp)) Spacer(modifier = Modifier.width(6.dp))
Text(stringResource(android.R.string.cancel)) Text(stringResource(android.R.string.cancel))
} }
@@ -209,7 +206,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
viewModel.updateBatchPermissions(true) viewModel.updateBatchPermissions(true)
} }
}, },
modifier = Modifier.weight(1f),
colors = ButtonDefaults.buttonColors( colors = ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.primary containerColor = MaterialTheme.colorScheme.primary
) )
@@ -217,9 +213,9 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
Icon( Icon(
imageVector = Icons.Filled.Check, imageVector = Icons.Filled.Check,
contentDescription = null, contentDescription = null,
modifier = Modifier.size(18.dp) modifier = Modifier.size(16.dp)
) )
Spacer(modifier = Modifier.width(8.dp)) Spacer(modifier = Modifier.width(6.dp))
Text(stringResource(R.string.batch_authorization)) Text(stringResource(R.string.batch_authorization))
} }
@@ -229,7 +225,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
viewModel.updateBatchPermissions(false) viewModel.updateBatchPermissions(false)
} }
}, },
modifier = Modifier.weight(1f),
colors = ButtonDefaults.buttonColors( colors = ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.error containerColor = MaterialTheme.colorScheme.error
) )
@@ -237,9 +232,9 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
Icon( Icon(
imageVector = Icons.Filled.Block, imageVector = Icons.Filled.Block,
contentDescription = null, contentDescription = null,
modifier = Modifier.size(18.dp) modifier = Modifier.size(16.dp)
) )
Spacer(modifier = Modifier.width(8.dp)) Spacer(modifier = Modifier.width(6.dp))
Text(stringResource(R.string.batch_cancel_authorization)) Text(stringResource(R.string.batch_cancel_authorization))
} }
} }

View File

@@ -225,7 +225,6 @@
<string name="batch_authorization">授权</string> <string name="batch_authorization">授权</string>
<string name="batch_cancel_authorization">撤销</string> <string name="batch_cancel_authorization">撤销</string>
<string name="color_yellow">黄色</string> <string name="color_yellow">黄色</string>
<string name="kpm">内核模块</string>
<string name="kpm_title">内核模块</string> <string name="kpm_title">内核模块</string>
<string name="kpm_empty">暂无已安装的内核模块</string> <string name="kpm_empty">暂无已安装的内核模块</string>
<string name="kpm_version">版本</string> <string name="kpm_version">版本</string>

View File

@@ -222,12 +222,11 @@
<string name="yes">Yes</string> <string name="yes">Yes</string>
<string name="no">No</string> <string name="no">No</string>
<string name="failed_reboot">Reboot Failed</string> <string name="failed_reboot">Reboot Failed</string>
<string name="batch_authorization">authorizations</string> <string name="batch_authorization">empower</string>
<string name="batch_cancel_authorization">withdraw</string> <string name="batch_cancel_authorization">withdraw</string>
<string name="backup">Backup</string> <string name="backup">Backup</string>
<string name="color_yellow">Yellow</string> <string name="color_yellow">Yellow</string>
<string name="kpm">KPM</string> <string name="kpm_title">KPM</string>
<string name="kpm_title">Kernel Module</string>
<string name="kpm_empty">No installed kernel modules at this time</string> <string name="kpm_empty">No installed kernel modules at this time</string>
<string name="kpm_version">Version</string> <string name="kpm_version">Version</string>
<string name="kpm_author">Author</string> <string name="kpm_author">Author</string>