Loading packages/SettingsLib/Spa/spa/res/values/strings.xml 0 → 100644 +23 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2025 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <resources> <!-- Content description for the unavailable item. [CHAR LIMIT=NONE]--> <string name="spa_unavailable">Unavailable</string> <!-- An action, to learn more. [CHAR LIMIT=NONE]--> <string name="spa_learn_more">Learn more</string> </resources> packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/restricted/RestrictedSwitchPreferenceModel.kt +9 −1 Original line number Diff line number Diff line Loading @@ -19,10 +19,13 @@ package com.android.settingslib.spa.restricted import androidx.compose.foundation.clickable import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.Role import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.toggleableState import androidx.compose.ui.state.ToggleableState import com.android.settingslib.spa.R import com.android.settingslib.spa.widget.preference.SwitchPreferenceModel internal class RestrictedSwitchPreferenceModel( Loading Loading @@ -62,11 +65,16 @@ internal class RestrictedSwitchPreferenceModel( val modifier = when (restrictedMode) { is BlockedWithDetails -> { val statusDescription = stringResource(R.string.spa_unavailable) Modifier.clickable( onClickLabel = stringResource(R.string.spa_learn_more), role = Role.Switch, onClick = { restrictedMode.showDetails() }, ) .semantics { this.toggleableState = toggleableState(checked()) } .semantics { contentDescription = statusDescription toggleableState = toggleableState(checked()) } } else -> Modifier Loading Loading
packages/SettingsLib/Spa/spa/res/values/strings.xml 0 → 100644 +23 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2025 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <resources> <!-- Content description for the unavailable item. [CHAR LIMIT=NONE]--> <string name="spa_unavailable">Unavailable</string> <!-- An action, to learn more. [CHAR LIMIT=NONE]--> <string name="spa_learn_more">Learn more</string> </resources>
packages/SettingsLib/Spa/spa/src/com/android/settingslib/spa/restricted/RestrictedSwitchPreferenceModel.kt +9 −1 Original line number Diff line number Diff line Loading @@ -19,10 +19,13 @@ package com.android.settingslib.spa.restricted import androidx.compose.foundation.clickable import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.Role import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.toggleableState import androidx.compose.ui.state.ToggleableState import com.android.settingslib.spa.R import com.android.settingslib.spa.widget.preference.SwitchPreferenceModel internal class RestrictedSwitchPreferenceModel( Loading Loading @@ -62,11 +65,16 @@ internal class RestrictedSwitchPreferenceModel( val modifier = when (restrictedMode) { is BlockedWithDetails -> { val statusDescription = stringResource(R.string.spa_unavailable) Modifier.clickable( onClickLabel = stringResource(R.string.spa_learn_more), role = Role.Switch, onClick = { restrictedMode.showDetails() }, ) .semantics { this.toggleableState = toggleableState(checked()) } .semantics { contentDescription = statusDescription toggleableState = toggleableState(checked()) } } else -> Modifier Loading