1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-31 12:01:54 +02:00

Make measurement key available as a static field as well

This commit is contained in:
Erik Johansson
2018-03-20 17:53:30 +01:00
parent 5385cb1cec
commit 5e049eb56d
15 changed files with 33 additions and 16 deletions

View File

@@ -26,6 +26,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
import com.health.openscale.core.evaluation.EvaluationSheet;
public class BMIMeasurementView extends FloatMeasurementView {
public static String KEY = "bmi";
public BMIMeasurementView(Context context) {
super(context, context.getResources().getString(R.string.label_bmi), ContextCompat.getDrawable(context, R.drawable.ic_bmi));
@@ -33,7 +34,7 @@ public class BMIMeasurementView extends FloatMeasurementView {
@Override
public String getKey() {
return "bmi";
return KEY;
}
@Override

View File

@@ -28,6 +28,7 @@ import com.health.openscale.core.evaluation.EvaluationSheet;
import java.util.Locale;
public class BMRMeasurementView extends FloatMeasurementView {
public static String KEY = "bmr";
public BMRMeasurementView(Context context) {
super(context, context.getResources().getString(R.string.label_bmr), ContextCompat.getDrawable(context, R.drawable.ic_bmr));
@@ -35,7 +36,7 @@ public class BMRMeasurementView extends FloatMeasurementView {
@Override
public String getKey() {
return "bmr";
return KEY;
}
@Override

View File

@@ -26,6 +26,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
import com.health.openscale.core.evaluation.EvaluationSheet;
public class BoneMeasurementView extends FloatMeasurementView {
public static String KEY = "bone";
public BoneMeasurementView(Context context) {
super(context, context.getResources().getString(R.string.label_bone), ContextCompat.getDrawable(context, R.drawable.ic_bone));
@@ -33,7 +34,7 @@ public class BoneMeasurementView extends FloatMeasurementView {
@Override
public String getKey() {
return "bone";
return KEY;
}
@Override

View File

@@ -27,6 +27,8 @@ import com.health.openscale.R;
import com.health.openscale.core.datatypes.ScaleMeasurement;
public class CommentMeasurementView extends MeasurementView {
public static String KEY = "comment";
private String comment;
public CommentMeasurementView(Context context) {
@@ -35,7 +37,7 @@ public class CommentMeasurementView extends MeasurementView {
@Override
public String getKey() {
return "comment";
return KEY;
}
private void setValue(String newComment, boolean callListener) {

View File

@@ -30,6 +30,8 @@ import java.util.Calendar;
import java.util.Date;
public class DateMeasurementView extends MeasurementView {
public static String KEY = "date";
private static DateFormat dateFormat = DateFormat.getDateInstance();
private Date date;
@@ -39,10 +41,9 @@ public class DateMeasurementView extends MeasurementView {
@Override
public String getKey() {
return "date";
return KEY;
}
private void setValue(Date newDate, boolean callListener) {
if (!newDate.equals(date)) {
date = newDate;

View File

@@ -26,6 +26,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
import com.health.openscale.core.evaluation.EvaluationSheet;
public class FatMeasurementView extends FloatMeasurementView {
public static String KEY = "fat";
private boolean estimateFatEnable;
private boolean percentageEnable;
@@ -36,7 +37,7 @@ public class FatMeasurementView extends FloatMeasurementView {
@Override
public String getKey() {
return "fat";
return KEY;
}
@Override

View File

@@ -26,6 +26,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
import com.health.openscale.core.evaluation.EvaluationSheet;
public class HipMeasurementView extends FloatMeasurementView {
public static String KEY = "hip";
public HipMeasurementView(Context context) {
super(context, context.getResources().getString(R.string.label_hip), ContextCompat.getDrawable(context, R.drawable.ic_hip));
@@ -33,7 +34,7 @@ public class HipMeasurementView extends FloatMeasurementView {
@Override
public String getKey() {
return "hip";
return KEY;
}
@Override

View File

@@ -26,6 +26,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
import com.health.openscale.core.evaluation.EvaluationSheet;
public class LBWMeasurementView extends FloatMeasurementView {
public static String KEY = "lbw";
private boolean estimateLBWEnable;
@@ -35,7 +36,7 @@ public class LBWMeasurementView extends FloatMeasurementView {
@Override
public String getKey() {
return "lbw";
return KEY;
}
@Override

View File

@@ -26,6 +26,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
import com.health.openscale.core.evaluation.EvaluationSheet;
public class MuscleMeasurementView extends FloatMeasurementView {
public static String KEY = "muscle";
private boolean percentageEnable;
@@ -35,7 +36,7 @@ public class MuscleMeasurementView extends FloatMeasurementView {
@Override
public String getKey() {
return "muscle";
return KEY;
}
@Override

View File

@@ -30,6 +30,8 @@ import java.util.Calendar;
import java.util.Date;
public class TimeMeasurementView extends MeasurementView {
public static String KEY = "time";
private DateFormat timeFormat;
private Date time;
@@ -40,7 +42,7 @@ public class TimeMeasurementView extends MeasurementView {
@Override
public String getKey() {
return "time";
return KEY;
}
private void setValue(Date newTime, boolean callListener) {

View File

@@ -26,6 +26,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
import com.health.openscale.core.evaluation.EvaluationSheet;
public class WHRMeasurementView extends FloatMeasurementView {
public static String KEY = "whr";
public WHRMeasurementView(Context context) {
super(context, context.getResources().getString(R.string.label_whr), ContextCompat.getDrawable(context, R.drawable.ic_whr));
@@ -33,7 +34,7 @@ public class WHRMeasurementView extends FloatMeasurementView {
@Override
public String getKey() {
return "whr";
return KEY;
}
@Override

View File

@@ -26,6 +26,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
import com.health.openscale.core.evaluation.EvaluationSheet;
public class WHtRMeasurementView extends FloatMeasurementView {
public static String KEY = "whtr";
public WHtRMeasurementView(Context context) {
super(context, context.getResources().getString(R.string.label_whtr), ContextCompat.getDrawable(context, R.drawable.ic_whtr));
@@ -33,7 +34,7 @@ public class WHtRMeasurementView extends FloatMeasurementView {
@Override
public String getKey() {
return "whtr";
return KEY;
}
@Override

View File

@@ -26,6 +26,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
import com.health.openscale.core.evaluation.EvaluationSheet;
public class WaistMeasurementView extends FloatMeasurementView {
public static String KEY = "waist";
public WaistMeasurementView(Context context) {
super(context, context.getResources().getString(R.string.label_waist), ContextCompat.getDrawable(context, R.drawable.ic_waist));
@@ -33,7 +34,7 @@ public class WaistMeasurementView extends FloatMeasurementView {
@Override
public String getKey() {
return "waist";
return KEY;
}
@Override

View File

@@ -26,6 +26,7 @@ import com.health.openscale.core.evaluation.EvaluationResult;
import com.health.openscale.core.evaluation.EvaluationSheet;
public class WaterMeasurementView extends FloatMeasurementView {
public static String KEY = "water";
private boolean estimateWaterEnable;
private boolean percentageEnable;
@@ -36,7 +37,7 @@ public class WaterMeasurementView extends FloatMeasurementView {
@Override
public String getKey() {
return "water";
return KEY;
}
@Override

View File

@@ -27,6 +27,7 @@ import com.health.openscale.core.evaluation.EvaluationSheet;
import com.health.openscale.core.utils.Converters;
public class WeightMeasurementView extends FloatMeasurementView {
public static String KEY = "weight";
public WeightMeasurementView(Context context) {
super(context, context.getResources().getString(R.string.label_weight), ContextCompat.getDrawable(context, R.drawable.ic_weight));
@@ -34,7 +35,7 @@ public class WeightMeasurementView extends FloatMeasurementView {
@Override
public String getKey() {
return "weight";
return KEY;
}
@Override