You've already forked KernelSU-Next
mirror of
https://github.com/KernelSU-Next/KernelSU-Next.git
synced 2025-08-27 23:46:34 +00:00
manager: redesign/rearrange home infocard
This commit is contained in:
@@ -409,110 +409,127 @@ private fun InfoCard() {
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(start = 24.dp, top = 24.dp, end = 24.dp, bottom = 16.dp)
|
.padding(start = 24.dp, top = 24.dp, end = 24.dp, bottom = 16.dp)
|
||||||
) {
|
) {
|
||||||
val contents = StringBuilder()
|
var expanded by rememberSaveable { mutableStateOf(false) }
|
||||||
val uname = Os.uname()
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun InfoCardItem(label: String, content: String, icon: Any? = null) {
|
fun InfoCardItem(label: String, content: String, icon: Any? = null) {
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
if (icon != null) {
|
if (icon != null) {
|
||||||
when (icon) {
|
when (icon) {
|
||||||
is ImageVector -> Icon(
|
is ImageVector -> Icon(
|
||||||
imageVector = icon,
|
imageVector = icon,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
modifier = Modifier.padding(end = 20.dp)
|
modifier = Modifier.padding(end = 20.dp)
|
||||||
)
|
)
|
||||||
|
is Painter -> Icon(
|
||||||
|
painter = icon,
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.padding(end = 20.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Column {
|
||||||
|
Text(
|
||||||
|
text = label,
|
||||||
|
style = MaterialTheme.typography.bodyLarge
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = content,
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
modifier = Modifier.padding(top = 4.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
is Painter -> Icon(
|
Column {
|
||||||
painter = icon,
|
val managerVersion = getManagerVersion(context)
|
||||||
contentDescription = null,
|
InfoCardItem(
|
||||||
modifier = Modifier.padding(end = 20.dp)
|
label = stringResource(R.string.home_manager_version),
|
||||||
)
|
content = "${managerVersion.first} (${managerVersion.second})",
|
||||||
}
|
icon = painterResource(R.drawable.ic_ksu_next),
|
||||||
}
|
)
|
||||||
Column {
|
|
||||||
Text(
|
if (Natives.version >= Natives.MINIMAL_SUPPORTED_HOOK_MODE) {
|
||||||
text = label,
|
Spacer(Modifier.height(16.dp))
|
||||||
style = MaterialTheme.typography.bodyLarge
|
InfoCardItem(
|
||||||
)
|
label = stringResource(R.string.hook_mode),
|
||||||
Text(
|
content = Natives.getHookMode() ?: stringResource(R.string.unavailable),
|
||||||
text = content,
|
icon = Icons.Filled.Phishing,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
)
|
||||||
modifier = Modifier.padding(top = 4.dp)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
InfoCardItem(
|
|
||||||
label = stringResource(R.string.home_kernel),
|
|
||||||
content = "${uname.release} (${uname.machine})",
|
|
||||||
icon = painterResource(R.drawable.ic_linux),
|
|
||||||
)
|
|
||||||
|
|
||||||
if (Natives.version >= Natives.MINIMAL_SUPPORTED_HOOK_MODE) {
|
|
||||||
Spacer(Modifier.height(16.dp))
|
Spacer(Modifier.height(16.dp))
|
||||||
InfoCardItem(
|
InfoCardItem(
|
||||||
label = stringResource(R.string.hook_mode),
|
label = stringResource(R.string.home_mount_system),
|
||||||
content = Natives.getHookMode() ?: stringResource(R.string.unavailable),
|
content = currentMountSystem().ifEmpty { stringResource(R.string.unavailable) },
|
||||||
icon = Icons.Filled.Phishing,
|
icon = Icons.Filled.SettingsSuggest,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val suSFS = getSuSFS()
|
||||||
|
if (suSFS == "Supported") {
|
||||||
|
val isSUS_SU = getSuSFSFeatures() == "CONFIG_KSU_SUSFS_SUS_SU"
|
||||||
|
val susSUMode = if (isSUS_SU) {
|
||||||
|
val mode = susfsSUS_SU_Mode()
|
||||||
|
val modeString =
|
||||||
|
if (mode == "2") stringResource(R.string.enabled) else stringResource(R.string.disabled)
|
||||||
|
"| SuS SU: $modeString"
|
||||||
|
} else ""
|
||||||
|
Spacer(Modifier.height(16.dp))
|
||||||
|
InfoCardItem(
|
||||||
|
label = stringResource(R.string.home_susfs_version),
|
||||||
|
content = "${getSuSFSVersion()} (${getSuSFSVariant()}) $susSUMode",
|
||||||
|
icon = painterResource(R.drawable.ic_sus),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(Modifier.height(16.dp))
|
if (!expanded) {
|
||||||
InfoCardItem(
|
Spacer(Modifier.height(12.dp))
|
||||||
label = stringResource(R.string.home_android),
|
Row(
|
||||||
content = "${Build.VERSION.RELEASE} (${Build.VERSION.SDK_INT})",
|
modifier = Modifier
|
||||||
icon = Icons.Filled.Android,
|
.fillMaxWidth()
|
||||||
|
.clickable { expanded = true },
|
||||||
|
horizontalArrangement = Arrangement.Center
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Filled.KeyboardArrowDown,
|
||||||
|
contentDescription = "Show more"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
)
|
AnimatedVisibility(visible = expanded) {
|
||||||
|
val uname = Os.uname()
|
||||||
|
Column {
|
||||||
|
Spacer(Modifier.height(16.dp))
|
||||||
|
InfoCardItem(
|
||||||
|
label = stringResource(R.string.home_kernel),
|
||||||
|
content = "${uname.release} (${uname.machine})",
|
||||||
|
icon = painterResource(R.drawable.ic_linux),
|
||||||
|
)
|
||||||
|
|
||||||
Spacer(Modifier.height(16.dp))
|
Spacer(Modifier.height(16.dp))
|
||||||
val managerVersion = getManagerVersion(context)
|
InfoCardItem(
|
||||||
InfoCardItem(
|
label = stringResource(R.string.home_android),
|
||||||
label = stringResource(R.string.home_manager_version),
|
content = "${Build.VERSION.RELEASE} (${Build.VERSION.SDK_INT})",
|
||||||
content = "${managerVersion.first} (${managerVersion.second})",
|
icon = Icons.Filled.Android,
|
||||||
icon = painterResource(R.drawable.ic_ksu_next),
|
)
|
||||||
)
|
|
||||||
|
|
||||||
Spacer(Modifier.height(16.dp))
|
Spacer(Modifier.height(16.dp))
|
||||||
InfoCardItem(
|
InfoCardItem(
|
||||||
label = stringResource(R.string.home_abi),
|
label = stringResource(R.string.home_abi),
|
||||||
content = Build.SUPPORTED_ABIS.joinToString(", "),
|
content = Build.SUPPORTED_ABIS.joinToString(", "),
|
||||||
icon = Icons.Filled.Memory,
|
icon = Icons.Filled.Memory,
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(Modifier.height(16.dp))
|
Spacer(Modifier.height(16.dp))
|
||||||
InfoCardItem(
|
InfoCardItem(
|
||||||
label = stringResource(R.string.home_selinux_status),
|
label = stringResource(R.string.home_selinux_status),
|
||||||
content = getSELinuxStatus(),
|
content = getSELinuxStatus(),
|
||||||
icon = Icons.Filled.Security,
|
icon = Icons.Filled.Security,
|
||||||
)
|
)
|
||||||
|
}
|
||||||
Spacer(Modifier.height(16.dp))
|
|
||||||
InfoCardItem(
|
|
||||||
label = stringResource(R.string.home_mount_system),
|
|
||||||
content = currentMountSystem().ifEmpty { stringResource(R.string.unavailable) },
|
|
||||||
icon = Icons.Filled.SettingsSuggest,
|
|
||||||
)
|
|
||||||
|
|
||||||
val suSFS = getSuSFS()
|
|
||||||
if (suSFS == "Supported") {
|
|
||||||
val isSUS_SU = getSuSFSFeatures() == "CONFIG_KSU_SUSFS_SUS_SU"
|
|
||||||
val susSUMode = if (isSUS_SU) {
|
|
||||||
val mode = susfsSUS_SU_Mode()
|
|
||||||
val modeString =
|
|
||||||
if (mode == "2") stringResource(R.string.enabled) else stringResource(R.string.disabled)
|
|
||||||
"| SuS SU: $modeString"
|
|
||||||
} else ""
|
|
||||||
Spacer(Modifier.height(16.dp))
|
|
||||||
InfoCardItem(
|
|
||||||
label = stringResource(R.string.home_susfs_version),
|
|
||||||
content = "${getSuSFSVersion()} (${getSuSFSVariant()}) $susSUMode",
|
|
||||||
icon = painterResource(R.drawable.ic_sus),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user