Fix when edittext only has space and cause name look like blank

fix: 335763360
Test: Manual test. see b/335763360#comment14
Test: atest passed
Change-Id: I9ebae13039d7b78b7acfea545a89d3096aa82c31
This commit is contained in:
tomhsu
2024-05-27 12:42:03 +00:00
parent 5b0211ea75
commit d5556c59e9
2 changed files with 127 additions and 30 deletions

View File

@@ -28,6 +28,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import com.android.settings.R
import com.android.settings.network.SimOnboardingService
@@ -104,9 +105,9 @@ private fun LabelSimPreference(
value = titleSimName,
label = stringResource(R.string.sim_onboarding_label_sim_dialog_label),
placeholder = {Text(text = originalSimCarrierName)},
modifier = Modifier.fillMaxWidth()
modifier = Modifier.fillMaxWidth().testTag("contentInput")
) {
titleSimName = if (it.isEmpty()) originalSimCarrierName else it
titleSimName = if (it.matches(Regex("^\\s*$"))) originalSimCarrierName else it
}
},
)