Merge "To gray out the next button if the user does not select two sim" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
a3b28762cb
@@ -56,12 +56,12 @@ fun SimOnboardingLabelSimImpl(
|
||||
imageVector = Icons.Outlined.SignalCellularAlt,
|
||||
title = stringResource(R.string.sim_onboarding_label_sim_title),
|
||||
actionButton = BottomAppBarButton(
|
||||
stringResource(R.string.sim_onboarding_next),
|
||||
nextAction
|
||||
text = stringResource(R.string.sim_onboarding_next),
|
||||
onClick = nextAction
|
||||
),
|
||||
dismissButton = BottomAppBarButton(
|
||||
stringResource(R.string.cancel),
|
||||
cancelAction
|
||||
text = stringResource(R.string.cancel),
|
||||
onClick = cancelAction
|
||||
),
|
||||
) {
|
||||
LabelSimBody(onboardingService)
|
||||
|
||||
@@ -59,12 +59,12 @@ fun SimOnboardingPrimarySimImpl(
|
||||
imageVector = Icons.Outlined.SignalCellularAlt,
|
||||
title = stringResource(id = R.string.sim_onboarding_primary_sim_title),
|
||||
actionButton = BottomAppBarButton(
|
||||
stringResource(id = R.string.done),
|
||||
nextAction
|
||||
text = stringResource(id = R.string.done),
|
||||
onClick = nextAction
|
||||
),
|
||||
dismissButton = BottomAppBarButton(
|
||||
stringResource(id = R.string.cancel),
|
||||
cancelAction
|
||||
text = stringResource(id = R.string.cancel),
|
||||
onClick = cancelAction
|
||||
),
|
||||
) {
|
||||
val callsSelectedId = rememberSaveable {
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
package com.android.settings.spa.network
|
||||
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.SignalCellularAlt
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
@@ -29,7 +29,6 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.android.settings.R
|
||||
import com.android.settings.network.SimOnboardingService
|
||||
import com.android.settings.sim.SimDialogActivity
|
||||
import com.android.settingslib.spa.framework.theme.SettingsDimension
|
||||
import com.android.settingslib.spa.widget.preference.CheckboxPreference
|
||||
import com.android.settingslib.spa.widget.preference.CheckboxPreferenceModel
|
||||
@@ -46,44 +45,47 @@ fun SimOnboardingSelectSimImpl(
|
||||
cancelAction: () -> Unit,
|
||||
onboardingService: SimOnboardingService
|
||||
) {
|
||||
var actionButtonController = rememberSaveable { mutableStateOf(false) }
|
||||
|
||||
SuwScaffold(
|
||||
imageVector = Icons.Outlined.SignalCellularAlt,
|
||||
title = stringResource(id = R.string.sim_onboarding_select_sim_title),
|
||||
actionButton = BottomAppBarButton(
|
||||
stringResource(id = R.string.sim_onboarding_next),
|
||||
nextAction
|
||||
text = stringResource(id = R.string.sim_onboarding_next),
|
||||
enabled = actionButtonController.value,
|
||||
onClick = nextAction
|
||||
),
|
||||
dismissButton = BottomAppBarButton(
|
||||
stringResource(id = R.string.cancel),
|
||||
cancelAction
|
||||
text = stringResource(id = R.string.cancel),
|
||||
onClick = cancelAction
|
||||
),
|
||||
) {
|
||||
selectSimBody(onboardingService)
|
||||
SelectSimBody(onboardingService, actionButtonController)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun selectSimBody(onboardingService: SimOnboardingService) {
|
||||
private fun SelectSimBody(
|
||||
onboardingService: SimOnboardingService,
|
||||
isFinished: MutableState<Boolean>
|
||||
) {
|
||||
Column(Modifier.padding(SettingsDimension.itemPadding)) {
|
||||
SettingsBody(stringResource(id = R.string.sim_onboarding_select_sim_msg))
|
||||
}
|
||||
var isFinished = rememberSaveable { mutableStateOf(false) }
|
||||
isFinished.value = onboardingService.isSimSelectionFinished
|
||||
for (subInfo in onboardingService.getSelectableSubscriptionInfoList()) {
|
||||
var title = onboardingService.getSubscriptionInfoDisplayName(subInfo)
|
||||
var summaryNumber =
|
||||
subInfo.number // TODO using the SubscriptionUtil.getFormattedPhoneNumber
|
||||
val phoneNumber = phoneNumber(subInfo)
|
||||
var checked = rememberSaveable {
|
||||
mutableStateOf(
|
||||
onboardingService.getSelectedSubscriptionInfoList().contains(subInfo)
|
||||
)
|
||||
}
|
||||
|
||||
CheckboxPreference(remember {
|
||||
object : CheckboxPreferenceModel {
|
||||
override val title = title
|
||||
override val summary: () -> String
|
||||
get() = { summaryNumber }
|
||||
get() = { phoneNumber.value ?: "" }
|
||||
override val checked = { checked.value }
|
||||
override val onCheckedChange = { newChecked: Boolean ->
|
||||
checked.value = newChecked
|
||||
|
||||
Reference in New Issue
Block a user