Uniformly use surfaceContainerHigh as the background color of the popup window

This commit is contained in:
ShirkNeko
2025-06-21 16:34:38 +08:00
parent b7b995bf73
commit 74ec20745c
3 changed files with 108 additions and 106 deletions

View File

@@ -209,11 +209,10 @@ fun GroupsPanel(selected: List<Groups>, closeSelection: (selection: Set<Groups>)
} }
val selection = HashSet(selected) val selection = HashSet(selected)
val backgroundColor = if (CardConfig.isCustomBackgroundEnabled) Color.Transparent else MaterialTheme.colorScheme.surfaceContainerHigh
MaterialTheme( MaterialTheme(
colorScheme = MaterialTheme.colorScheme.copy( colorScheme = MaterialTheme.colorScheme.copy(
surface = backgroundColor surface = MaterialTheme.colorScheme.surfaceContainerHigh
) )
) { ) {
ListDialog( ListDialog(
@@ -289,11 +288,10 @@ fun CapsPanel(
} }
val selection = HashSet(selected) val selection = HashSet(selected)
val backgroundColor = if (CardConfig.isCustomBackgroundEnabled) Color.Transparent else MaterialTheme.colorScheme.surfaceContainerHigh
MaterialTheme( MaterialTheme(
colorScheme = MaterialTheme.colorScheme.copy( colorScheme = MaterialTheme.colorScheme.copy(
surface = backgroundColor surface = MaterialTheme.colorScheme.surfaceContainerHigh
) )
) { ) {
ListDialog( ListDialog(
@@ -444,11 +442,10 @@ private fun SELinuxPanel(
) )
) )
val backgroundColor = if (CardConfig.isCustomBackgroundEnabled) Color.Transparent else MaterialTheme.colorScheme.surfaceContainerHigh
MaterialTheme( MaterialTheme(
colorScheme = MaterialTheme.colorScheme.copy( colorScheme = MaterialTheme.colorScheme.copy(
surface = backgroundColor surface = MaterialTheme.colorScheme.surfaceContainerHigh
) )
) { ) {
InputDialog( InputDialog(

View File

@@ -688,11 +688,10 @@ fun rememberSelectKmiDialog(onSelected: (String?) -> Unit): DialogHandle {
} }
var selection by remember { mutableStateOf<String?>(null) } var selection by remember { mutableStateOf<String?>(null) }
val backgroundColor = MaterialTheme.colorScheme.surfaceContainerHigh
MaterialTheme( MaterialTheme(
colorScheme = MaterialTheme.colorScheme.copy( colorScheme = MaterialTheme.colorScheme.copy(
surface = backgroundColor surface = MaterialTheme.colorScheme.surfaceContainerHigh
) )
) { ) {
ListDialog(state = rememberUseCaseState(visible = true, onFinishedRequest = { ListDialog(state = rememberUseCaseState(visible = true, onFinishedRequest = {

View File

@@ -662,115 +662,121 @@ fun rememberUninstallDialog(onSelected: (UninstallType) -> Unit): DialogHandle {
var selectedOption by remember { mutableStateOf<UninstallType?>(null) } var selectedOption by remember { mutableStateOf<UninstallType?>(null) }
AlertDialog( MaterialTheme(
onDismissRequest = { colorScheme = MaterialTheme.colorScheme.copy(
dismiss() surface = MaterialTheme.colorScheme.surfaceContainerHigh
}, )
title = { ) {
Text( AlertDialog(
text = stringResource(R.string.settings_uninstall), onDismissRequest = {
style = MaterialTheme.typography.headlineSmall, dismiss()
) },
}, title = {
text = { Text(
Column( text = stringResource(R.string.settings_uninstall),
modifier = Modifier.padding(vertical = 8.dp), style = MaterialTheme.typography.headlineSmall,
verticalArrangement = Arrangement.spacedBy(16.dp) )
) { },
options.forEachIndexed { index, option -> text = {
val isSelected = selectedOption == option Column(
val backgroundColor = if (isSelected) modifier = Modifier.padding(vertical = 8.dp),
MaterialTheme.colorScheme.primaryContainer verticalArrangement = Arrangement.spacedBy(16.dp)
else ) {
Color.Transparent options.forEachIndexed { index, option ->
val contentColor = if (isSelected) val isSelected = selectedOption == option
MaterialTheme.colorScheme.onPrimaryContainer val backgroundColor = if (isSelected)
else MaterialTheme.colorScheme.primaryContainer
MaterialTheme.colorScheme.onSurface else
Color.Transparent
val contentColor = if (isSelected)
MaterialTheme.colorScheme.onPrimaryContainer
else
MaterialTheme.colorScheme.onSurface
Row( Row(
modifier = Modifier
.fillMaxWidth()
.clip(MaterialTheme.shapes.medium)
.background(backgroundColor)
.clickable {
selectedOption = option
}
.padding(vertical = 12.dp, horizontal = 8.dp),
verticalAlignment = Alignment.CenterVertically
) {
Icon(
imageVector = option.icon,
contentDescription = null,
tint = MaterialTheme.colorScheme.primary,
modifier = Modifier modifier = Modifier
.padding(end = 16.dp) .fillMaxWidth()
.size(24.dp) .clip(MaterialTheme.shapes.medium)
) .background(backgroundColor)
Column( .clickable {
modifier = Modifier.weight(1f) selectedOption = option
}
.padding(vertical = 12.dp, horizontal = 8.dp),
verticalAlignment = Alignment.CenterVertically
) { ) {
Text( Icon(
text = listOptions[index].titleText, imageVector = option.icon,
style = MaterialTheme.typography.titleMedium, contentDescription = null,
tint = MaterialTheme.colorScheme.primary,
modifier = Modifier
.padding(end = 16.dp)
.size(24.dp)
) )
listOptions[index].subtitleText?.let { Column(
modifier = Modifier.weight(1f)
) {
Text( Text(
text = it, text = listOptions[index].titleText,
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.titleMedium,
color = if (isSelected) )
contentColor.copy(alpha = 0.8f) listOptions[index].subtitleText?.let {
else Text(
MaterialTheme.colorScheme.onSurfaceVariant text = it,
style = MaterialTheme.typography.bodyMedium,
color = if (isSelected)
contentColor.copy(alpha = 0.8f)
else
MaterialTheme.colorScheme.onSurfaceVariant
)
}
}
if (isSelected) {
Icon(
imageVector = Icons.Default.RadioButtonChecked,
contentDescription = null,
tint = MaterialTheme.colorScheme.primary,
modifier = Modifier.size(24.dp)
)
} else {
Icon(
imageVector = Icons.Default.RadioButtonUnchecked,
contentDescription = null,
tint = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.size(24.dp)
) )
} }
} }
if (isSelected) {
Icon(
imageVector = Icons.Default.RadioButtonChecked,
contentDescription = null,
tint = MaterialTheme.colorScheme.primary,
modifier = Modifier.size(24.dp)
)
} else {
Icon(
imageVector = Icons.Default.RadioButtonUnchecked,
contentDescription = null,
tint = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.size(24.dp)
)
}
} }
} }
} },
}, confirmButton = {
confirmButton = { Button(
Button( onClick = {
onClick = { selectedOption?.let { onSelected(it) }
selectedOption?.let { onSelected(it) } dismiss()
dismiss() },
}, enabled = selectedOption != null,
enabled = selectedOption != null, ) {
) { Text(
Text( text = stringResource(android.R.string.ok)
text = stringResource(android.R.string.ok) )
)
}
},
dismissButton = {
TextButton(
onClick = {
dismiss()
} }
) { },
Text( dismissButton = {
text = stringResource(android.R.string.cancel), TextButton(
) onClick = {
} dismiss()
}, }
shape = MaterialTheme.shapes.extraLarge, ) {
tonalElevation = 4.dp Text(
) text = stringResource(android.R.string.cancel),
)
}
},
shape = MaterialTheme.shapes.extraLarge,
tonalElevation = 4.dp
)
}
} }
} }