Merge remote-tracking branch 'origin/master'
@@ -57,7 +57,7 @@
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "lbw",
|
||||
"fieldPath": "lbm",
|
||||
"columnName": "lbw",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
|
@@ -141,7 +141,7 @@ public class ScreenshotRecorder {
|
||||
private List<ScaleMeasurement> getTestMeasurements() {
|
||||
List<ScaleMeasurement> scaleMeasurementList = new ArrayList<>();
|
||||
|
||||
String data = "\"dateTime\",\"weight\",\"fat\",\"water\",\"muscle\",\"lbw\",\"bone\",\"waist\",\"hip\",\"comment\"\n" +
|
||||
String data = "\"dateTime\",\"weight\",\"fat\",\"water\",\"muscle\",\"lbm\",\"bone\",\"waist\",\"hip\",\"comment\"\n" +
|
||||
"04.08.2015 08:08,89.7,21.2,58.0,41.5\n" +
|
||||
"03.08.2015 05:17,89.0,26.4,54.6,41.6\n" +
|
||||
"02.08.2015 07:32,88.8,25.0,55.6,41.7\n" +
|
||||
|
@@ -36,7 +36,7 @@ import com.health.openscale.core.alarm.AlarmHandler;
|
||||
import com.health.openscale.core.bluetooth.BluetoothCommunication;
|
||||
import com.health.openscale.core.bluetooth.BluetoothFactory;
|
||||
import com.health.openscale.core.bodymetric.EstimatedFatMetric;
|
||||
import com.health.openscale.core.bodymetric.EstimatedLBWMetric;
|
||||
import com.health.openscale.core.bodymetric.EstimatedLBMMetric;
|
||||
import com.health.openscale.core.bodymetric.EstimatedWaterMetric;
|
||||
import com.health.openscale.core.database.AppDatabase;
|
||||
import com.health.openscale.core.database.ScaleDatabase;
|
||||
@@ -49,7 +49,7 @@ 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.LBMMeasurementView;
|
||||
import com.health.openscale.gui.views.MeasurementViewSettings;
|
||||
import com.health.openscale.gui.views.WaterMeasurementView;
|
||||
|
||||
@@ -271,11 +271,11 @@ public class OpenScale {
|
||||
scaleMeasurement.setWater(waterMetric.getWater(getScaleUser(scaleMeasurement.getUserId()), scaleMeasurement));
|
||||
}
|
||||
|
||||
settings = new MeasurementViewSettings(prefs, LBWMeasurementView.KEY);
|
||||
settings = new MeasurementViewSettings(prefs, LBMMeasurementView.KEY);
|
||||
if (settings.isEnabled() && settings.isEstimationEnabled()) {
|
||||
EstimatedLBWMetric lbwMetric = EstimatedLBWMetric.getEstimatedMetric(
|
||||
EstimatedLBWMetric.FORMULA.valueOf(settings.getEstimationFormula()));
|
||||
scaleMeasurement.setLbw(lbwMetric.getLBW(getScaleUser(scaleMeasurement.getUserId()), scaleMeasurement));
|
||||
EstimatedLBMMetric lbmMetric = EstimatedLBMMetric.getEstimatedMetric(
|
||||
EstimatedLBMMetric.FORMULA.valueOf(settings.getEstimationFormula()));
|
||||
scaleMeasurement.setLbm(lbmMetric.getLBM(getScaleUser(scaleMeasurement.getUserId()), scaleMeasurement));
|
||||
}
|
||||
|
||||
settings = new MeasurementViewSettings(prefs, FatMeasurementView.KEY);
|
||||
|
@@ -19,6 +19,7 @@ import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.datatypes.ScaleUser;
|
||||
|
||||
public abstract class EstimatedFatMetric {
|
||||
// Don't change enum names, they are stored persistent in preferences
|
||||
public enum FORMULA { BF_DEURENBERG, BF_DEURENBERG_II, BF_EDDY, BF_GALLAGHER, BF_GALLAGHER_ASIAN }
|
||||
|
||||
public static EstimatedFatMetric getEstimatedMetric(FORMULA metric) {
|
||||
|
@@ -18,20 +18,21 @@ package com.health.openscale.core.bodymetric;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.datatypes.ScaleUser;
|
||||
|
||||
public abstract class EstimatedLBWMetric {
|
||||
public abstract class EstimatedLBMMetric {
|
||||
// Don't change enum names, they are stored persistent in preferences
|
||||
public enum FORMULA { LBW_HUME, LBW_BOER }
|
||||
|
||||
public static EstimatedLBWMetric getEstimatedMetric(FORMULA metric) {
|
||||
public static EstimatedLBMMetric getEstimatedMetric(FORMULA metric) {
|
||||
switch (metric) {
|
||||
case LBW_HUME:
|
||||
return new LBWHume();
|
||||
return new LBMHume();
|
||||
case LBW_BOER:
|
||||
return new LBWBoer();
|
||||
return new LBMBoer();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract String getName();
|
||||
public abstract float getLBW(ScaleUser user, ScaleMeasurement data);
|
||||
public abstract float getLBM(ScaleUser user, ScaleMeasurement data);
|
||||
}
|
@@ -19,6 +19,7 @@ import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.datatypes.ScaleUser;
|
||||
|
||||
public abstract class EstimatedWaterMetric {
|
||||
// Don't change enum names, they are stored persistent in preferences
|
||||
public enum FORMULA { TBW_BEHNKE, TBW_DELWAIDECRENIER, TBW_HUMEWEYERS, TBW_LEESONGKIM }
|
||||
|
||||
public static EstimatedWaterMetric getEstimatedMetric(FORMULA metric) {
|
||||
|
@@ -19,14 +19,14 @@ package com.health.openscale.core.bodymetric;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.datatypes.ScaleUser;
|
||||
|
||||
public class LBWBoer extends EstimatedLBWMetric {
|
||||
public class LBMBoer extends EstimatedLBMMetric {
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Boer (1984)";
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLBW(ScaleUser user, ScaleMeasurement data) {
|
||||
public float getLBM(ScaleUser user, ScaleMeasurement data) {
|
||||
if (user.getGender().isMale()) {
|
||||
return (0.4071f * data.getWeight()) + (0.267f * user.getBodyHeight()) - 19.2f;
|
||||
}
|
@@ -19,14 +19,14 @@ package com.health.openscale.core.bodymetric;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.datatypes.ScaleUser;
|
||||
|
||||
public class LBWHume extends EstimatedLBWMetric {
|
||||
public class LBMHume extends EstimatedLBMMetric {
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Hume (1966)";
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLBW(ScaleUser user, ScaleMeasurement data) {
|
||||
public float getLBM(ScaleUser user, ScaleMeasurement data) {
|
||||
if (user.getGender().isMale()) {
|
||||
return (0.32810f * data.getWeight()) + (0.33929f * user.getBodyHeight()) - 29.5336f;
|
||||
}
|
@@ -32,6 +32,9 @@ public abstract class AppDatabase extends RoomDatabase {
|
||||
public abstract ScaleMeasurementDAO measurementDAO();
|
||||
public abstract ScaleUserDAO userDAO();
|
||||
|
||||
// For the next database version:
|
||||
// - rename lbw column to lbm
|
||||
|
||||
public static final Migration MIGRATION_1_2 = new Migration(1, 2) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase database) {
|
||||
|
@@ -161,7 +161,7 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
scaleMeasurement.setFat(cur.getFloat(cur.getColumnIndexOrThrow(COLUMN_NAME_FAT)));
|
||||
scaleMeasurement.setWater(cur.getFloat(cur.getColumnIndexOrThrow(COLUMN_NAME_WATER)));
|
||||
scaleMeasurement.setMuscle(cur.getFloat(cur.getColumnIndexOrThrow(COLUMN_NAME_MUSCLE)));
|
||||
scaleMeasurement.setLbw(cur.getFloat(cur.getColumnIndexOrThrow(COLUMN_NAME_LBW)));
|
||||
scaleMeasurement.setLbm(cur.getFloat(cur.getColumnIndexOrThrow(COLUMN_NAME_LBW)));
|
||||
scaleMeasurement.setBone(cur.getFloat(cur.getColumnIndexOrThrow(COLUMN_NAME_BONE)));
|
||||
scaleMeasurement.setWaist(cur.getFloat(cur.getColumnIndexOrThrow(COLUMN_NAME_WAIST)));
|
||||
scaleMeasurement.setHip(cur.getFloat(cur.getColumnIndexOrThrow(COLUMN_NAME_HIP)));
|
||||
|
@@ -62,7 +62,7 @@ public class ScaleMeasurement implements Cloneable {
|
||||
private float muscle;
|
||||
@CsvColumn
|
||||
@ColumnInfo(name = "lbw")
|
||||
private float lbw;
|
||||
private float lbm;
|
||||
@CsvColumn
|
||||
@ColumnInfo(name = "waist")
|
||||
private float waist;
|
||||
@@ -85,7 +85,7 @@ public class ScaleMeasurement implements Cloneable {
|
||||
fat = 0.0f;
|
||||
water = 0.0f;
|
||||
muscle = 0.0f;
|
||||
lbw = 0.0f;
|
||||
lbm = 0.0f;
|
||||
bone = 0.0f;
|
||||
waist = 0.0f;
|
||||
hip = 0.0f;
|
||||
@@ -231,12 +231,12 @@ public class ScaleMeasurement implements Cloneable {
|
||||
this.muscle = muscle;
|
||||
}
|
||||
|
||||
public float getLbw() {
|
||||
return lbw;
|
||||
public float getLbm() {
|
||||
return lbm;
|
||||
}
|
||||
|
||||
public void setLbw(float lbw) {
|
||||
this.lbw = lbw;
|
||||
public void setLbm(float lbm) {
|
||||
this.lbm = lbm;
|
||||
}
|
||||
|
||||
public float getWaist() {
|
||||
@@ -301,8 +301,8 @@ public class ScaleMeasurement implements Cloneable {
|
||||
{
|
||||
return String.format(
|
||||
"ID: %d, USER_ID: %d, DATE_TIME: %s, WEIGHT: %.2f, FAT: %.2f, WATER: %.2f, " +
|
||||
"MUSCLE: %.2f, LBW: %.2f, WAIST: %.2f, HIP: %.2f, BONE: %.2f, COMMENT: %s",
|
||||
"MUSCLE: %.2f, LBM: %.2f, WAIST: %.2f, HIP: %.2f, BONE: %.2f, COMMENT: %s",
|
||||
id, userId, dateTime.toString(), weight, fat, water,
|
||||
muscle, lbw, waist, hip, bone, comment);
|
||||
muscle, lbm, waist, hip, bone, comment);
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package com.health.openscale.core.utils;
|
||||
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.j256.simplecsv.processor.ColumnNameMatcher;
|
||||
import com.j256.simplecsv.processor.CsvProcessor;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -44,31 +45,31 @@ public class CsvHelper {
|
||||
if (fields.length == 10) {
|
||||
// From version 1.6 up to 1.7
|
||||
return new String[]{
|
||||
"dateTime", "weight", "fat", "water", "muscle", "lbw", "bone", "waist", "hip", "comment"};
|
||||
"dateTime", "weight", "fat", "water", "muscle", "lbm", "bone", "waist", "hip", "comment"};
|
||||
}
|
||||
else if (fields.length == 9) {
|
||||
// From version 1.5.5 (lbw unused)
|
||||
// From version 1.5.5 (lbm unused)
|
||||
return new String[]{
|
||||
"dateTime", "weight", "fat", "water", "muscle", "bone", "waist", "hip", "comment",
|
||||
"lbw"};
|
||||
"lbm"};
|
||||
}
|
||||
else if (fields.length == 8) {
|
||||
// From version 1.3 (lbw and bone unused)
|
||||
// From version 1.3 (lbm and bone unused)
|
||||
return new String[]{
|
||||
"dateTime", "weight", "fat", "water", "muscle", "waist", "hip", "comment",
|
||||
"lbw", "bone"};
|
||||
"lbm", "bone"};
|
||||
}
|
||||
else if (fields.length == 6) {
|
||||
// From version 1.2 (lbw, bone, waist and hip unused)
|
||||
// From version 1.2 (lbm, bone, waist and hip unused)
|
||||
return new String[]{
|
||||
"dateTime", "weight", "fat", "water", "muscle", "comment",
|
||||
"lbw", "bone", "waist", "hip"};
|
||||
"lbm", "bone", "waist", "hip"};
|
||||
}
|
||||
else if (fields.length == 5) {
|
||||
// From version 1.0 (lbw, bone, waist, hip and muscle unused)
|
||||
// From version 1.0 (lbm, bone, waist, hip and muscle unused)
|
||||
return new String[]{
|
||||
"dateTime", "weight", "fat", "water", "comment",
|
||||
"lbw", "bone", "waist", "hip", "muscle"};
|
||||
"lbm", "bone", "waist", "hip", "muscle"};
|
||||
}
|
||||
|
||||
// Unknown input data format
|
||||
@@ -84,6 +85,14 @@ public class CsvHelper {
|
||||
.withAlwaysTrimInput(true)
|
||||
.withAllowPartialLines(true);
|
||||
|
||||
csvProcessor.setColumnNameMatcher(new ColumnNameMatcher() {
|
||||
@Override
|
||||
public boolean matchesColumnName(String definitionName, String csvName) {
|
||||
return definitionName.equals(csvName)
|
||||
|| (definitionName.equals("lbm") && csvName.equals("lbw"));
|
||||
}
|
||||
});
|
||||
|
||||
reader.mark(1000);
|
||||
try {
|
||||
csvProcessor.readHeader(reader, null);
|
||||
|
@@ -36,7 +36,7 @@ import com.health.openscale.core.utils.DateTimeHelpers;
|
||||
import com.health.openscale.gui.views.BoneMeasurementView;
|
||||
import com.health.openscale.gui.views.FatMeasurementView;
|
||||
import com.health.openscale.gui.views.HipMeasurementView;
|
||||
import com.health.openscale.gui.views.LBWMeasurementView;
|
||||
import com.health.openscale.gui.views.LBMMeasurementView;
|
||||
import com.health.openscale.gui.views.MeasurementView;
|
||||
import com.health.openscale.gui.views.MuscleMeasurementView;
|
||||
import com.health.openscale.gui.views.WaistMeasurementView;
|
||||
@@ -98,7 +98,7 @@ public class StatisticsFragment extends Fragment implements FragmentUpdateListen
|
||||
viewMeasurementsListWeek.add(new WeightMeasurementView(statisticsView.getContext()));
|
||||
viewMeasurementsListWeek.add(new WaterMeasurementView(statisticsView.getContext()));
|
||||
viewMeasurementsListWeek.add(new MuscleMeasurementView(statisticsView.getContext()));
|
||||
viewMeasurementsListWeek.add(new LBWMeasurementView(statisticsView.getContext()));
|
||||
viewMeasurementsListWeek.add(new LBMMeasurementView(statisticsView.getContext()));
|
||||
viewMeasurementsListWeek.add(new FatMeasurementView(statisticsView.getContext()));
|
||||
viewMeasurementsListWeek.add(new BoneMeasurementView(statisticsView.getContext()));
|
||||
viewMeasurementsListWeek.add(new WaistMeasurementView(statisticsView.getContext()));
|
||||
@@ -128,7 +128,7 @@ public class StatisticsFragment extends Fragment implements FragmentUpdateListen
|
||||
viewMeasurementsListMonth.add(new WeightMeasurementView(statisticsView.getContext()));
|
||||
viewMeasurementsListMonth.add(new WaterMeasurementView(statisticsView.getContext()));
|
||||
viewMeasurementsListMonth.add(new MuscleMeasurementView(statisticsView.getContext()));
|
||||
viewMeasurementsListMonth.add(new LBWMeasurementView(statisticsView.getContext()));
|
||||
viewMeasurementsListMonth.add(new LBMMeasurementView(statisticsView.getContext()));
|
||||
viewMeasurementsListMonth.add(new FatMeasurementView(statisticsView.getContext()));
|
||||
viewMeasurementsListMonth.add(new BoneMeasurementView(statisticsView.getContext()));
|
||||
viewMeasurementsListMonth.add(new WaistMeasurementView(statisticsView.getContext()));
|
||||
|
@@ -25,6 +25,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class BMIMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "bmi";
|
||||
|
||||
public BMIMeasurementView(Context context) {
|
||||
|
@@ -27,6 +27,7 @@ import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
import java.util.Locale;
|
||||
|
||||
public class BMRMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "bmr";
|
||||
|
||||
public BMRMeasurementView(Context context) {
|
||||
|
@@ -25,6 +25,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class BoneMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "bone";
|
||||
|
||||
public BoneMeasurementView(Context context) {
|
||||
|
@@ -26,6 +26,7 @@ import com.health.openscale.R;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
|
||||
public class CommentMeasurementView extends MeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "comment";
|
||||
|
||||
private String comment;
|
||||
|
@@ -29,6 +29,7 @@ import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class DateMeasurementView extends MeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "date";
|
||||
|
||||
private static final DateFormat dateFormat = DateFormat.getDateInstance();
|
||||
|
@@ -27,6 +27,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class FatMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "fat";
|
||||
|
||||
public FatMeasurementView(Context context) {
|
||||
|
@@ -25,6 +25,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class HipMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "hip";
|
||||
|
||||
public HipMeasurementView(Context context) {
|
||||
|
@@ -21,16 +21,17 @@ import android.preference.ListPreference;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.bodymetric.EstimatedLBWMetric;
|
||||
import com.health.openscale.core.bodymetric.EstimatedLBMMetric;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class LBWMeasurementView extends FloatMeasurementView {
|
||||
public class LBMMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "lbw";
|
||||
|
||||
public LBWMeasurementView(Context context) {
|
||||
super(context, context.getResources().getString(R.string.label_lbw), ContextCompat.getDrawable(context, R.drawable.ic_lbw));
|
||||
public LBMMeasurementView(Context context) {
|
||||
super(context, context.getResources().getString(R.string.label_lbm), ContextCompat.getDrawable(context, R.drawable.ic_lbm));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,12 +41,12 @@ public class LBWMeasurementView extends FloatMeasurementView {
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getLbw();
|
||||
return measurement.getLbm();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setLbw(value);
|
||||
measurement.setLbm(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,12 +69,12 @@ public class LBWMeasurementView extends FloatMeasurementView {
|
||||
|
||||
@Override
|
||||
protected void prepareEstimationFormulaPreference(ListPreference preference) {
|
||||
String[] entries = new String[EstimatedLBWMetric.FORMULA.values().length];
|
||||
String[] entries = new String[EstimatedLBMMetric.FORMULA.values().length];
|
||||
String[] values = new String[entries.length];
|
||||
|
||||
int idx = 0;
|
||||
for (EstimatedLBWMetric.FORMULA formula : EstimatedLBWMetric.FORMULA.values()) {
|
||||
entries[idx] = EstimatedLBWMetric.getEstimatedMetric(formula).getName();
|
||||
for (EstimatedLBMMetric.FORMULA formula : EstimatedLBMMetric.FORMULA.values()) {
|
||||
entries[idx] = EstimatedLBMMetric.getEstimatedMetric(formula).getName();
|
||||
values[idx] = formula.name();
|
||||
++idx;
|
||||
}
|
@@ -106,7 +106,7 @@ public abstract class MeasurementView extends TableLayout {
|
||||
unsorted.add(new BMIMeasurementView(context));
|
||||
unsorted.add(new WaterMeasurementView(context));
|
||||
unsorted.add(new MuscleMeasurementView(context));
|
||||
unsorted.add(new LBWMeasurementView(context));
|
||||
unsorted.add(new LBMMeasurementView(context));
|
||||
unsorted.add(new FatMeasurementView(context));
|
||||
unsorted.add(new BoneMeasurementView(context));
|
||||
unsorted.add(new WaistMeasurementView(context));
|
||||
|
@@ -19,7 +19,7 @@ package com.health.openscale.gui.views;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import com.health.openscale.core.bodymetric.EstimatedFatMetric;
|
||||
import com.health.openscale.core.bodymetric.EstimatedLBWMetric;
|
||||
import com.health.openscale.core.bodymetric.EstimatedLBMMetric;
|
||||
import com.health.openscale.core.bodymetric.EstimatedWaterMetric;
|
||||
|
||||
public class MeasurementViewSettings {
|
||||
@@ -52,7 +52,7 @@ public class MeasurementViewSettings {
|
||||
case WeightMeasurementView.KEY:
|
||||
// Weight can't be disabled
|
||||
return true;
|
||||
case LBWMeasurementView.KEY:
|
||||
case LBMMeasurementView.KEY:
|
||||
case BoneMeasurementView.KEY:
|
||||
case WaistMeasurementView.KEY:
|
||||
case HipMeasurementView.KEY:
|
||||
@@ -137,7 +137,7 @@ public class MeasurementViewSettings {
|
||||
switch (key) {
|
||||
case FatMeasurementView.KEY:
|
||||
return "estimateFatEnable";
|
||||
case LBWMeasurementView.KEY:
|
||||
case LBMMeasurementView.KEY:
|
||||
return "estimateLBWEnable";
|
||||
case WaterMeasurementView.KEY:
|
||||
return "estimateWaterEnable";
|
||||
@@ -153,7 +153,7 @@ public class MeasurementViewSettings {
|
||||
switch (key) {
|
||||
case FatMeasurementView.KEY:
|
||||
return "estimateFatFormula";
|
||||
case LBWMeasurementView.KEY:
|
||||
case LBMMeasurementView.KEY:
|
||||
return "estimateLBWFormula";
|
||||
case WaterMeasurementView.KEY:
|
||||
return "estimateWaterFormula";
|
||||
@@ -167,8 +167,8 @@ public class MeasurementViewSettings {
|
||||
case FatMeasurementView.KEY:
|
||||
defaultValue = EstimatedFatMetric.FORMULA.BF_GALLAGHER.name();
|
||||
break;
|
||||
case LBWMeasurementView.KEY:
|
||||
defaultValue = EstimatedLBWMetric.FORMULA.LBW_HUME.name();
|
||||
case LBMMeasurementView.KEY:
|
||||
defaultValue = EstimatedLBMMetric.FORMULA.LBW_HUME.name();
|
||||
break;
|
||||
case WaterMeasurementView.KEY:
|
||||
defaultValue = EstimatedWaterMetric.FORMULA.TBW_LEESONGKIM.name();
|
||||
|
@@ -25,6 +25,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class MuscleMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "muscle";
|
||||
|
||||
public MuscleMeasurementView(Context context) {
|
||||
|
@@ -29,6 +29,7 @@ import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class TimeMeasurementView extends MeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "time";
|
||||
|
||||
private final DateFormat timeFormat;
|
||||
|
@@ -25,6 +25,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class WHRMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "whr";
|
||||
|
||||
public WHRMeasurementView(Context context) {
|
||||
|
@@ -25,6 +25,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class WHtRMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "whtr";
|
||||
|
||||
public WHtRMeasurementView(Context context) {
|
||||
|
@@ -25,6 +25,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class WaistMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "waist";
|
||||
|
||||
public WaistMeasurementView(Context context) {
|
||||
|
@@ -27,6 +27,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class WaterMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "water";
|
||||
|
||||
public WaterMeasurementView(Context context) {
|
||||
|
@@ -26,6 +26,7 @@ import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
|
||||
public class WeightMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "weight";
|
||||
|
||||
public WeightMeasurementView(Context context) {
|
||||
|
Before Width: | Height: | Size: 954 B After Width: | Height: | Size: 954 B |
Before Width: | Height: | Size: 367 B After Width: | Height: | Size: 367 B |
Before Width: | Height: | Size: 548 B After Width: | Height: | Size: 548 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
@@ -25,7 +25,7 @@
|
||||
<string name="label_fat">Percentatge de greix corporal</string>
|
||||
<string name="label_water">Percentatge d\'aigua</string>
|
||||
<string name="label_muscle">Percentatge muscular</string>
|
||||
<string name="label_lbw">Massa corporal magra</string>
|
||||
<string name="label_lbm">Massa corporal magra</string>
|
||||
<string name="label_waist">Circumferència de la cintura</string>
|
||||
<string name="label_hip">Circumferència del maluc</string>
|
||||
<string name="label_comment">Comentari</string>
|
||||
|
@@ -121,7 +121,7 @@
|
||||
<string name="info_step_on_scale">Bitte steigen Sie barfuß auf die Waage zur Referenzmessung</string>
|
||||
<string name="label_automatic">auto</string>
|
||||
<string name="label_category_measurement_database">Messwertedatenbank</string>
|
||||
<string name="label_lbw">Fettfreie Körpermasse</string>
|
||||
<string name="label_lbm">Fettfreie Körpermasse</string>
|
||||
<string name="label_license">Lizenz</string>
|
||||
<string name="label_maintainer">Hauptentwickler</string>
|
||||
<string name="label_website">Webseite</string>
|
||||
|
@@ -25,7 +25,7 @@
|
||||
<string name="label_fat">Porcentaje de grasa corporal</string>
|
||||
<string name="label_water">Porcentaje de agua</string>
|
||||
<string name="label_muscle">Porcentaje muscular</string>
|
||||
<string name="label_lbw">Masa corporal magra</string>
|
||||
<string name="label_lbm">Masa corporal magra</string>
|
||||
<string name="label_waist">Circunferencia de la cintura</string>
|
||||
<string name="label_hip">Circunferencia de la cadera</string>
|
||||
<string name="label_comment">Comentario</string>
|
||||
|
@@ -33,15 +33,15 @@
|
||||
<string name="label_comment">Kommentar</string>
|
||||
<string name="label_bone">Beinmasse</string>
|
||||
<string name="label_estimate_measurement_summary">Basert på vekt, høyde, alder, kjønn, etc.</string>
|
||||
<string name="label_lbw">Fettfri kroppsvekt</string>
|
||||
<string name="label_lbm">Fettfri kroppsvekt</string>
|
||||
<string name="label_whtr">Midje-til-høyde -forhold</string>
|
||||
<string name="label_whr">Midje-til-hofte -forhold</string>
|
||||
<string name="label_smartUserAssign">Smart brukertildeling</string>
|
||||
|
||||
<plurals name="label_days">
|
||||
<item quantity="one">%d dag</item>
|
||||
<item quantity="other">%d dager</item>
|
||||
</plurals>
|
||||
<item quantity="one">%d dag</item>
|
||||
<item quantity="other">%d dager</item>
|
||||
</plurals>
|
||||
<string name="label_last_week">De siste 7 dagene</string>
|
||||
<string name="label_last_month">De siste 30 dagene</string>
|
||||
<string name="label_weight_difference">Vektforskjell</string>
|
||||
|
@@ -27,7 +27,7 @@
|
||||
<string name="label_fat">Lichaamsvet</string>
|
||||
<string name="label_water">Lichaamsvocht</string>
|
||||
<string name="label_muscle">Spieren</string>
|
||||
<string name="label_lbw">Vetvrije massa</string>
|
||||
<string name="label_lbm">Vetvrije massa</string>
|
||||
<string name="label_waist">Taille-omtrek</string>
|
||||
<string name="label_hip">Heup-omtrek</string>
|
||||
<string name="label_comment">Commentaar</string>
|
||||
@@ -153,7 +153,7 @@
|
||||
<string name="info_step_on_scale">Stap alsjeblieft met blote voeten op de weegschaal voor een meting</string>
|
||||
<string name="info_measuring">Gewicht meten: %.2f</string>
|
||||
|
||||
<string name="title_general">Algemeen</string>
|
||||
<string name="title_general">Algemeen</string>
|
||||
|
||||
<string name="label_share">Delen</string>
|
||||
<string name="label_share_subject">openScale CSV data exporteren (%s)</string>
|
||||
|
@@ -30,7 +30,7 @@
|
||||
<string name="label_fat">Procent tkanki tłuszczowej</string>
|
||||
<string name="label_water">Procent wody w organizmie</string>
|
||||
<string name="label_muscle">Procent masy mięśniowej</string>
|
||||
<string name="label_lbw">Beztłuszczowa masa ciała</string>
|
||||
<string name="label_lbm">Beztłuszczowa masa ciała</string>
|
||||
<string name="label_waist">Obwód talii</string>
|
||||
<string name="label_hip">Obwód bioder</string>
|
||||
<string name="label_comment">Komentarz</string>
|
||||
|
@@ -124,7 +124,7 @@
|
||||
<string name="label_share_subject">Exportar dados openScale para CSV (%s)</string>
|
||||
|
||||
<string name="label_bmr">Taxa Metabólica Basal (TMB)</string>
|
||||
<string name="label_lbw">Massa Magra</string>
|
||||
<string name="label_lbm">Massa Magra</string>
|
||||
<string name="label_bone">Massa óssea</string>
|
||||
<string name="info_bluetooth_no_device_set">Sem dispositivo Bluetooth selecionado</string>
|
||||
<string name="info_new_data_added">%1$.2f%2$s [%3$s] para %4$s adicionado</string>
|
||||
|
@@ -58,7 +58,7 @@
|
||||
<string name="label_last_week">Senast 7 dagarna</string>
|
||||
<string name="label_last_month">Senast 30 dagarna</string>
|
||||
<string name="label_muscle">Muskler</string>
|
||||
<string name="label_lbw">Fettfri kroppsvikt</string>
|
||||
<string name="label_lbm">Fettfri kroppsvikt</string>
|
||||
<string name="label_waist">Midjemått</string>
|
||||
<string name="label_hip">Höftomkrets</string>
|
||||
<string name="label_comment">Kommentar</string>
|
||||
|
@@ -24,7 +24,7 @@
|
||||
<string name="label_fat">Vücüt Yað Yüzdesi</string>
|
||||
<string name="label_water">Su Yüzdesi</string>
|
||||
<string name="label_muscle">Kas Yüzdesi</string>
|
||||
<string name="label_lbw">Yaðsýz vücüt aðýrlýðý</string>
|
||||
<string name="label_lbm">Yaðsýz vücüt aðýrlýðý</string>
|
||||
<string name="label_waist">Bel çevresi</string>
|
||||
<string name="label_hip">Kalça çevresi</string>
|
||||
<string name="label_comment">Yorum</string>
|
||||
|
@@ -31,7 +31,7 @@
|
||||
<string name="label_fat">Body fat</string>
|
||||
<string name="label_water">Body water</string>
|
||||
<string name="label_muscle">Muscle</string>
|
||||
<string name="label_lbw">Lean body weight</string>
|
||||
<string name="label_lbm">Lean body mass</string>
|
||||
<string name="label_waist">Waist circumference</string>
|
||||
<string name="label_hip">Hip circumference</string>
|
||||
<string name="label_comment">Comment</string>
|
||||
@@ -70,48 +70,48 @@
|
||||
<string name="label_export">Export</string>
|
||||
<string name="label_delete_all">Delete all</string>
|
||||
|
||||
<string name="error_value_required">Value is required</string>
|
||||
<string name="error_value_range">The value is not in range</string>
|
||||
<string name="error_value_required">Value required</string>
|
||||
<string name="error_value_range">Value not in range</string>
|
||||
<string name="error_exporting">Error exporting</string>
|
||||
<string name="error_importing">Error importing</string>
|
||||
<string name="error_user_name_required">Error: user name is required</string>
|
||||
<string name="error_user_name_too_short">Error: user name have to be at least 3 characters</string>
|
||||
<string name="error_height_required">Error: height is required</string>
|
||||
<string name="error_initial_weight_required">Error: initial weight is required</string>
|
||||
<string name="error_goal_weight_required">Error: goal weight is required</string>
|
||||
<string name="error_user_name_required">Error: Name required</string>
|
||||
<string name="error_user_name_too_short">Error: Name must be 3 characters or longer</string>
|
||||
<string name="error_height_required">Error: Height required</string>
|
||||
<string name="error_initial_weight_required">Error: Initial weight required</string>
|
||||
<string name="error_goal_weight_required">Error: Goal weight required</string>
|
||||
|
||||
<string name="info_data_deleted">Database entry deleted</string>
|
||||
<string name="info_data_all_deleted">All database entries deleted</string>
|
||||
<string name="info_data_exported">Data exported to</string>
|
||||
<string name="info_data_imported">Data imported from</string>
|
||||
<string name="info_enter_value_cm">Enter value in cm</string>
|
||||
<string name="info_enter_comment">Enter an optional comment</string>
|
||||
<string name="info_enter_value_scale_unit">Enter value in scale unit</string>
|
||||
<string name="info_enter_value_cm">Value in cm</string>
|
||||
<string name="info_enter_comment">Optional comment</string>
|
||||
<string name="info_enter_value_scale_unit">Value in scale unit</string>
|
||||
<string name="info_is_visible">is visible</string>
|
||||
<string name="info_is_not_visible">is not visible</string>
|
||||
<string name="info_is_enable">is enabled</string>
|
||||
<string name="info_is_not_enable">is disabled</string>
|
||||
<string name="info_is_not_available">is not available</string>
|
||||
<string name="info_bluetooth_try_connection">Trying to connect to</string>
|
||||
<string name="info_bluetooth_try_connection">Connecting to</string>
|
||||
<string name="info_bluetooth_connection_lost">Lost Bluetooth connection</string>
|
||||
<string name="info_bluetooth_no_device">No Bluetooth device found</string>
|
||||
<string name="info_bluetooth_no_device_set">No Bluetooth device selected</string>
|
||||
<string name="info_bluetooth_connection_successful">Connection successful established</string>
|
||||
<string name="info_bluetooth_connection_successful">Connection established</string>
|
||||
<string name="info_bluetooth_init">Initialize Bluetooth device</string>
|
||||
<string name="info_bluetooth_connection_error">Bluetooth has an unexpected error</string>
|
||||
<string name="info_bluetooth_connection_error">Unexpected Bluetooth error</string>
|
||||
<string name="info_new_data_added">%1$.2f%2$s [%3$s] to %4$s added</string>
|
||||
<string name="info_new_data_duplicated">measurement with the same date and time already exist</string>
|
||||
|
||||
<string name="info_enter_user_name">Enter your name</string>
|
||||
<string name="info_no_selected_user">No user exists. Please create a new user in the settings.</string>
|
||||
<string name="info_no_evaluation_available">Can\'t evaluate the value</string>
|
||||
<string name="info_enter_user_name">Your name</string>
|
||||
<string name="info_no_selected_user">No user exists. Please create one in the settings.</string>
|
||||
<string name="info_no_evaluation_available">Could not evaluate the value</string>
|
||||
|
||||
<string name="question_really_delete">Do you really want to delete database entry?</string>
|
||||
<string name="question_really_delete_all">Do you really want to delete all database entries?</string>
|
||||
<string name="question_really_delete_user">Do you really want to delete the user? </string>
|
||||
|
||||
<string name="label_bluetooth_title">Bluetooth</string>
|
||||
<string name="label_bluetooth_enable">Search for scale on startup</string>
|
||||
<string name="label_bluetooth_enable">Connect to scale on startup</string>
|
||||
<string name="label_mergeWithLastMeasurement">Merge with last measurement</string>
|
||||
<string name="label_bluetooth_searching">Searching for Bluetooth scales</string>
|
||||
<string name="label_bluetooth_searching_finished">Finished searching for Bluetooth scales</string>
|
||||
@@ -189,7 +189,7 @@
|
||||
<string name="label_weeks_view">Week view</string>
|
||||
|
||||
<string name="permission_not_granted">Permission not granted</string>
|
||||
<string name="permission_bluetooth_info">openScale requires permission to access the coarse location to search for Bluetooth devices. The permission can be revoked after the device is found.</string>
|
||||
<string name="permission_bluetooth_info">Coarse location permission needed to search for Bluetooth devices. It can be revoked after the device is found.</string>
|
||||
<string name="permission_bluetooth_info_title">Information</string>
|
||||
<string name="label_next">Next</string>
|
||||
<string name="label_press_hold_reorder">Press and hold to reorder</string>
|
||||
@@ -224,5 +224,5 @@
|
||||
<string name="label_estimated">Estimated</string>
|
||||
<string name="label_estimate_measurement_summary">Based on weight, height, age, gender, etc.</string>
|
||||
<string name="label_scale_not_supported">Is your scale not supported?</string>
|
||||
<string name="label_click_to_help_add_support">Click here if you want to help add support for it</string>
|
||||
<string name="label_click_to_help_add_support">Click here to help add support for it</string>
|
||||
</resources>
|
||||
|
@@ -33,7 +33,7 @@ import static junit.framework.Assert.assertEquals;
|
||||
|
||||
public class CsvHelperTest {
|
||||
private static final String HEADERS =
|
||||
"\"bone\",\"comment\",\"dateTime\",\"fat\",\"hip\",\"lbw\","
|
||||
"\"bone\",\"comment\",\"dateTime\",\"fat\",\"hip\",\"lbm\","
|
||||
+ "\"muscle\",\"waist\",\"water\",\"weight\"\n";
|
||||
|
||||
private void validateEntry(ScaleMeasurement m, int version) throws Exception {
|
||||
@@ -63,10 +63,10 @@ public class CsvHelperTest {
|
||||
assertEquals(0.0, m.getBone(), 0.001);
|
||||
}
|
||||
if (version > 3) {
|
||||
assertEquals(4.0, m.getLbw(), 0.001);
|
||||
assertEquals(4.0, m.getLbm(), 0.001);
|
||||
}
|
||||
else {
|
||||
assertEquals(0.0, m.getLbw(), 0.001);
|
||||
assertEquals(0.0, m.getLbm(), 0.001);
|
||||
}
|
||||
|
||||
assertEquals("some text", m.getComment());
|
||||
@@ -89,6 +89,18 @@ public class CsvHelperTest {
|
||||
validateEntry(list.get(0), 5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void newStyleOldLbwHeaderNameSingleEntry() throws Exception {
|
||||
final String data = HEADERS.replace("lbm", "lbw")
|
||||
+ "1.0,\"some text\",\"01.03.2018 12:45\",2.0,3.0,4.0,5.0,6.0,7.0,8.0\n";
|
||||
|
||||
List<ScaleMeasurement> list = CsvHelper.importFrom(
|
||||
new BufferedReader(new StringReader(data)));
|
||||
|
||||
assertEquals(1, list.size());
|
||||
validateEntry(list.get(0), 5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exportImport() throws Exception {
|
||||
ScaleMeasurement m = new ScaleMeasurement();
|
||||
@@ -96,7 +108,7 @@ public class CsvHelperTest {
|
||||
m.setFat(2.0f);
|
||||
m.setWater(7.0f);
|
||||
m.setMuscle(5.0f);
|
||||
m.setLbw(4.0f);
|
||||
m.setLbm(4.0f);
|
||||
m.setBone(1.0f);
|
||||
m.setWaist(6.0f);
|
||||
m.setHip(3.0f);
|
||||
|