manager: Optimize the logic of displaying the Machine Architecture tab of the home status card
Fix the problem of displaying text in safe mode
This commit is contained in:
@@ -366,15 +366,6 @@ private fun TopBar(
|
|||||||
scrolledContainerColor = cardColor.copy(alpha = cardAlpha)
|
scrolledContainerColor = cardColor.copy(alpha = cardAlpha)
|
||||||
),
|
),
|
||||||
actions = {
|
actions = {
|
||||||
if (rootAvailable() || kernelVersion.isGKI()) {
|
|
||||||
IconButton(onClick = onInstallClick) {
|
|
||||||
Icon(
|
|
||||||
Icons.Filled.Archive,
|
|
||||||
contentDescription = stringResource(R.string.install),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var showDropdown by remember { mutableStateOf(false) }
|
var showDropdown by remember { mutableStateOf(false) }
|
||||||
KsuIsValid {
|
KsuIsValid {
|
||||||
IconButton(onClick = {
|
IconButton(onClick = {
|
||||||
@@ -440,10 +431,6 @@ private fun StatusCard(
|
|||||||
) {
|
) {
|
||||||
when {
|
when {
|
||||||
ksuVersion != null -> {
|
ksuVersion != null -> {
|
||||||
val safeMode = when {
|
|
||||||
Natives.isSafeMode -> " [${stringResource(id = R.string.safe_mode)}]"
|
|
||||||
else -> ""
|
|
||||||
}
|
|
||||||
|
|
||||||
val workingModeText = when {
|
val workingModeText = when {
|
||||||
lkmMode == true -> "LKM"
|
lkmMode == true -> "LKM"
|
||||||
@@ -493,7 +480,13 @@ private fun StatusCard(
|
|||||||
|
|
||||||
Spacer(Modifier.width(6.dp))
|
Spacer(Modifier.width(6.dp))
|
||||||
|
|
||||||
// 机器架构标签
|
// 机器架构标签或者安全模式标签
|
||||||
|
val labelText = if (Natives.isSafeMode) {
|
||||||
|
stringResource(id = R.string.safe_mode)
|
||||||
|
} else {
|
||||||
|
Os.uname().machine
|
||||||
|
}
|
||||||
|
|
||||||
Surface(
|
Surface(
|
||||||
shape = RoundedCornerShape(4.dp),
|
shape = RoundedCornerShape(4.dp),
|
||||||
color = MaterialTheme.colorScheme.primary,
|
color = MaterialTheme.colorScheme.primary,
|
||||||
@@ -505,19 +498,12 @@ private fun StatusCard(
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = Os.uname().machine,
|
text = labelText,
|
||||||
style = MaterialTheme.typography.labelMedium,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
color = MaterialTheme.colorScheme.onSecondary,
|
color = MaterialTheme.colorScheme.onSecondary,
|
||||||
modifier = Modifier.padding(horizontal = 6.dp, vertical = 2.dp)
|
modifier = Modifier.padding(horizontal = 6.dp, vertical = 2.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (safeMode.isNotEmpty()) {
|
|
||||||
Text(
|
|
||||||
text = safeMode,
|
|
||||||
style = MaterialTheme.typography.titleMedium,
|
|
||||||
color = MaterialTheme.colorScheme.onSurface
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val isHideVersion = LocalContext.current.getSharedPreferences("settings", Context.MODE_PRIVATE)
|
val isHideVersion = LocalContext.current.getSharedPreferences("settings", Context.MODE_PRIVATE)
|
||||||
|
|||||||
@@ -846,9 +846,7 @@ fun ModuleItem(
|
|||||||
onClick = { onUpdate(module) },
|
onClick = { onUpdate(module) },
|
||||||
shape = ButtonDefaults.textShape,
|
shape = ButtonDefaults.textShape,
|
||||||
contentPadding = ButtonDefaults.TextButtonContentPadding,
|
contentPadding = ButtonDefaults.TextButtonContentPadding,
|
||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.filledTonalButtonColors()
|
||||||
containerColor = MaterialTheme.colorScheme.secondaryContainer
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
modifier = Modifier.size(20.dp),
|
modifier = Modifier.size(20.dp),
|
||||||
|
|||||||
Reference in New Issue
Block a user