From 11bd536caa8528cd150861f0a4575c9651eebc30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sylwester=20Zieli=C5=84ski?= Date: Tue, 30 Nov 2021 16:19:18 +0100 Subject: [PATCH] Change radio buttons in glucose to normal buttons --- .../android/gls/view/GLSContentView.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/profile_gls/src/main/java/no/nordicsemi/android/gls/view/GLSContentView.kt b/profile_gls/src/main/java/no/nordicsemi/android/gls/view/GLSContentView.kt index 63c40a97..6614096e 100644 --- a/profile_gls/src/main/java/no/nordicsemi/android/gls/view/GLSContentView.kt +++ b/profile_gls/src/main/java/no/nordicsemi/android/gls/view/GLSContentView.kt @@ -1,6 +1,8 @@ package no.nordicsemi.android.gls.view +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -21,7 +23,6 @@ import no.nordicsemi.android.gls.viewmodel.GLSScreenViewEvent import no.nordicsemi.android.gls.viewmodel.OnWorkingModeSelected import no.nordicsemi.android.theme.view.BatteryLevelView import no.nordicsemi.android.theme.view.ScreenSection -import no.nordicsemi.android.theme.view.SelectItemRadioGroup @Composable internal fun GLSContentView(state: GLSData, onEvent: (GLSScreenViewEvent) -> Unit) { @@ -55,8 +56,15 @@ internal fun GLSContentView(state: GLSData, onEvent: (GLSScreenViewEvent) -> Uni @Composable private fun SettingsView(state: GLSData, onEvent: (GLSScreenViewEvent) -> Unit) { ScreenSection { - SelectItemRadioGroup(state.selectedMode, state.modeItems()) { - onEvent(OnWorkingModeSelected(it.unit)) + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.SpaceEvenly + ) { + state.modeItems().forEach { + Button(onClick = { onEvent(OnWorkingModeSelected(it.unit)) }) { + Text(it.label) + } + } } } } @@ -66,7 +74,7 @@ private fun RecordsView(state: GLSData) { ScreenSection { Column(modifier = Modifier.fillMaxWidth()) { state.records.forEach { - Text(text = String.format("Glocose concentration: ", it.glucoseConcentration)) + Text(text = String.format("Glucose concentration: ", it.glucoseConcentration)) } } }