Avoid to change preference UI content from tapping outside of dialog.
Flag: EXEMPT bug fix Fix: 335763360 Test: atest passed. Test: Manual test passed. Change-Id: Iec5e98f74f0009ab2d3bc21bc590229514192f93
This commit is contained in:
@@ -81,24 +81,28 @@ private fun LabelSimPreference(
|
|||||||
onboardingService: SimOnboardingService,
|
onboardingService: SimOnboardingService,
|
||||||
subInfo: SubscriptionInfo,
|
subInfo: SubscriptionInfo,
|
||||||
) {
|
) {
|
||||||
val originalSimCarrierName = subInfo.displayName.toString()
|
val currentSimName = onboardingService.getSubscriptionInfoDisplayName(subInfo)
|
||||||
var titleSimName by remember {
|
var prefTitle by remember {
|
||||||
mutableStateOf(onboardingService.getSubscriptionInfoDisplayName(subInfo))
|
mutableStateOf(currentSimName)
|
||||||
|
}
|
||||||
|
var dialogInputContent by remember {
|
||||||
|
mutableStateOf(currentSimName)
|
||||||
}
|
}
|
||||||
val phoneNumber = phoneNumber(subInfo)
|
val phoneNumber = phoneNumber(subInfo)
|
||||||
val alertDialogPresenter = rememberAlertDialogPresenter(
|
val alertDialogPresenter = rememberAlertDialogPresenter(
|
||||||
confirmButton = AlertDialogButton(
|
confirmButton = AlertDialogButton(
|
||||||
stringResource(R.string.mobile_network_sim_name_rename),
|
stringResource(R.string.mobile_network_sim_name_rename),
|
||||||
titleSimName.isNotBlank()
|
dialogInputContent.isNotBlank()
|
||||||
) {
|
) {
|
||||||
onboardingService.addItemForRenaming(
|
onboardingService.addItemForRenaming(
|
||||||
subInfo, if (titleSimName.isEmpty()) originalSimCarrierName else titleSimName
|
subInfo, dialogInputContent
|
||||||
)
|
)
|
||||||
|
prefTitle = dialogInputContent
|
||||||
},
|
},
|
||||||
dismissButton = AlertDialogButton(
|
dismissButton = AlertDialogButton(
|
||||||
stringResource(R.string.cancel),
|
stringResource(R.string.cancel),
|
||||||
) {
|
) {
|
||||||
titleSimName = onboardingService.getSubscriptionInfoDisplayName(subInfo)
|
// Do nothing
|
||||||
},
|
},
|
||||||
title = stringResource(R.string.sim_onboarding_label_sim_dialog_title),
|
title = stringResource(R.string.sim_onboarding_label_sim_dialog_title),
|
||||||
text = {
|
text = {
|
||||||
@@ -107,17 +111,19 @@ private fun LabelSimPreference(
|
|||||||
modifier = Modifier.padding(bottom = SettingsDimension.itemPaddingVertical)
|
modifier = Modifier.padding(bottom = SettingsDimension.itemPaddingVertical)
|
||||||
)
|
)
|
||||||
SettingsOutlinedTextField(
|
SettingsOutlinedTextField(
|
||||||
value = titleSimName,
|
value = dialogInputContent,
|
||||||
label = stringResource(R.string.sim_onboarding_label_sim_dialog_label),
|
label = stringResource(R.string.sim_onboarding_label_sim_dialog_label),
|
||||||
placeholder = {Text(text = originalSimCarrierName)},
|
placeholder = {Text(text = subInfo.displayName.toString())},
|
||||||
modifier = Modifier.fillMaxWidth().testTag("contentInput")
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.testTag("contentInput")
|
||||||
) {
|
) {
|
||||||
titleSimName = it
|
dialogInputContent = it
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
Preference(object : PreferenceModel {
|
Preference(object : PreferenceModel {
|
||||||
override val title = titleSimName
|
override val title = prefTitle
|
||||||
override val summary = { phoneNumber.value ?: "" }
|
override val summary = { phoneNumber.value ?: "" }
|
||||||
override val onClick = alertDialogPresenter::open
|
override val onClick = alertDialogPresenter::open
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user