mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-27 10:15:00 +02:00
Use new settings class to get hold of estimation settings
This commit is contained in:
@@ -47,6 +47,10 @@ import com.health.openscale.core.datatypes.ScaleUser;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
import com.health.openscale.core.utils.CsvHelper;
|
||||
import com.health.openscale.gui.fragments.FragmentUpdateListener;
|
||||
import com.health.openscale.gui.views.FatMeasurementView;
|
||||
import com.health.openscale.gui.views.LBWMeasurementView;
|
||||
import com.health.openscale.gui.views.MeasurementViewSettings;
|
||||
import com.health.openscale.gui.views.WaterMeasurementView;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
@@ -254,21 +258,24 @@ public class OpenScale {
|
||||
}
|
||||
}
|
||||
|
||||
if (prefs.getBoolean("estimateWaterEnable", false)) {
|
||||
EstimatedWaterMetric waterMetric = EstimatedWaterMetric.getEstimatedMetric(EstimatedWaterMetric.FORMULA.valueOf(prefs.getString("estimateWaterFormula", "TBW_LEESONGKIM")));
|
||||
|
||||
MeasurementViewSettings settings = new MeasurementViewSettings(prefs, WaterMeasurementView.KEY);
|
||||
if (settings.isEstimationEnabled()) {
|
||||
EstimatedWaterMetric waterMetric = EstimatedWaterMetric.getEstimatedMetric(
|
||||
EstimatedWaterMetric.FORMULA.valueOf(settings.getEstimationFormula()));
|
||||
scaleMeasurement.setWater(waterMetric.getWater(getScaleUser(scaleMeasurement.getUserId()), scaleMeasurement));
|
||||
}
|
||||
|
||||
if (prefs.getBoolean("estimateLBWEnable", false)) {
|
||||
EstimatedLBWMetric lbwMetric = EstimatedLBWMetric.getEstimatedMetric(EstimatedLBWMetric.FORMULA.valueOf(prefs.getString("estimateLBWFormula", "LBW_HUME")));
|
||||
|
||||
settings = new MeasurementViewSettings(prefs, LBWMeasurementView.KEY);
|
||||
if (settings.isEstimationEnabled()) {
|
||||
EstimatedLBWMetric lbwMetric = EstimatedLBWMetric.getEstimatedMetric(
|
||||
EstimatedLBWMetric.FORMULA.valueOf(settings.getEstimationFormula()));
|
||||
scaleMeasurement.setLbw(lbwMetric.getLBW(getScaleUser(scaleMeasurement.getUserId()), scaleMeasurement));
|
||||
}
|
||||
|
||||
if (prefs.getBoolean("estimateFatEnable", false)) {
|
||||
EstimatedFatMetric fatMetric = EstimatedFatMetric.getEstimatedMetric(EstimatedFatMetric.FORMULA.valueOf(prefs.getString("estimateFatFormula", "BF_GALLAGHER")));
|
||||
|
||||
settings = new MeasurementViewSettings(prefs, FatMeasurementView.KEY);
|
||||
if (settings.isEstimationEnabled()) {
|
||||
EstimatedFatMetric fatMetric = EstimatedFatMetric.getEstimatedMetric(
|
||||
EstimatedFatMetric.FORMULA.valueOf(settings.getEstimationFormula()));
|
||||
scaleMeasurement.setFat(fatMetric.getFat(getScaleUser(scaleMeasurement.getUserId()), scaleMeasurement));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user