mirror of
https://github.com/oliexdev/openScale.git
synced 2025-10-29 14:47:19 +01:00
Handle display of text and user input types in MeasurementDetailScreen
This commit is contained in:
@@ -570,14 +570,10 @@ fun MeasurementValueEditRow(
|
|||||||
Spacer(modifier = Modifier.width(12.dp))
|
Spacer(modifier = Modifier.width(12.dp))
|
||||||
Column(modifier = Modifier.weight(1f)) {
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
Text(text = type.getDisplayName(context), style = MaterialTheme.typography.bodyLarge)
|
Text(text = type.getDisplayName(context), style = MaterialTheme.typography.bodyLarge)
|
||||||
val displayText = if (type.inputType == InputFieldType.FLOAT || type.inputType == InputFieldType.INT) {
|
val displayText = when (type.inputType) {
|
||||||
if (type.unit != UnitType.NONE) {
|
InputFieldType.FLOAT, InputFieldType.INT -> LocaleUtils.formatValueForDisplay(value, type.unit)
|
||||||
LocaleUtils.formatValueForDisplay(value, type.unit)
|
InputFieldType.TEXT, InputFieldType.USER, InputFieldType.DATE, InputFieldType.TIME -> value
|
||||||
} else {
|
else -> ""
|
||||||
"" // No unit if UnitType.NONE
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
"" // No unit for non-numeric types
|
|
||||||
}
|
}
|
||||||
Text(
|
Text(
|
||||||
text = displayText,
|
text = displayText,
|
||||||
|
|||||||
Reference in New Issue
Block a user