mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-03-12 21:23:02 -07:00
Redesign SU request dialog and add SharedUID badge to title row
Move SharedUID badge next to app title in superuser list, detail, and SU request screens. Consolidate SU request dialog: remove top title, combine warning text into single string, widen dialog, style buttons with larger corner radius and height, and adjust spacing. Made-with: Cursor
This commit is contained in:
@@ -106,23 +106,22 @@ fun SuperuserDetailScreen(
|
||||
)
|
||||
Spacer(Modifier.width(16.dp))
|
||||
Column {
|
||||
Text(
|
||||
text = item.title,
|
||||
style = MiuixTheme.textStyles.headline2,
|
||||
)
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(
|
||||
text = item.packageName,
|
||||
style = MiuixTheme.textStyles.body2,
|
||||
color = MiuixTheme.colorScheme.onSurfaceVariantSummary
|
||||
text = item.title,
|
||||
style = MiuixTheme.textStyles.headline2,
|
||||
modifier = Modifier.weight(1f, fill = false),
|
||||
)
|
||||
if (item.isSharedUid) {
|
||||
Spacer(Modifier.width(6.dp))
|
||||
SharedUidBadge()
|
||||
}
|
||||
}
|
||||
Text(
|
||||
text = item.packageName,
|
||||
style = MiuixTheme.textStyles.body2,
|
||||
color = MiuixTheme.colorScheme.onSurfaceVariantSummary
|
||||
)
|
||||
Text(
|
||||
text = "UID: ${item.policy.uid}",
|
||||
style = MiuixTheme.textStyles.body2,
|
||||
|
||||
@@ -139,23 +139,22 @@ private fun PolicyCard(
|
||||
)
|
||||
Spacer(Modifier.width(12.dp))
|
||||
Column(modifier = Modifier.weight(1f)) {
|
||||
Text(
|
||||
text = item.title,
|
||||
style = MiuixTheme.textStyles.body1,
|
||||
)
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(
|
||||
text = item.packageName,
|
||||
style = MiuixTheme.textStyles.body2,
|
||||
color = MiuixTheme.colorScheme.onSurfaceVariantSummary
|
||||
text = item.title,
|
||||
style = MiuixTheme.textStyles.body1,
|
||||
modifier = Modifier.weight(1f, fill = false),
|
||||
)
|
||||
if (item.isSharedUid) {
|
||||
Spacer(Modifier.width(6.dp))
|
||||
SharedUidBadge()
|
||||
}
|
||||
}
|
||||
Text(
|
||||
text = item.packageName,
|
||||
style = MiuixTheme.textStyles.body2,
|
||||
color = MiuixTheme.colorScheme.onSurfaceVariantSummary
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.view.MotionEvent
|
||||
import android.widget.Toast
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
@@ -28,6 +29,7 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.topjohnwu.magisk.ui.superuser.SharedUidBadge
|
||||
import com.topjohnwu.magisk.core.ktx.toast
|
||||
import com.topjohnwu.magisk.core.R as CoreR
|
||||
import com.topjohnwu.magisk.ui.util.rememberDrawablePainter
|
||||
@@ -64,21 +66,13 @@ fun SuRequestScreen(viewModel: SuRequestViewModel) {
|
||||
) {
|
||||
Card(
|
||||
modifier = Modifier
|
||||
.widthIn(min = 300.dp, max = 380.dp)
|
||||
.widthIn(min = 320.dp, max = 420.dp)
|
||||
.padding(24.dp)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.padding(20.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(CoreR.string.su_request_title),
|
||||
style = MiuixTheme.textStyles.headline2,
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
|
||||
Spacer(Modifier.height(16.dp))
|
||||
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.padding(horizontal = 8.dp)
|
||||
@@ -92,13 +86,20 @@ fun SuRequestScreen(viewModel: SuRequestViewModel) {
|
||||
Spacer(Modifier.width(12.dp))
|
||||
}
|
||||
Column {
|
||||
Text(
|
||||
text = title,
|
||||
style = MiuixTheme.textStyles.body1,
|
||||
fontWeight = FontWeight.Bold,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(
|
||||
text = title,
|
||||
style = MiuixTheme.textStyles.body1,
|
||||
fontWeight = FontWeight.Bold,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.weight(1f, fill = false),
|
||||
)
|
||||
if (viewModel.isSharedUid) {
|
||||
Spacer(Modifier.width(6.dp))
|
||||
SharedUidBadge()
|
||||
}
|
||||
}
|
||||
Text(
|
||||
text = packageName,
|
||||
style = MiuixTheme.textStyles.body2,
|
||||
@@ -111,6 +112,16 @@ fun SuRequestScreen(viewModel: SuRequestViewModel) {
|
||||
|
||||
Spacer(Modifier.height(16.dp))
|
||||
|
||||
Text(
|
||||
text = stringResource(CoreR.string.su_request_title),
|
||||
style = MiuixTheme.textStyles.body2,
|
||||
color = MiuixTheme.colorScheme.primary,
|
||||
fontWeight = FontWeight.Bold,
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
|
||||
Spacer(Modifier.height(8.dp))
|
||||
|
||||
SuperDropdown(
|
||||
title = stringResource(CoreR.string.request_timeout),
|
||||
items = timeoutEntries,
|
||||
@@ -122,17 +133,7 @@ fun SuRequestScreen(viewModel: SuRequestViewModel) {
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
|
||||
Spacer(Modifier.height(12.dp))
|
||||
|
||||
Text(
|
||||
text = stringResource(CoreR.string.su_warning),
|
||||
style = MiuixTheme.textStyles.body2,
|
||||
color = MiuixTheme.colorScheme.primary,
|
||||
fontWeight = FontWeight.Bold,
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
|
||||
Spacer(Modifier.height(16.dp))
|
||||
Spacer(Modifier.height(8.dp))
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
@@ -141,13 +142,19 @@ fun SuRequestScreen(viewModel: SuRequestViewModel) {
|
||||
TextButton(
|
||||
text = denyText,
|
||||
onClick = { viewModel.denyPressed() },
|
||||
modifier = Modifier.weight(1f)
|
||||
modifier = Modifier.weight(1f),
|
||||
cornerRadius = 12.dp,
|
||||
minHeight = 40.dp,
|
||||
insideMargin = PaddingValues(horizontal = 16.dp, vertical = 8.dp),
|
||||
)
|
||||
TextButton(
|
||||
text = stringResource(CoreR.string.grant),
|
||||
enabled = grantEnabled,
|
||||
colors = ButtonDefaults.textButtonColorsPrimary(),
|
||||
onClick = { viewModel.grantPressed() },
|
||||
cornerRadius = 12.dp,
|
||||
minHeight = 40.dp,
|
||||
insideMargin = PaddingValues(horizontal = 16.dp, vertical = 8.dp),
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.then(
|
||||
|
||||
@@ -37,6 +37,7 @@ class SuRequestViewModel(
|
||||
var icon by mutableStateOf<Drawable?>(null)
|
||||
var title by mutableStateOf("")
|
||||
var packageName by mutableStateOf("")
|
||||
var isSharedUid by mutableStateOf(false)
|
||||
|
||||
var selectedItemPosition by mutableIntStateOf(0)
|
||||
var grantEnabled by mutableStateOf(false)
|
||||
@@ -81,14 +82,14 @@ class SuRequestViewModel(
|
||||
val info = handler.pkgInfo
|
||||
val app = info.applicationInfo
|
||||
|
||||
isSharedUid = info.sharedUserId != null
|
||||
if (app == null) {
|
||||
icon = pm.defaultActivityIcon
|
||||
title = "[SharedUID] ${info.sharedUserId}"
|
||||
title = info.sharedUserId.toString()
|
||||
packageName = info.sharedUserId.toString()
|
||||
} else {
|
||||
val prefix = if (info.sharedUserId == null) "" else "[SharedUID] "
|
||||
icon = app.loadIcon(pm)
|
||||
title = "$prefix${app.getLabel(pm)}"
|
||||
title = app.getLabel(pm)
|
||||
packageName = info.packageName
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<string name="flash_screen_title">Installation</string>
|
||||
|
||||
<!--Superuser-->
|
||||
<string name="su_request_title">Superuser request</string>
|
||||
<string name="su_request_title">This app is requesting root permission. Grants full access to your device. Deny if you\'re not sure!</string>
|
||||
<string name="touch_filtered_warning">Because an app is obscuring a Superuser request, Magisk can\'t verify your response.</string>
|
||||
<string name="deny">Deny</string>
|
||||
<string name="prompt">Prompt</string>
|
||||
|
||||
Reference in New Issue
Block a user