manager: Refactored SuSFS pop-up window and changed to interface to optimize visual experience

This commit is contained in:
ShirkNeko
2025-06-15 01:32:38 +08:00
parent ef4101cbf9
commit 7b314116e9
5 changed files with 1757 additions and 1588 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,6 @@
package zako.zako.zako.zakoui.screen
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.content.res.Configuration
@@ -63,7 +62,6 @@ import com.sukisu.ultra.Natives
import com.sukisu.ultra.R
import com.sukisu.ultra.ui.component.ImageEditorDialog
import com.sukisu.ultra.ui.component.KsuIsValid
import com.sukisu.ultra.ui.component.SuSFSConfigDialog
import com.sukisu.ultra.ui.theme.CardConfig.cardElevation
import com.sukisu.ultra.ui.theme.*
import com.sukisu.ultra.ui.util.*
@@ -91,6 +89,7 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.unit.sp
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
import com.sukisu.ultra.ksuApp
import com.ramcosta.composedestinations.generated.destinations.SuSFSConfigScreenDestination
/**
* @author ShirkNeko
@@ -146,7 +145,6 @@ fun MoreSettingsScreen(
var showThemeColorDialog by remember { mutableStateOf(false) }
var showDpiConfirmDialog by remember { mutableStateOf(false) }
var showImageEditor by remember { mutableStateOf(false) }
var showSuSFSConfigDialog by remember { mutableStateOf(false) }
// 主题模式选项
val themeOptions = listOf(
@@ -477,13 +475,6 @@ fun MoreSettingsScreen(
)
}
// SuSFS配置对话框
if (showSuSFSConfigDialog) {
SuSFSConfigDialog(
onDismiss = { showSuSFSConfigDialog = false }
)
}
// 主题模式选择对话框
if (showThemeModeDialog) {
SingleChoiceDialog(
@@ -1096,38 +1087,38 @@ fun MoreSettingsScreen(
title = stringResource(R.string.advanced_settings)
) {
// SELinux 开关
SwitchSettingItem(
icon = Icons.Filled.Security,
title = stringResource(R.string.selinux),
summary = if (selinuxEnabled)
stringResource(R.string.selinux_enabled) else
stringResource(R.string.selinux_disabled),
checked = selinuxEnabled,
onChange = { enabled ->
val command = if (enabled) "setenforce 1" else "setenforce 0"
Shell.getShell().newJob().add(command).exec().let { result ->
if (result.isSuccess) {
selinuxEnabled = enabled
// 显示成功提示
val message = if (enabled)
context.getString(R.string.selinux_enabled_toast)
else
context.getString(R.string.selinux_disabled_toast)
SwitchSettingItem(
icon = Icons.Filled.Security,
title = stringResource(R.string.selinux),
summary = if (selinuxEnabled)
stringResource(R.string.selinux_enabled) else
stringResource(R.string.selinux_disabled),
checked = selinuxEnabled,
onChange = { enabled ->
val command = if (enabled) "setenforce 1" else "setenforce 0"
Shell.getShell().newJob().add(command).exec().let { result ->
if (result.isSuccess) {
selinuxEnabled = enabled
// 显示成功提示
val message = if (enabled)
context.getString(R.string.selinux_enabled_toast)
else
context.getString(R.string.selinux_disabled_toast)
Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
} else {
// 显示失败提示
Toast.makeText(
context,
context.getString(R.string.selinux_change_failed),
Toast.LENGTH_SHORT
).show()
}
Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
} else {
// 显示失败提示
Toast.makeText(
context,
context.getString(R.string.selinux_change_failed),
Toast.LENGTH_SHORT
).show()
}
}
)
}
)
// SuSFS 配置(仅在支持时显示
// SuSFS 配置(仅在支持时显示)
if (getSuSFS() == "Supported" && SuSFSManager.isBinaryAvailable(context)) {
SettingItem(
icon = Icons.Default.Settings,
@@ -1136,7 +1127,9 @@ fun MoreSettingsScreen(
R.string.susfs_config_setting_summary,
SuSFSManager.getUnameValue(context)
),
onClick = { showSuSFSConfigDialog = true }
onClick = {
navigator.navigate(SuSFSConfigScreenDestination)
}
)
}

View File

@@ -500,11 +500,5 @@
<string name="hide_symbols_feature_label">隐藏 KSU SUSFS 符号</string>
<string name="magic_mount_feature_label">魔法坐骑支持</string>
<string name="overlayfs_auto_kstat_feature_label">OverlayFS 自动内核统计支持</string>
<string name="sus_kstat_feature_label">SUS Kstat Support</string>
<!-- Content Descriptions for Accessibility -->
<string name="susfs_add_button_description">添加新项目</string>
<string name="susfs_run_button_description">运行卸载操作</string>
<string name="susfs_delete_button_description">删除项目</string>
<string name="susfs_reset_section_description">重置此部分</string>
<string name="susfs_refresh_button_description">刷新功能状态</string>
<string name="sus_kstat_feature_label">SUS Kstat 支持</string>
</resources>

View File

@@ -503,10 +503,4 @@
<string name="magic_mount_feature_label">Magic Mount Support</string>
<string name="overlayfs_auto_kstat_feature_label">OverlayFS Auto Kernel Stat Support</string>
<string name="sus_kstat_feature_label">SUS Kstat Support</string>
<!-- Content Descriptions for Accessibility -->
<string name="susfs_add_button_description">Add new item</string>
<string name="susfs_run_button_description">Run umount operations</string>
<string name="susfs_delete_button_description">Delete item</string>
<string name="susfs_reset_section_description">Reset this section</string>
<string name="susfs_refresh_button_description">Refresh feature status</string>
</resources>