manager: fix the color of TextField in TemplateEditor
This commit is contained in:
@@ -334,7 +334,6 @@ private fun SELinuxPanel(
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 8.dp),
|
||||
label = stringResource(id = R.string.profile_selinux_domain),
|
||||
backgroundColor = colorScheme.surfaceContainer,
|
||||
borderColor = if (isDomainValid) {
|
||||
colorScheme.primary
|
||||
} else {
|
||||
@@ -353,7 +352,6 @@ private fun SELinuxPanel(
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 8.dp),
|
||||
label = stringResource(id = R.string.profile_selinux_rules),
|
||||
backgroundColor = colorScheme.surfaceContainer,
|
||||
borderColor = if (isRulesValid) {
|
||||
colorScheme.primary
|
||||
} else {
|
||||
|
||||
@@ -111,6 +111,7 @@ fun TemplateEditorScreen(
|
||||
stringResource(R.string.app_profile_template_edit)
|
||||
},
|
||||
readOnly = readOnly,
|
||||
isCreation = isCreation,
|
||||
onBack = dropUnlessResumed { navigator.navigateBack(result = !readOnly) },
|
||||
onDelete = {
|
||||
if (deleteAppProfileTemplate(template.id)) {
|
||||
@@ -165,9 +166,7 @@ fun TemplateEditorScreen(
|
||||
.fillMaxWidth()
|
||||
.padding(12.dp),
|
||||
) {
|
||||
var errorHint by remember {
|
||||
mutableStateOf(false)
|
||||
}
|
||||
var errorHint by rememberSaveable { mutableStateOf(false) }
|
||||
|
||||
TextEdit(
|
||||
label = stringResource(id = R.string.app_profile_template_name),
|
||||
@@ -189,15 +188,7 @@ fun TemplateEditorScreen(
|
||||
text = template.id,
|
||||
isError = errorHint
|
||||
) { value ->
|
||||
errorHint = if (value.isEmpty()) {
|
||||
false
|
||||
} else if (isTemplateExist(value)) {
|
||||
true
|
||||
} else if (!isValidTemplateId(value)) {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
errorHint = value.isNotEmpty() && (isTemplateExist(value) || !isValidTemplateId(value))
|
||||
template = template.copy(id = value)
|
||||
}
|
||||
TextEdit(
|
||||
@@ -311,6 +302,7 @@ fun saveTemplate(template: TemplateViewModel.TemplateInfo, isCreation: Boolean =
|
||||
private fun TopBar(
|
||||
title: String,
|
||||
readOnly: Boolean,
|
||||
isCreation: Boolean,
|
||||
onBack: () -> Unit,
|
||||
onDelete: () -> Unit = {},
|
||||
onSave: () -> Unit = {},
|
||||
@@ -339,28 +331,32 @@ private fun TopBar(
|
||||
}
|
||||
},
|
||||
actions = {
|
||||
if (readOnly) {
|
||||
return@TopAppBar
|
||||
}
|
||||
IconButton(
|
||||
modifier = Modifier.padding(end = 16.dp),
|
||||
onClick = onDelete
|
||||
) {
|
||||
Icon(
|
||||
imageVector = MiuixIcons.Useful.Delete,
|
||||
contentDescription = stringResource(id = R.string.app_profile_template_delete),
|
||||
tint = colorScheme.onBackground
|
||||
)
|
||||
}
|
||||
IconButton(
|
||||
modifier = Modifier.padding(end = 16.dp),
|
||||
onClick = onSave
|
||||
) {
|
||||
Icon(
|
||||
imageVector = MiuixIcons.Useful.Confirm,
|
||||
contentDescription = stringResource(id = R.string.app_profile_template_save),
|
||||
tint = colorScheme.onBackground
|
||||
)
|
||||
when {
|
||||
!readOnly && !isCreation -> {
|
||||
IconButton(
|
||||
modifier = Modifier.padding(end = 16.dp),
|
||||
onClick = onDelete
|
||||
) {
|
||||
Icon(
|
||||
imageVector = MiuixIcons.Useful.Delete,
|
||||
contentDescription = stringResource(id = R.string.app_profile_template_delete),
|
||||
tint = colorScheme.onBackground
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
isCreation -> {
|
||||
IconButton(
|
||||
modifier = Modifier.padding(end = 16.dp),
|
||||
onClick = onSave
|
||||
) {
|
||||
Icon(
|
||||
imageVector = MiuixIcons.Useful.Confirm,
|
||||
contentDescription = stringResource(id = R.string.app_profile_template_save),
|
||||
tint = colorScheme.onBackground
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
scrollBehavior = scrollBehavior
|
||||
|
||||
Reference in New Issue
Block a user