SettingsExposedDropdownMenuCheckBox requires input index.

Fix: 301354014
Test: Unit Test
Change-Id: I4f5ef9a3cfcd0705687232b5e67da8007bf97aed
This commit is contained in:
Charlotte Lu
2023-09-21 14:25:50 +08:00
parent c39acee194
commit f27c23fa79
3 changed files with 11 additions and 10 deletions

View File

@@ -148,13 +148,13 @@ fun ApnPage(apnDataCur: MutableState<ApnData>) {
stringResource(R.string.apn_mnc), stringResource(R.string.apn_mnc),
enabled = apnData.mncEnabled enabled = apnData.mncEnabled
) { apnData = apnData.copy(mnc = it) } ) { apnData = apnData.copy(mnc = it) }
// Warning: apnProtocol, apnRoaming, mvnoType string2Int
SettingsExposedDropdownMenuBox( SettingsExposedDropdownMenuBox(
label = stringResource(R.string.apn_auth_type), stringResource(R.string.apn_auth_type),
options = authTypeOptions, authTypeOptions,
selectedOptionText = apnData.authType,
authTypeOptions.getOrElse(apnData.authType) { "" }, apnData.authTypeEnabled,
enabled = apnData.authTypeEnabled, ) { apnData = apnData.copy(authType = it) }
) { apnData = apnData.copy(authType = authTypeOptions.indexOf(it)) }
SettingsOutlinedTextField( SettingsOutlinedTextField(
apnData.apnType, apnData.apnType,
stringResource(R.string.apn_type), stringResource(R.string.apn_type),

View File

@@ -34,11 +34,11 @@ data class ApnData(
val mnc: String = "", val mnc: String = "",
val authType: Int = -1, val authType: Int = -1,
val apnType: String = "", val apnType: String = "",
val apnProtocol: String = "", val apnProtocol: Int = -1,
val apnRoaming: String = "", val apnRoaming: Int = -1,
val apnEnable: Boolean = true, val apnEnable: Boolean = true,
val bearer: Int = 0, val bearer: Int = 0,
val mvnoType: String = "", val mvnoType: Int = -1,
var mvnoValue: String = "", var mvnoValue: String = "",
val bearerBitmask: Int = 0, val bearerBitmask: Int = 0,
val edited: Int = Telephony.Carriers.USER_EDITED, val edited: Int = Telephony.Carriers.USER_EDITED,

View File

@@ -49,13 +49,14 @@ class ApnEditPageProviderTest {
private val apnType = "apn_type" private val apnType = "apn_type"
private val apnRoaming = "IPv4" private val apnRoaming = "IPv4"
private val apnEnable = context.resources.getString(R.string.carrier_enabled) private val apnEnable = context.resources.getString(R.string.carrier_enabled)
private val apnProtocolOptions = context.resources.getStringArray(R.array.apn_protocol_entries).toList()
private val apnData = ApnData( private val apnData = ApnData(
name = apnName, name = apnName,
mmsc = mmsc, mmsc = mmsc,
mmsProxy = mmsProxy, mmsProxy = mmsProxy,
mnc = mnc, mnc = mnc,
apnType = apnType, apnType = apnType,
apnRoaming = apnRoaming, apnRoaming = apnProtocolOptions.indexOf(apnRoaming),
apnEnable = true apnEnable = true
) )