When apn is read only, hide the save button.

Test: Visual Test
Fix: 320200491
Change-Id: I8280fdaa3643a982137936473d827b8502a6e023
This commit is contained in:
Charlotte Lu
2024-01-15 15:39:49 +08:00
parent 59d67c3dc2
commit f8bc0841bc

View File

@@ -101,6 +101,7 @@ fun ApnPage(apnDataInit: ApnData, apnDataCur: MutableState<ApnData>, uriInit: Ur
RegularScaffold(
title = if (apnDataInit.newApn) stringResource(id = R.string.apn_add) else stringResource(id = R.string.apn_edit),
actions = {
if (!apnData.customizedConfig.readOnlyApn) {
IconButton(onClick = {
if (!apnData.validEnabled) apnData = apnData.copy(validEnabled = true)
val valid = validateAndSaveApnData(
@@ -112,6 +113,7 @@ fun ApnPage(apnDataInit: ApnData, apnDataCur: MutableState<ApnData>, uriInit: Ur
)
if (valid) navController.navigateBack()
}) { Icon(imageVector = Icons.Outlined.Done, contentDescription = null) }
}
},
) {
Column {
@@ -212,7 +214,9 @@ fun ApnPage(apnDataInit: ApnData, apnDataCur: MutableState<ApnData>, uriInit: Ur
emptyVal = stringResource(R.string.network_type_unspecified),
enabled = apnData.networkTypeEnabled
) {}
if (!apnData.newApn) {
if (!apnData.newApn && !apnData.customizedConfig.readOnlyApn
&& apnData.customizedConfig.isAddApnAllowed
) {
Preference(
object : PreferenceModel {
override val title = stringResource(R.string.menu_delete)