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
Improve StatusCard and fix WX wrappers of WebUI X (#393)
* manager: bump mmrl to 1998c70b77 * manager: improve StatusCard
This commit is contained in:
@@ -29,9 +29,14 @@ import androidx.compose.ui.platform.LocalContext
|
|||||||
import androidx.compose.ui.platform.LocalUriHandler
|
import androidx.compose.ui.platform.LocalUriHandler
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.intl.Locale
|
||||||
|
import androidx.compose.ui.text.toUpperCase
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.core.content.pm.PackageInfoCompat
|
import androidx.core.content.pm.PackageInfoCompat
|
||||||
|
import com.dergoogler.mmrl.ui.component.LabelItem
|
||||||
|
import com.dergoogler.mmrl.ui.component.LabelItemDefaults
|
||||||
|
import com.dergoogler.mmrl.ui.component.text.TextRow
|
||||||
import com.ramcosta.composedestinations.annotation.Destination
|
import com.ramcosta.composedestinations.annotation.Destination
|
||||||
import com.ramcosta.composedestinations.annotation.RootGraph
|
import com.ramcosta.composedestinations.annotation.RootGraph
|
||||||
// import com.ramcosta.composedestinations.generated.destinations.InstallScreenDestination // DISBAND LKM MODE
|
// import com.ramcosta.composedestinations.generated.destinations.InstallScreenDestination // DISBAND LKM MODE
|
||||||
@@ -197,7 +202,8 @@ private fun TopBar(
|
|||||||
}) {
|
}) {
|
||||||
RebootDropdownItem(id = R.string.reboot)
|
RebootDropdownItem(id = R.string.reboot)
|
||||||
|
|
||||||
val pm = LocalContext.current.getSystemService(Context.POWER_SERVICE) as PowerManager?
|
val pm =
|
||||||
|
LocalContext.current.getSystemService(Context.POWER_SERVICE) as PowerManager?
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && pm?.isRebootingUserspaceSupported == true) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && pm?.isRebootingUserspaceSupported == true) {
|
||||||
RebootDropdownItem(id = R.string.reboot_userspace, reason = "userspace")
|
RebootDropdownItem(id = R.string.reboot_userspace, reason = "userspace")
|
||||||
@@ -240,59 +246,80 @@ private fun StatusCard(
|
|||||||
else MaterialTheme.colorScheme.errorContainer
|
else MaterialTheme.colorScheme.errorContainer
|
||||||
})
|
})
|
||||||
) {
|
) {
|
||||||
Row(modifier = Modifier
|
Row(
|
||||||
.fillMaxWidth()
|
modifier = Modifier
|
||||||
.clickable {
|
.fillMaxWidth()
|
||||||
if (kernelVersion.isGKI()) {
|
.clickable {
|
||||||
onClickInstall()
|
if (kernelVersion.isGKI()) {
|
||||||
|
onClickInstall()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
.padding(24.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||||
.padding(24.dp), verticalAlignment = Alignment.CenterVertically) {
|
|
||||||
when {
|
when {
|
||||||
ksuVersion != null -> {
|
ksuVersion != null -> {
|
||||||
val safeMode = when {
|
|
||||||
Natives.isSafeMode -> " [${stringResource(id = R.string.safe_mode)}]"
|
|
||||||
else -> ""
|
|
||||||
}
|
|
||||||
|
|
||||||
val workingMode = when {
|
val workingMode = when {
|
||||||
lkmMode == true -> " <LKM>"
|
lkmMode == true -> "LKM"
|
||||||
lkmMode == false || kernelVersion.isGKI() -> " <GKI2>"
|
lkmMode == false || kernelVersion.isGKI() -> "GKI2"
|
||||||
lkmMode == null && kernelVersion.isULegacy() -> " <U-LEGACY>"
|
lkmMode == null && kernelVersion.isULegacy() -> "U-LEGACY"
|
||||||
lkmMode == null && kernelVersion.isLegacy() -> " <LEGACY>"
|
lkmMode == null && kernelVersion.isLegacy() -> "LEGACY"
|
||||||
lkmMode == null && kernelVersion.isGKI1() -> " <GKI1>"
|
lkmMode == null && kernelVersion.isGKI1() -> "GKI1"
|
||||||
else -> " <NON-STANDARD>"
|
else -> "NON-STANDARD"
|
||||||
}
|
}
|
||||||
|
|
||||||
val workingText =
|
|
||||||
"${stringResource(id = R.string.home_working)}$workingMode$safeMode"
|
|
||||||
|
|
||||||
Icon(
|
Icon(
|
||||||
getSeasonalIcon(), // Use dynamic seasonal icon
|
getSeasonalIcon(), // Use dynamic seasonal icon
|
||||||
contentDescription = stringResource(R.string.home_working)
|
contentDescription = stringResource(R.string.home_working)
|
||||||
)
|
)
|
||||||
Column(Modifier.padding(start = 20.dp)) {
|
Column(
|
||||||
Text(
|
modifier = Modifier.padding(start = 20.dp),
|
||||||
text = workingText,
|
verticalArrangement = Arrangement.spacedBy(4.dp)
|
||||||
style = MaterialTheme.typography.titleMedium
|
) {
|
||||||
)
|
val labelStyle = LabelItemDefaults.style
|
||||||
Spacer(Modifier.height(4.dp))
|
TextRow(
|
||||||
|
trailingContent = {
|
||||||
|
LabelItem(
|
||||||
|
icon = if (Natives.isSafeMode) {
|
||||||
|
{
|
||||||
|
Icon(
|
||||||
|
tint = labelStyle.contentColor,
|
||||||
|
imageVector = Icons.Filled.Security,
|
||||||
|
contentDescription = null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
},
|
||||||
|
text = {
|
||||||
|
Text(
|
||||||
|
text = workingMode,
|
||||||
|
style = labelStyle.textStyle.copy(color = labelStyle.contentColor),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(id = R.string.home_working),
|
||||||
|
style = MaterialTheme.typography.titleMedium
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_working_version, ksuVersion),
|
text = stringResource(R.string.home_working_version, ksuVersion),
|
||||||
style = MaterialTheme.typography.bodyMedium
|
style = MaterialTheme.typography.bodyMedium
|
||||||
)
|
)
|
||||||
Spacer(Modifier.height(4.dp))
|
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(
|
text = stringResource(
|
||||||
R.string.home_superuser_count, getSuperuserCount()
|
R.string.home_superuser_count, getSuperuserCount()
|
||||||
), style = MaterialTheme.typography.bodyMedium
|
), style = MaterialTheme.typography.bodyMedium
|
||||||
)
|
)
|
||||||
Spacer(Modifier.height(4.dp))
|
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_module_count, getModuleCount()),
|
text = stringResource(R.string.home_module_count, getModuleCount()),
|
||||||
style = MaterialTheme.typography.bodyMedium
|
style = MaterialTheme.typography.bodyMedium
|
||||||
)
|
)
|
||||||
Spacer(Modifier.height(4.dp))
|
|
||||||
val suSFS = getSuSFS()
|
val suSFS = getSuSFS()
|
||||||
if (suSFS == "Supported") {
|
if (suSFS == "Supported") {
|
||||||
Text(
|
Text(
|
||||||
@@ -395,6 +422,7 @@ private fun InfoCard() {
|
|||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
modifier = Modifier.padding(end = 20.dp)
|
modifier = Modifier.padding(end = 20.dp)
|
||||||
)
|
)
|
||||||
|
|
||||||
is Painter -> Icon(
|
is Painter -> Icon(
|
||||||
painter = icon,
|
painter = icon,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
@@ -414,7 +442,7 @@ private fun InfoCard() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -430,7 +458,7 @@ private fun InfoCard() {
|
|||||||
content = "${Build.VERSION.RELEASE} (${Build.VERSION.SDK_INT})",
|
content = "${Build.VERSION.RELEASE} (${Build.VERSION.SDK_INT})",
|
||||||
icon = Icons.Filled.Android,
|
icon = Icons.Filled.Android,
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(Modifier.height(16.dp))
|
Spacer(Modifier.height(16.dp))
|
||||||
val managerVersion = getManagerVersion(context)
|
val managerVersion = getManagerVersion(context)
|
||||||
@@ -460,13 +488,14 @@ private fun InfoCard() {
|
|||||||
content = currentMountSystem().ifEmpty { stringResource(R.string.unavailable) },
|
content = currentMountSystem().ifEmpty { stringResource(R.string.unavailable) },
|
||||||
icon = Icons.Filled.SettingsSuggest,
|
icon = Icons.Filled.SettingsSuggest,
|
||||||
)
|
)
|
||||||
|
|
||||||
val suSFS = getSuSFS()
|
val suSFS = getSuSFS()
|
||||||
if (suSFS == "Supported") {
|
if (suSFS == "Supported") {
|
||||||
val isSUS_SU = getSuSFSFeatures() == "CONFIG_KSU_SUSFS_SUS_SU"
|
val isSUS_SU = getSuSFSFeatures() == "CONFIG_KSU_SUSFS_SUS_SU"
|
||||||
val susSUMode = if (isSUS_SU) {
|
val susSUMode = if (isSUS_SU) {
|
||||||
val mode = susfsSUS_SU_Mode()
|
val mode = susfsSUS_SU_Mode()
|
||||||
val modeString = if (mode == "2") stringResource(R.string.enabled) else stringResource(R.string.disabled)
|
val modeString =
|
||||||
|
if (mode == "2") stringResource(R.string.enabled) else stringResource(R.string.disabled)
|
||||||
"| SuS SU: $modeString"
|
"| SuS SU: $modeString"
|
||||||
} else ""
|
} else ""
|
||||||
Spacer(Modifier.height(16.dp))
|
Spacer(Modifier.height(16.dp))
|
||||||
@@ -487,12 +516,13 @@ fun NextCard() {
|
|||||||
|
|
||||||
ElevatedCard {
|
ElevatedCard {
|
||||||
|
|
||||||
Row(modifier = Modifier
|
Row(
|
||||||
.fillMaxWidth()
|
modifier = Modifier
|
||||||
.clickable {
|
.fillMaxWidth()
|
||||||
uriHandler.openUri(url)
|
.clickable {
|
||||||
}
|
uriHandler.openUri(url)
|
||||||
.padding(24.dp), verticalAlignment = Alignment.CenterVertically) {
|
}
|
||||||
|
.padding(24.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||||
Column {
|
Column {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_next_kernelsu),
|
text = stringResource(R.string.home_next_kernelsu),
|
||||||
@@ -516,13 +546,15 @@ fun EXperimentalCard() {
|
|||||||
|
|
||||||
ElevatedCard {
|
ElevatedCard {
|
||||||
|
|
||||||
Row(modifier = Modifier
|
Row(
|
||||||
.fillMaxWidth()
|
modifier = Modifier
|
||||||
/*.clickable {
|
.fillMaxWidth()
|
||||||
uriHandler.openUri(url)
|
/*.clickable {
|
||||||
}
|
uriHandler.openUri(url)
|
||||||
*/
|
}
|
||||||
.padding(24.dp), verticalAlignment = Alignment.CenterVertically) {
|
*/
|
||||||
|
.padding(24.dp), verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
Column {
|
Column {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_experimental_kernelsu),
|
text = stringResource(R.string.home_experimental_kernelsu),
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ parcelablelist = "2.0.1"
|
|||||||
libsu = "6.0.0"
|
libsu = "6.0.0"
|
||||||
apksign = "1.4"
|
apksign = "1.4"
|
||||||
cmaker = "1.2"
|
cmaker = "1.2"
|
||||||
mmrl = "346470abb8"
|
mmrl = "1998c70b77"
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
agp-app = { id = "com.android.application", version.ref = "agp" }
|
agp-app = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
|||||||
Reference in New Issue
Block a user