mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2026-01-31 04:24:24 +01:00
Fix UI screens
This commit is contained in:
@@ -14,25 +14,4 @@ data class BPSData(
|
||||
val systolic: Float = 0f,
|
||||
val diastolic: Float = 0f,
|
||||
val meanArterialPressure: Float = 0f,
|
||||
) {
|
||||
|
||||
fun displaySystolic(): String {
|
||||
return "$systolic"
|
||||
}
|
||||
|
||||
fun displayDiastolic(): String {
|
||||
return "$diastolic"
|
||||
}
|
||||
|
||||
fun displayMeanArterialPressure(): String {
|
||||
return "$meanArterialPressure"
|
||||
}
|
||||
|
||||
fun displayPulse(): String {
|
||||
return "$pulseRate"
|
||||
}
|
||||
|
||||
fun displayTimeData(): String {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package no.nordicsemi.android.bps.view
|
||||
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.height
|
||||
@@ -21,8 +20,6 @@ internal fun BPSContentView(state: BPSData, onEvent: (BPSScreenViewEvent) -> Uni
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
modifier = Modifier.padding(16.dp)
|
||||
) {
|
||||
Log.d("AAATESTAAA", "state: $state")
|
||||
|
||||
BPSSensorsReadingView(state = state)
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package no.nordicsemi.android.bps.view
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import no.nordicsemi.android.bps.R
|
||||
import no.nordicsemi.android.bps.data.BPSData
|
||||
|
||||
@Composable
|
||||
fun BPSData.displaySystolic(): String {
|
||||
return stringResource(id = R.string.bps_blood_pressure, systolic)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun BPSData.displayDiastolic(): String {
|
||||
return stringResource(id = R.string.bps_blood_pressure, diastolic)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun BPSData.displayMeanArterialPressure(): String {
|
||||
return stringResource(id = R.string.bps_blood_pressure, meanArterialPressure)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun BPSData.displayHeartRate(): String? {
|
||||
return pulseRate?.toString()
|
||||
}
|
||||
@@ -19,17 +19,18 @@ import no.nordicsemi.android.theme.view.SectionTitle
|
||||
internal fun BPSSensorsReadingView(state: BPSData) {
|
||||
ScreenSection {
|
||||
Column {
|
||||
SectionTitle(resId = R.drawable.ic_records, title = "Records")
|
||||
SectionTitle(resId = R.drawable.ic_records, title = stringResource(id = R.string.bps_records))
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
KeyValueField(stringResource(id = R.string.bps_systolic), state.displaySystolic())
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
KeyValueField(stringResource(id = R.string.bps_diastolic), state.displayDiastolic())
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
KeyValueField(stringResource(id = R.string.bps_mean), state.displayMeanArterialPressure())
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
KeyValueField(stringResource(id = R.string.bps_pulse), state.displayPulse())
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
KeyValueField(stringResource(id = R.string.bps_time_data), state.displayTimeData())
|
||||
|
||||
state.displayHeartRate()?.let {
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
KeyValueField(stringResource(id = R.string.bps_pulse), it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,13 @@
|
||||
<resources>
|
||||
<string name="bps_title">Blood pressure</string>
|
||||
|
||||
<string name="bps_records">Records</string>
|
||||
|
||||
<string name="bps_systolic">Systolic</string>
|
||||
<string name="bps_diastolic">Diastolic</string>
|
||||
<string name="bps_mean">Mean ap</string>
|
||||
<string name="bps_pulse">Pulse</string>
|
||||
<string name="bps_mean">Mean AP</string>
|
||||
<string name="bps_pulse">Heart rate</string>
|
||||
<string name="bps_time_data">Time and Date</string>
|
||||
|
||||
<string name="bps_blood_pressure">%.0f kPa</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user