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 backgroundColor = if (CardConfig.isCustomBackgroundEnabled) Color.Transparent else MaterialTheme.colorScheme.surfaceContainerHigh
MaterialTheme(
colorScheme = MaterialTheme.colorScheme.copy(
surface = backgroundColor
surface = MaterialTheme.colorScheme.surfaceContainerHigh
)
) {
ListDialog(
@@ -289,11 +288,10 @@ fun CapsPanel(
}
val selection = HashSet(selected)
val backgroundColor = if (CardConfig.isCustomBackgroundEnabled) Color.Transparent else MaterialTheme.colorScheme.surfaceContainerHigh
MaterialTheme(
colorScheme = MaterialTheme.colorScheme.copy(
surface = backgroundColor
surface = MaterialTheme.colorScheme.surfaceContainerHigh
)
) {
ListDialog(
@@ -444,11 +442,10 @@ private fun SELinuxPanel(
)
)
val backgroundColor = if (CardConfig.isCustomBackgroundEnabled) Color.Transparent else MaterialTheme.colorScheme.surfaceContainerHigh
MaterialTheme(
colorScheme = MaterialTheme.colorScheme.copy(
surface = backgroundColor
surface = MaterialTheme.colorScheme.surfaceContainerHigh
)
) {
InputDialog(

View File

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