mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-16 21:54:05 +02:00
show in graph the converted values
This commit is contained in:
@@ -348,6 +348,8 @@ public class ChartMeasurementView extends LineChart {
|
||||
}
|
||||
|
||||
public void refreshMeasurementList() {
|
||||
highlightValue(null, false); // deselect any highlighted value
|
||||
|
||||
if (scaleMeasurementList == null) {
|
||||
progressBar.setVisibility(GONE);
|
||||
return;
|
||||
@@ -366,7 +368,7 @@ public class ChartMeasurementView extends LineChart {
|
||||
|
||||
for (int i=0; i<scaleMeasurementList.size(); i++) {
|
||||
ScaleMeasurement measurement = scaleMeasurementList.get(i);
|
||||
float value = measurementView.getMeasurementValue(measurement);
|
||||
float value = measurementView.getConvertedMeasurementValue(measurement);
|
||||
|
||||
if (value == 0.0f) {
|
||||
continue;
|
||||
@@ -512,7 +514,7 @@ public class ChartMeasurementView extends LineChart {
|
||||
|
||||
for (int i=0; i<scaleMeasurementsAsTrendlineList.size(); i++) {
|
||||
ScaleMeasurement measurement = scaleMeasurementsAsTrendlineList.get(i);
|
||||
float value = measurementView.getMeasurementValue(measurement);
|
||||
float value = measurementView.getConvertedMeasurementValue(measurement);
|
||||
|
||||
Entry entry = new Entry();
|
||||
entry.setX(convertDateToInt(measurement.getDateTime()));
|
||||
|
@@ -241,6 +241,17 @@ public abstract class FloatMeasurementView extends MeasurementView {
|
||||
protected abstract float getMeasurementValue(ScaleMeasurement measurement);
|
||||
protected abstract void setMeasurementValue(float value, ScaleMeasurement measurement);
|
||||
|
||||
public float getConvertedMeasurementValue(ScaleMeasurement measurement) {
|
||||
updateUserConvertedWeight(measurement);
|
||||
|
||||
float convertedValue = getMeasurementValue(measurement);
|
||||
convertedValue = maybeConvertValue(convertedValue);
|
||||
convertedValue = clampValue(convertedValue);
|
||||
convertedValue = roundValue(convertedValue);
|
||||
|
||||
return convertedValue;
|
||||
}
|
||||
|
||||
public abstract String getUnit();
|
||||
protected abstract float getMaxValue();
|
||||
protected int getDecimalPlaces() {
|
||||
@@ -350,21 +361,12 @@ public abstract class FloatMeasurementView extends MeasurementView {
|
||||
float newPreviousValue = NO_VALUE;
|
||||
|
||||
if (!useAutoValue()) {
|
||||
updateUserConvertedWeight(measurement);
|
||||
|
||||
newValue = getMeasurementValue(measurement);
|
||||
newValue = maybeConvertValue(newValue);
|
||||
newValue = clampValue(newValue);
|
||||
newValue = roundValue(newValue);
|
||||
newValue = getConvertedMeasurementValue(measurement);
|
||||
|
||||
if (previousMeasurement != null) {
|
||||
float saveUserConvertedWeight = userConvertedWeight;
|
||||
updateUserConvertedWeight(previousMeasurement);
|
||||
|
||||
newPreviousValue = getMeasurementValue(previousMeasurement);
|
||||
newPreviousValue = maybeConvertValue(newPreviousValue);
|
||||
newPreviousValue = clampValue(newPreviousValue);
|
||||
newPreviousValue = roundValue(newPreviousValue);
|
||||
newPreviousValue = getConvertedMeasurementValue(previousMeasurement);
|
||||
|
||||
userConvertedWeight = saveUserConvertedWeight;
|
||||
}
|
||||
|
Reference in New Issue
Block a user