diff --git a/demo/src/main/java/com/orange/ods/demo/ui/components/switches/ComponentSwitches.kt b/demo/src/main/java/com/orange/ods/demo/ui/components/switches/ComponentSwitches.kt
index d7e0f99d2..3e4a8d851 100644
--- a/demo/src/main/java/com/orange/ods/demo/ui/components/switches/ComponentSwitches.kt
+++ b/demo/src/main/java/com/orange/ods/demo/ui/components/switches/ComponentSwitches.kt
@@ -15,39 +15,37 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.ExperimentalMaterialApi
+import androidx.compose.material.rememberBottomSheetScaffoldState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.remember
+import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.dimensionResource
import com.orange.ods.demo.R
+import com.orange.ods.demo.ui.components.utilities.ComponentCustomizationBottomSheetScaffold
import com.orange.ods.demo.ui.utilities.composable.SwitchListItem
-import com.orange.ods.demo.ui.utilities.composable.Title
@ExperimentalMaterialApi
@Composable
fun ComponentSwitches() {
- Column(
- modifier = Modifier
- .verticalScroll(rememberScrollState())
- .padding(bottom = dimensionResource(id = R.dimen.spacing_m))
- ) {
- Title(textRes = R.string.component_switches_enabled, withHorizontalPadding = true)
- SwitchListItem(
- labelRes = R.string.component_element_item1,
- checked = remember { mutableStateOf(true) }
- )
+ val checked = rememberSaveable { mutableStateOf(false) }
+ val enabled = rememberSaveable { mutableStateOf(true) }
- Title(textRes = R.string.component_switches_disabled, withHorizontalPadding = true)
- SwitchListItem(
- labelRes = R.string.component_element_item1,
- checked = remember { mutableStateOf(true) },
- enabled = false
- )
- SwitchListItem(
- labelRes = R.string.component_element_item2,
- checked = remember { mutableStateOf(false) },
- enabled = false
- )
+ ComponentCustomizationBottomSheetScaffold(
+ bottomSheetScaffoldState = rememberBottomSheetScaffoldState(),
+ bottomSheetContent = {
+ SwitchListItem(labelRes = R.string.component_state_enabled, checked = enabled)
+ }) {
+ Column(
+ modifier = Modifier
+ .verticalScroll(rememberScrollState())
+ .padding(bottom = dimensionResource(id = R.dimen.spacing_m))
+ ) {
+ SwitchListItem(
+ labelRes = R.string.component_element_label,
+ checked = checked,
+ enabled = enabled.value
+ )
+ }
}
}
diff --git a/demo/src/main/res/values/strings.xml b/demo/src/main/res/values/strings.xml
index a0f3dd461..f36969da3 100644
--- a/demo/src/main/res/values/strings.xml
+++ b/demo/src/main/res/values/strings.xml
@@ -138,9 +138,7 @@
Switches
On/off switches toggle the state of a single settings option. The function of the switch should be made clear by the inline label.
- Enabled switches
- Disabled switches
-
+
Sliders
Sliders enable the user to set a value by moving the slider thumb. The lowest value is always on the left. Sliders can be either continuous or discrete, where the slider thumb snaps to evenly spaced tick marks along the slider rail.