- Optimizing interface text

- Use string resources instead of hardcoding
This commit is contained in:
ShirkNeko
2025-03-23 10:36:10 +08:00
parent 82edd46e0e
commit cca608954a
5 changed files with 25 additions and 37 deletions

View File

@@ -508,33 +508,25 @@ fun rememberSelectKmiDialog(onSelected: (String?) -> Unit): DialogHandle {
val supportedKmi by produceState(initialValue = emptyList<String>()) {
value = getSupportedKmis()
}
val options = supportedKmi.map { value ->
ListOption(titleText = value)
ListOption(
titleText = value
)
}
var selection by remember { mutableStateOf<String?>(null) }
ListDialog(
state = rememberUseCaseState(
visible = true,
onFinishedRequest = {
onSelected(selection)
},
onCloseRequest = {
dismiss()
}
),
header = Header.Default(
title = stringResource(R.string.select_kmi),
),
selection = ListSelection.Single(
showRadioButtons = true,
options = options,
) { _, option ->
selection = option.titleText
}
)
ListDialog(state = rememberUseCaseState(visible = true, onFinishedRequest = {
onSelected(selection)
}, onCloseRequest = {
dismiss()
}), header = Header.Default(
title = stringResource(R.string.select_kmi),
), selection = ListSelection.Single(
showRadioButtons = true,
options = options,
) { _, option ->
selection = option.titleText
})
}
}

View File

@@ -313,7 +313,7 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
leadingIcon = {
Icon(
imageVector = Icons.Outlined.Download,
contentDescription = "备份"
contentDescription = stringResource(R.string.backup)
)
},
onClick = {
@@ -326,7 +326,7 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
leadingIcon = {
Icon(
imageVector = Icons.Outlined.Refresh,
contentDescription = "还原"
contentDescription = stringResource(R.string.restore)
)
},
onClick = {

View File

@@ -106,7 +106,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
viewModel.showSystemApps = !viewModel.showSystemApps
showDropdown = false
})
// 批量操作菜单项已移除
DropdownMenuItem(text = {
Text(stringResource(R.string.backup_allowlist))
}, onClick = {
@@ -144,7 +143,7 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
}
}
) {
Text("批量授权")
Text(stringResource(R.string.batch_authorization))
}
Button(
@@ -154,7 +153,7 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
}
}
) {
Text("批量取消授权")
Text(stringResource(R.string.batch_cancel_authorization))
}
}
}
@@ -180,9 +179,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
// 显示ROOT权限应用组
if (rootApps.isNotEmpty()) {
item {
GroupHeader(title = "ROOT 权限应用")
}
items(rootApps, key = { "root_" + it.packageName + it.uid }) { app ->
AppItem(
app = app,
@@ -218,9 +214,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
// 显示自定义配置应用组
if (customApps.isNotEmpty()) {
item {
GroupHeader(title = "自定义配置应用")
}
items(customApps, key = { "custom_" + it.packageName + it.uid }) { app ->
AppItem(
app = app,
@@ -256,9 +249,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
// 显示其他应用组
if (otherApps.isNotEmpty()) {
item {
GroupHeader(title = "其他应用")
}
items(otherApps, key = { "other_" + it.packageName + it.uid }) { app ->
AppItem(
app = app,

View File

@@ -153,6 +153,7 @@
<string name="backup_failed">备份失败:%1$s</string>
<string name="backup_modules">备份模块</string>
<string name="restore_modules">恢复模块</string>
<string name="backup">备份</string>
<!-- Restore related messages -->
<string name="restore_success">模块已成功还原,需重启生效</string>
<string name="restore_failed">还原失败:%1$s</string>
@@ -214,4 +215,6 @@
<string name="yes"></string>
<string name="no"></string>
<string name="failed_reboot">重启失败</string>
<string name="batch_authorization">批量授权</string>
<string name="batch_cancel_authorization">批量取消授权</string>
</resources>

View File

@@ -216,4 +216,7 @@
<string name="yes">yes</string>
<string name="no">no</string>
<string name="failed_reboot">Reboot Failed</string>
<string name="batch_authorization">bulk license</string>
<string name="batch_cancel_authorization">Batch cancel authorization</string>
<string name="backup">Backup</string>
</resources>