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:
@@ -219,19 +219,13 @@ public abstract class MeasurementView extends TableLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void incValue() {
|
public void incValue() {
|
||||||
float incValue = getValue() + 0.1f;
|
float incValue = Math.min(getMaxValue(), getValue() + 0.1f);
|
||||||
|
setValueOnView(dateTime, incValue);
|
||||||
if (incValue <= getMaxValue()) {
|
|
||||||
setValueOnView(dateTime, incValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void decValue() {
|
public void decValue() {
|
||||||
float decValue = getValue() - 0.1f;
|
float decValue = Math.max(0.0f, getValue() - 0.1f);
|
||||||
|
setValueOnView(dateTime, decValue);
|
||||||
if (decValue >= 0) {
|
|
||||||
setValueOnView(dateTime, decValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValueAsString() {
|
public String getValueAsString() {
|
||||||
|
Reference in New Issue
Block a user