Merge pull request #22 from WenHao2130/wenhao-patch-1
[wip]manager: allow hide kernelsu version
This commit is contained in:
@@ -58,12 +58,18 @@ import androidx.core.content.edit
|
|||||||
fun HomeScreen(navigator: DestinationsNavigator) {
|
fun HomeScreen(navigator: DestinationsNavigator) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
var isSimpleMode by rememberSaveable { mutableStateOf(false) }
|
var isSimpleMode by rememberSaveable { mutableStateOf(false) }
|
||||||
|
var isHideVersion by rememberSaveable { mutableStateOf(false) }
|
||||||
|
|
||||||
// 从 SharedPreferences 加载简洁模式状态
|
// 从 SharedPreferences 加载简洁模式状态
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
isSimpleMode = context.getSharedPreferences("settings", Context.MODE_PRIVATE)
|
isSimpleMode = context.getSharedPreferences("settings", Context.MODE_PRIVATE)
|
||||||
.getBoolean("is_simple_mode", false)
|
.getBoolean("is_simple_mode", false)
|
||||||
}
|
}
|
||||||
|
// 从 SharedPreferences 加载隐藏 KernelSU 版本号开关状态
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
isHideVersion = context.getSharedPreferences("settings", Context.MODE_PRIVATE)
|
||||||
|
.getBoolean("is_hide_version", false)
|
||||||
|
}
|
||||||
val kernelVersion = getKernelVersion()
|
val kernelVersion = getKernelVersion()
|
||||||
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState())
|
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState())
|
||||||
|
|
||||||
@@ -299,17 +305,22 @@ private fun StatusCard(
|
|||||||
val workingText =
|
val workingText =
|
||||||
"${stringResource(id = R.string.home_working)}$workingMode$safeMode"
|
"${stringResource(id = R.string.home_working)}$workingMode$safeMode"
|
||||||
|
|
||||||
|
val isHideVersion = LocalContext.current.getSharedPreferences("settings", Context.MODE_PRIVATE)
|
||||||
|
.getBoolean("is_hide_version", false)
|
||||||
|
|
||||||
Icon(Icons.Outlined.CheckCircle, stringResource(R.string.home_working))
|
Icon(Icons.Outlined.CheckCircle, stringResource(R.string.home_working))
|
||||||
Column(Modifier.padding(start = 20.dp)) {
|
Column(Modifier.padding(start = 20.dp)) {
|
||||||
Text(
|
Text(
|
||||||
text = workingText,
|
text = workingText,
|
||||||
style = MaterialTheme.typography.titleMedium
|
style = MaterialTheme.typography.titleMedium
|
||||||
)
|
)
|
||||||
Spacer(Modifier.height(4.dp))
|
if (!isHideVersion) {
|
||||||
Text(
|
Spacer(Modifier.height(4.dp))
|
||||||
text = stringResource(R.string.home_working_version, ksuVersion),
|
Text(
|
||||||
style = MaterialTheme.typography.bodyMedium
|
text = stringResource(R.string.home_working_version, ksuVersion),
|
||||||
)
|
style = MaterialTheme.typography.bodyMedium
|
||||||
|
)
|
||||||
|
}
|
||||||
Spacer(Modifier.height(4.dp))
|
Spacer(Modifier.height(4.dp))
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(
|
text = stringResource(
|
||||||
|
|||||||
@@ -104,6 +104,17 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
isSimpleMode = newValue
|
isSimpleMode = newValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 隐藏内核 KernelSU 版本号开关状态
|
||||||
|
var isHideVersion by remember {
|
||||||
|
mutableStateOf(prefs.getBoolean("is_hide_version", false))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 隐藏内核 KernelSU 版本号模块开关状态
|
||||||
|
val onHideVersionChange = { newValue: Boolean ->
|
||||||
|
prefs.edit { putBoolean("is_hide_version", newValue) }
|
||||||
|
isHideVersion = newValue
|
||||||
|
}
|
||||||
|
|
||||||
// SELinux 状态
|
// SELinux 状态
|
||||||
var selinuxEnabled by remember {
|
var selinuxEnabled by remember {
|
||||||
mutableStateOf(Shell.cmd("getenforce").exec().out.firstOrNull() == "Enforcing")
|
mutableStateOf(Shell.cmd("getenforce").exec().out.firstOrNull() == "Enforcing")
|
||||||
@@ -209,6 +220,16 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
onSimpleModeChange(it)
|
onSimpleModeChange(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 隐藏内核部分版本号
|
||||||
|
SwitchItem(
|
||||||
|
icon = Icons.Filled.FormatPaint,
|
||||||
|
title = stringResource(R.string.hide_kernel_kernelsu_version),
|
||||||
|
summary = stringResource(R.string.hide_kernel_kernelsu_version_summary),
|
||||||
|
checked = isHideVersion
|
||||||
|
) {
|
||||||
|
onHideVersionChange(it)
|
||||||
|
}
|
||||||
|
|
||||||
// region SUSFS 配置(仅在支持时显示)
|
// region SUSFS 配置(仅在支持时显示)
|
||||||
val suSFS = getSuSFS()
|
val suSFS = getSuSFS()
|
||||||
val isSUS_SU = getSuSFSFeatures()
|
val isSUS_SU = getSuSFSFeatures()
|
||||||
|
|||||||
@@ -189,6 +189,8 @@
|
|||||||
<string name="selinux_disabled">宽容模式</string>
|
<string name="selinux_disabled">宽容模式</string>
|
||||||
<string name="simple_mode">简洁模式</string>
|
<string name="simple_mode">简洁模式</string>
|
||||||
<string name="simple_mode_summary">开启后将隐藏不必要的卡片</string>
|
<string name="simple_mode_summary">开启后将隐藏不必要的卡片</string>
|
||||||
|
<string name="hide_kernel_kernelsu_version">隐藏内核版本号</string>
|
||||||
|
<string name="hide_kernel_kernelsu_version_summary">隐藏内核部分的 KernelSU 版本号</string>
|
||||||
<string name="theme_mode">主题模式</string>
|
<string name="theme_mode">主题模式</string>
|
||||||
<string name="theme_follow_system">跟随系统</string>
|
<string name="theme_follow_system">跟随系统</string>
|
||||||
<string name="theme_light">浅色</string>
|
<string name="theme_light">浅色</string>
|
||||||
|
|||||||
@@ -190,6 +190,8 @@
|
|||||||
<string name="selinux_disabled">Disabled</string>
|
<string name="selinux_disabled">Disabled</string>
|
||||||
<string name="simple_mode">simplicity mode</string>
|
<string name="simple_mode">simplicity mode</string>
|
||||||
<string name="simple_mode_summary">Hides unnecessary cards when turned on</string>
|
<string name="simple_mode_summary">Hides unnecessary cards when turned on</string>
|
||||||
|
<string name="hide_kernel_kernelsu_version">Hide kernel version</string>
|
||||||
|
<string name="hide_kernel_kernelsu_version_summary">ide kernel version</string>
|
||||||
<string name="theme_mode">Theme Mode</string>
|
<string name="theme_mode">Theme Mode</string>
|
||||||
<string name="theme_follow_system">follow-up system</string>
|
<string name="theme_follow_system">follow-up system</string>
|
||||||
<string name="theme_light">light color</string>
|
<string name="theme_light">light color</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user