1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-23 16:53:04 +02:00

Make incValue and decValue handle edge case better

Instead of blocking a dec when the value is 0.01, set it to 0. Similar
for incValue.
This commit is contained in:
Erik Johansson
2017-11-22 22:51:03 +01:00
parent 5002f739c1
commit 82ec4863ef

View File

@@ -219,20 +219,14 @@ public abstract class MeasurementView extends TableLayout {
}
public void incValue() {
float incValue = getValue() + 0.1f;
if (incValue <= getMaxValue()) {
float incValue = Math.min(getMaxValue(), getValue() + 0.1f);
setValueOnView(dateTime, incValue);
}
}
public void decValue() {
float decValue = getValue() - 0.1f;
if (decValue >= 0) {
float decValue = Math.max(0.0f, getValue() - 0.1f);
setValueOnView(dateTime, decValue);
}
}
public String getValueAsString() {
return value;