mirror of
https://github.com/home-assistant/android
synced 2024-07-23 03:14:14 +00:00
Only show unit of measurement if we have it and if the state is not a string while managing sensors (#3685)
* Only show unit of measurement if we have it and if the state is not a string * Remove parentheses
This commit is contained in:
parent
7e12eaee3a
commit
8cc594e945
|
@ -312,7 +312,7 @@ fun SensorDetailTopPanel(
|
|||
if (sensor.state.isBlank()) {
|
||||
stringResource(commonR.string.enabled)
|
||||
} else {
|
||||
if (sensor.unitOfMeasurement.isNullOrBlank()) {
|
||||
if (sensor.unitOfMeasurement.isNullOrBlank() || sensor.state.toDoubleOrNull() == null) {
|
||||
sensor.state
|
||||
} else {
|
||||
"${sensor.state} ${sensor.unitOfMeasurement}"
|
||||
|
|
|
@ -100,7 +100,7 @@ fun SensorRow(
|
|||
if (dbSensor.state.isBlank()) {
|
||||
stringResource(commonR.string.enabled)
|
||||
} else {
|
||||
if (basicSensor.unitOfMeasurement.isNullOrBlank()) {
|
||||
if (basicSensor.unitOfMeasurement.isNullOrBlank() || dbSensor.state.toDoubleOrNull() == null) {
|
||||
dbSensor.state
|
||||
} else {
|
||||
"${dbSensor.state} ${basicSensor.unitOfMeasurement}"
|
||||
|
|
Loading…
Reference in a new issue