@@ -6,15 +6,17 @@ import androidx.compose.foundation.layout.Column
66import androidx.compose.foundation.layout.Row
77import androidx.compose.material.icons.Icons
88import androidx.compose.material.icons.filled.Lightbulb
9+ import androidx.compose.material.icons.filled.ModeStandby
910import androidx.compose.material.icons.filled.RadioButtonChecked
11+ import androidx.compose.material.icons.outlined.Lightbulb
1012import androidx.compose.material3.MaterialTheme
1113import androidx.compose.material3.Switch
1214import androidx.compose.material3.Text
1315import androidx.compose.runtime.Composable
1416import androidx.compose.runtime.getValue
1517import androidx.compose.ui.Alignment
1618import androidx.compose.ui.Modifier
17- import androidx.compose.ui.graphics.Color
19+ import androidx.compose.ui.res.colorResource
1820import androidx.compose.ui.res.stringResource
1921import androidx.compose.ui.tooling.preview.Preview
2022import androidx.compose.ui.unit.dp
@@ -60,9 +62,13 @@ private fun LedControlView(
6062 .clickable { onStateChanged(! ledState) }
6163 ) {
6264 SectionTitle (
63- icon = Icons .Default .Lightbulb ,
65+ icon = if (ledState)
66+ Icons .Default .Lightbulb
67+ else Icons .Outlined .Lightbulb ,
6468 title = stringResource(id = R .string.lbs_led),
65- tint = if (ledState) Color .Yellow else MaterialTheme .colorScheme.primary,
69+ tint = if (ledState)
70+ colorResource(R .color.nordicSun)
71+ else MaterialTheme .colorScheme.primary,
6672 )
6773 Row (
6874 verticalAlignment = Alignment .CenterVertically ,
@@ -85,18 +91,14 @@ private fun ButtonControlView(
8591 buttonState : Boolean ,
8692 modifier : Modifier = Modifier ,
8793) {
88- val (text, textColor) = if (buttonState) {
89- stringResource(id = R .string.lbs_button_pressed) to MaterialTheme .colorScheme.primary.copy(alpha = 0.6f )
90- } else {
91- stringResource(id = R .string.lbs_button_released) to MaterialTheme .colorScheme.primary
92- }
9394 ScreenSection (
9495 modifier = modifier,
9596 ) {
9697 SectionTitle (
97- icon = Icons .Default .RadioButtonChecked ,
98+ icon = if (buttonState)
99+ Icons .Default .ModeStandby
100+ else Icons .Default .RadioButtonChecked ,
98101 title = stringResource(id = R .string.lbs_button),
99- tint = textColor,
100102 )
101103 Row {
102104 Text (
@@ -105,7 +107,9 @@ private fun ButtonControlView(
105107 modifier = Modifier .weight(1f )
106108 )
107109 Text (
108- text = text,
110+ text = if (buttonState)
111+ stringResource(id = R .string.lbs_button_pressed)
112+ else stringResource(id = R .string.lbs_button_released),
109113 style = MaterialTheme .typography.bodyLarge,
110114 )
111115 }
@@ -116,7 +120,7 @@ private fun ButtonControlView(
116120@Composable
117121private fun LecControlViewPreview () {
118122 LedControlView (
119- ledState = true ,
123+ ledState = false ,
120124 onStateChanged = {},
121125 )
122126}
@@ -125,6 +129,6 @@ private fun LecControlViewPreview() {
125129@Composable
126130private fun ButtonControlViewPreview () {
127131 ButtonControlView (
128- buttonState = true ,
132+ buttonState = false ,
129133 )
130134}
0 commit comments