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