1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-11 03:04:25 +02:00

refactored measurement views for dynamically programming.

This commit is contained in:
OliE
2017-03-16 20:56:17 +01:00
parent 3c64530ed8
commit 026e5e0733
7 changed files with 624 additions and 2114 deletions

View File

@@ -2,15 +2,14 @@ package com.health.openscale.core;
public class ScaleCalculator {
public float weight;
public float fat;
public float water;
public float muscle;
public float waist;
public float hip;
public int body_height;
private float weight;
private float fat;
private float water;
private float muscle;
private float waist;
private float hip;
public void setScaleData(ScaleData scaleData) {
public ScaleCalculator(ScaleData scaleData) {
weight = scaleData.weight;
fat = scaleData.fat;
water = scaleData.water;
@@ -19,11 +18,11 @@ public class ScaleCalculator {
hip = scaleData.hip;
}
public float getBMI() {
public float getBMI(int body_height) {
return weight / ((body_height / 100.0f)*(body_height / 100.0f));
}
public float getWHtR() {
public float getWHtR(int body_height) {
return waist / (float)body_height;
}

View File

@@ -1,684 +0,0 @@
package com.health.openscale.gui;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.view.View;
import android.widget.ImageView;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import com.health.openscale.R;
import com.health.openscale.core.EvaluationResult;
import com.health.openscale.core.EvaluationSheet;
import com.health.openscale.core.ScaleUser;
import lecho.lib.hellocharts.util.ChartUtils;
abstract class Measurement {
private TextView txtLabel;
private TextView txtView;
private final String label;
private LinearGaugeView linearGaugeView;
private ImageView imageView;
private TableRow tableRow;
ScaleUser scaleUser;
public Measurement(View overviewView) {
txtLabel = (TextView) overviewView.findViewById(getTxtLabelId());
txtView = (TextView) overviewView.findViewById(getTxtViewId());
linearGaugeView = (LinearGaugeView) overviewView.findViewById(getLinearGaugeViewId());
imageView = (ImageView)overviewView.findViewById(getImageViewId());
label = overviewView.getResources().getString(getLabelId());
tableRow = (TableRow)overviewView.findViewById(getTableRowId());
tableRow.setOnClickListener(new onClickListenerEvaluation());
}
public void updateValue(float value) {
setText(value);
evaluate(value);
}
abstract int getTxtLabelId();
abstract int getTxtViewId();
abstract int getLabelId();
abstract int getLinearGaugeViewId();
abstract int getImageViewId();
abstract int getTableRowId();
abstract String getFormat();
abstract EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value);
abstract float getMinValue();
abstract float getMaxValue();
private void setText(float value) {
txtView.setText(String.format(getFormat(), value));
}
private void evaluate(float value) {
EvaluationSheet evalSheet = new EvaluationSheet(scaleUser);
EvaluationResult evalResult = evaluateSheet(evalSheet, value);
linearGaugeView.setMinMaxValue(getMinValue(), getMaxValue());
linearGaugeView.setLimits(evalResult.lowLimit, evalResult.highLimit);
linearGaugeView.setValue(value);
switch(evalResult.eval_state)
{
case LOW:
imageView.setBackgroundColor(ChartUtils.COLOR_BLUE);
break;
case NORMAL:
imageView.setBackgroundColor(ChartUtils.COLOR_GREEN);
break;
case HIGH:
imageView.setBackgroundColor(ChartUtils.COLOR_RED);
break;
case UNDEFINED:
imageView.setBackgroundColor(Color.GRAY);
break;
}
}
public void setDiff(float value, float diffValue) {
ScaleDiff.setDiff(
txtLabel,
value - diffValue,
label,
getFormat());
}
public void updateVisibleRow(SharedPreferences preferences){
if(isPreferenceSet(preferences)) {
tableRow.setVisibility(View.VISIBLE);
} else {
tableRow.setVisibility(View.GONE);
}
}
abstract boolean isPreferenceSet(SharedPreferences preferences);
private class onClickListenerEvaluation implements View.OnClickListener {
@Override
public void onClick(View v) {
TableRow row = (TableRow)v;
TableLayout tableLayout = (TableLayout)row.getParent();
int index = tableLayout.indexOfChild(row);
TableRow rowEvaluation = (TableRow)tableLayout.getChildAt(index+1);
if (rowEvaluation.getVisibility() == View.VISIBLE) {
rowEvaluation.setVisibility(View.GONE);
} else {
rowEvaluation.setVisibility(View.VISIBLE);
}
}
}
}
class WeightMeasurement extends Measurement {
public WeightMeasurement(View overviewView) {
super(overviewView);
}
@Override
int getTxtLabelId() {
return R.id.txtLabelWeight;
}
@Override
int getTxtViewId() {
return R.id.txtWeightLast;
}
@Override
int getLabelId() {
return R.string.label_weight;
}
@Override
int getLinearGaugeViewId() {
return R.id.linearGaugeWeight;
}
@Override
int getImageViewId() {
return R.id.indicatorWeight;
}
@Override
int getTableRowId() {
return R.id.tableRowWeight;
}
@Override
String getFormat() {
return "%.1f " + ScaleUser.UNIT_STRING[scaleUser.scale_unit];
}
@Override
boolean isPreferenceSet(SharedPreferences preferences) {
return preferences.getBoolean("weightEnable", true);
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateWeight(value);
}
@Override
float getMinValue() {
return 30;
}
@Override
float getMaxValue() {
return 300;
}
}
class BMIMeasurement extends Measurement {
public BMIMeasurement(View overviewView) {
super(overviewView);
}
@Override
int getTxtLabelId() {
return R.id.txtLabelBMI;
}
@Override
int getTxtViewId() {
return R.id.txtBMILast;
}
@Override
int getLabelId() {
return R.string.label_bmi;
}
@Override
int getLinearGaugeViewId() {
return R.id.linearGaugeBMI;
}
@Override
int getImageViewId() {
return R.id.indicatorBMI;
}
@Override
int getTableRowId() {
return R.id.tableRowBMI;
}
@Override
String getFormat() {
return "%.1f";
}
@Override
boolean isPreferenceSet(SharedPreferences preferences) {
// TODO implement
return false;
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateBMI(value);
}
@Override
float getMinValue() {
return 10;
}
@Override
float getMaxValue() {
return 50;
}
}
class WaterMeasurement extends Measurement {
public WaterMeasurement(View overviewView) {
super(overviewView);
}
@Override
int getTxtLabelId() {
return R.id.txtLabelWater;
}
@Override
int getTxtViewId() {
return R.id.txtWaterLast;
}
@Override
int getLabelId() {
return R.string.label_water;
}
@Override
int getLinearGaugeViewId() {
return R.id.linearGaugeWater;
}
@Override
int getImageViewId() {
return R.id.indicatorWater;
}
@Override
int getTableRowId() {
return R.id.tableRowWater;
}
@Override
String getFormat() {
return "%.1f %%";
}
@Override
boolean isPreferenceSet(SharedPreferences preferences) {
return preferences.getBoolean("waterEnable", true);
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateBodyWater(value);
}
@Override
float getMinValue() {
return 30;
}
@Override
float getMaxValue() {
return 80;
}
}
class MuscleMeasurement extends Measurement {
public MuscleMeasurement(View overviewView) {
super(overviewView);
}
@Override
int getTxtLabelId() {
return R.id.txtLabelMuscle;
}
@Override
int getTxtViewId() {
return R.id.txtMuscleLast;
}
@Override
int getLabelId() {
return R.string.label_muscle;
}
@Override
int getLinearGaugeViewId() {
return R.id.linearGaugeMuscle;
}
@Override
int getImageViewId() {
return R.id.indicatorMuscle;
}
@Override
int getTableRowId() {
return R.id.tableRowMuscle;
}
@Override
String getFormat() {
return "%.1f %%";
}
@Override
boolean isPreferenceSet(SharedPreferences preferences) {
return preferences.getBoolean("muscleEnable", true);
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateBodyMuscle(value);
}
@Override
float getMinValue() {
return 10;
}
@Override
float getMaxValue() {
return 80;
}
}
class FatMeasurement extends Measurement {
public FatMeasurement(View overviewView) {
super(overviewView);
}
@Override
int getTxtLabelId() {
return R.id.txtLabelFat;
}
@Override
int getTxtViewId() {
return R.id.txtFatLast;
}
@Override
int getLabelId() {
return R.string.label_fat;
}
@Override
int getLinearGaugeViewId() {
return R.id.linearGaugeFat;
}
@Override
int getImageViewId() {
return R.id.indicatorFat;
}
@Override
int getTableRowId() {
return R.id.tableRowFat;
}
@Override
String getFormat() {
return "%.1f %%";
}
@Override
boolean isPreferenceSet(SharedPreferences preferences) {
return preferences.getBoolean("fatEnable", true);
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateBodyFat(value);
}
@Override
float getMinValue() {
return 10;
}
@Override
float getMaxValue() {
return 40;
}
}
class WaistMeasurement extends Measurement {
public WaistMeasurement(View overviewView) {
super(overviewView);
}
@Override
int getTxtLabelId() {
return R.id.txtLabelWaist;
}
@Override
int getTxtViewId() {
return R.id.txtWaistLast;
}
@Override
int getLabelId() {
return R.string.label_waist;
}
@Override
int getLinearGaugeViewId() {
return R.id.linearGaugeWaist;
}
@Override
int getImageViewId() {
return R.id.indicatorWaist;
}
@Override
int getTableRowId() {
return R.id.tableRowWaist;
}
@Override
String getFormat() {
return "%.1f cm";
}
@Override
boolean isPreferenceSet(SharedPreferences preferences) {
return preferences.getBoolean("waistEnable", true);
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateWaist(value);
}
@Override
float getMinValue() {
return 30;
}
@Override
float getMaxValue() {
return 200;
}
}
class WHtRMeasurement extends Measurement {
public WHtRMeasurement(View overviewView) {
super(overviewView);
}
@Override
int getTxtLabelId() {
return R.id.txtLabelWHtR;
}
@Override
int getTxtViewId() {
return R.id.txtWHtRLast;
}
@Override
int getLabelId() {
return R.string.label_whtr;
}
@Override
int getLinearGaugeViewId() {
return R.id.linearGaugeWHtR;
}
@Override
int getImageViewId() {
return R.id.indicatorWHtR;
}
@Override
int getTableRowId() {
return R.id.tableRowWHtR;
}
@Override
String getFormat() {
return "%.2f";
}
@Override
boolean isPreferenceSet(SharedPreferences preferences) {
return preferences.getBoolean("waistEnable", true);
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateWHtR(value);
}
@Override
float getMinValue() {
return 0;
}
@Override
float getMaxValue() {
return 1;
}
}
class HipMeasurement extends Measurement {
public HipMeasurement(View overviewView) {
super(overviewView);
}
@Override
int getTxtLabelId() {
return R.id.txtLabelHip;
}
@Override
int getTxtViewId() {
return R.id.txtHipLast;
}
@Override
int getLabelId() {
return R.string.label_hip;
}
@Override
int getLinearGaugeViewId() {
return R.id.linearGaugeHip;
}
@Override
int getImageViewId() {
return R.id.indicatorHip;
}
@Override
int getTableRowId() {
return R.id.tableRowHip;
}
@Override
String getFormat() {
return "%.1f cm";
}
@Override
boolean isPreferenceSet(SharedPreferences preferences) {
return preferences.getBoolean("hipEnable", true);
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateHip(value);
}
@Override
float getMinValue() {
return 30;
}
@Override
float getMaxValue() {
return 200;
}
}
class WHRMeasurement extends Measurement {
public WHRMeasurement(View overviewView) {
super(overviewView);
}
@Override
int getTxtLabelId() {
return R.id.txtLabelWHR;
}
@Override
int getTxtViewId() {
return R.id.txtWHRLast;
}
@Override
int getLabelId() {
return R.string.label_whr;
}
@Override
int getLinearGaugeViewId() {
return R.id.linearGaugeWHR;
}
@Override
int getImageViewId() {
return R.id.indicatorWHR;
}
@Override
int getTableRowId() {
return R.id.tableRowWHR;
}
@Override
String getFormat() {
return "%.2f";
}
@Override
boolean isPreferenceSet(SharedPreferences preferences) {
return preferences.getBoolean("hipEnable", true) && preferences.getBoolean("waistEnable", true);
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateWHR(value);
}
@Override
float getMinValue() {
return 0.5f;
}
@Override
float getMaxValue() {
return 1.5f;
}
}

View File

@@ -0,0 +1,571 @@
package com.health.openscale.gui;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.text.Html;
import android.view.View;
import android.widget.ImageView;
import android.widget.Space;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import com.health.openscale.R;
import com.health.openscale.core.EvaluationResult;
import com.health.openscale.core.EvaluationSheet;
import com.health.openscale.core.ScaleCalculator;
import com.health.openscale.core.ScaleData;
import com.health.openscale.core.ScaleUser;
import lecho.lib.hellocharts.util.ChartUtils;
abstract class MeasurementView extends TableLayout {
private static String SYMBOL_UP = "↗";
private static String SYMBOL_DOWN = "↘";
private TableRow measurementRow;
private ImageView iconView;
private TextView nameView;
private TextView valueView;
private ImageView indicatorView;
private TableRow evaluatorRow;
private LinearGaugeView evaluatorView;
private String nameText;
protected ScaleUser scaleUser;
public MeasurementView(Context context, String text, Drawable icon) {
super(context);
initView(context);
nameText = text;
nameView.setText(text);
iconView.setImageDrawable(icon);
}
private void initView(Context context) {
measurementRow = new TableRow(context);
iconView = new ImageView(context);
nameView = new TextView(context);
valueView = new TextView(context);
indicatorView = new ImageView(context);
evaluatorRow = new TableRow(context);
evaluatorView = new LinearGaugeView(context);
measurementRow.setLayoutParams(new TableRow.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT, 1.0f));
measurementRow.addView(iconView);
measurementRow.addView(nameView);
measurementRow.addView(valueView);
measurementRow.addView(indicatorView);
addView(measurementRow);
addView(evaluatorRow);
iconView.getLayoutParams().height = 80;
iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
nameView.setTextSize(20);
nameView.setTextColor(Color.BLACK);
nameView.setLines(2);
nameView.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 0.92f));
valueView.setTextSize(20);
valueView.setTextColor(Color.BLACK);
valueView.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.MATCH_PARENT, 0.07f));
indicatorView.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.MATCH_PARENT, 0.01f));
indicatorView.setBackgroundColor(Color.GRAY);
evaluatorRow.setLayoutParams(new TableRow.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT, 1.0f));
evaluatorRow.addView(new Space(context));
evaluatorRow.addView(evaluatorView);
Space spaceAfterEvaluatorView = new Space(context);
evaluatorRow.addView(spaceAfterEvaluatorView);
evaluatorRow.setVisibility(View.GONE);
evaluatorView.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 0.99f));
spaceAfterEvaluatorView.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 0.01f));
measurementRow.setOnClickListener(new onClickListenerEvaluation());
}
abstract void updateValue(ScaleData updateData);
abstract void updateDiff(ScaleData updateData, ScaleData lastData);
abstract void updatePreferences(SharedPreferences preferences);
abstract String getFormat();
abstract EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value);
abstract float getMinValue();
abstract float getMaxValue();
protected void setValueOnView(float value) {
valueView.setText(String.format(getFormat(), value));
evaluate(value);
}
protected void setDiffOnView(float value, float lastValue) {
float diffValue = value - lastValue;
String symbol;
if (diffValue > 0.0) {
symbol = SYMBOL_UP;
} else {
symbol = SYMBOL_DOWN;
}
nameView.setText(
Html.fromHtml(
nameText +
" <br> <font color='grey'>" +
symbol +
"<small> " +
String.format(getFormat(), diffValue) +
"</small></font>"
)
);
}
protected void setVisible(boolean isVisible){
if(isVisible) {
measurementRow.setVisibility(View.VISIBLE);
} else {
measurementRow.setVisibility(View.GONE);
}
}
private void evaluate(float value) {
EvaluationSheet evalSheet = new EvaluationSheet(scaleUser);
EvaluationResult evalResult = evaluateSheet(evalSheet, value);
evaluatorView.setMinMaxValue(getMinValue(), getMaxValue());
evaluatorView.setLimits(evalResult.lowLimit, evalResult.highLimit);
evaluatorView.setValue(value);
switch(evalResult.eval_state)
{
case LOW:
indicatorView.setBackgroundColor(ChartUtils.COLOR_BLUE);
break;
case NORMAL:
indicatorView.setBackgroundColor(ChartUtils.COLOR_GREEN);
break;
case HIGH:
indicatorView.setBackgroundColor(ChartUtils.COLOR_RED);
break;
case UNDEFINED:
indicatorView.setBackgroundColor(Color.GRAY);
break;
}
}
public void updateScaleUser(ScaleUser user) {
scaleUser = user;
}
private class onClickListenerEvaluation implements View.OnClickListener {
@Override
public void onClick(View v) {
if (evaluatorRow.getVisibility() == View.VISIBLE) {
evaluatorRow.setVisibility(View.GONE);
} else {
evaluatorRow.setVisibility(View.VISIBLE);
}
}
}
}
class WeightMeasurementView extends MeasurementView {
public WeightMeasurementView(Context context) {
super(context, context.getResources().getString(R.string.label_weight), ContextCompat.getDrawable(context, R.drawable.weight));
}
@Override
void updateValue(ScaleData updateData) {
setValueOnView(updateData.weight);
}
@Override
void updateDiff(ScaleData updateData, ScaleData lastData) {
setDiffOnView(updateData.weight, lastData.weight);
}
@Override
String getFormat() {
return "%.1f " + ScaleUser.UNIT_STRING[scaleUser.scale_unit];
}
@Override
void updatePreferences(SharedPreferences preferences) {
setVisible(preferences.getBoolean("weightEnable", true));
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateWeight(value);
}
@Override
float getMinValue() {
return 30;
}
@Override
float getMaxValue() {
return 300;
}
}
class BMIMeasurementView extends MeasurementView {
public BMIMeasurementView(Context context) {
super(context, context.getResources().getString(R.string.label_bmi), ContextCompat.getDrawable(context, R.drawable.bmi));
}
@Override
void updateValue(ScaleData updateData) {
ScaleCalculator updateCalculator = new ScaleCalculator(updateData);
setValueOnView(updateCalculator.getBMI(scaleUser.body_height));
}
@Override
void updateDiff(ScaleData updateData, ScaleData lastData) {
ScaleCalculator updateCalculator = new ScaleCalculator(updateData);
ScaleCalculator lastCalculator = new ScaleCalculator(lastData);
setDiffOnView(updateCalculator.getBMI(scaleUser.body_height), lastCalculator.getBMI(scaleUser.body_height));
}
@Override
String getFormat() {
return "%.1f";
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateBMI(value);
}
@Override
float getMinValue() {
return 10;
}
@Override
float getMaxValue() {
return 50;
}
@Override
void updatePreferences(SharedPreferences preferences) {
setVisible(preferences.getBoolean("weightEnable", true));
}
}
class WaterMeasurementView extends MeasurementView {
public WaterMeasurementView(Context context) {
super(context, context.getResources().getString(R.string.label_water), ContextCompat.getDrawable(context, R.drawable.water));
}
@Override
void updateValue(ScaleData updateData) {
setValueOnView(updateData.water);
}
@Override
void updateDiff(ScaleData updateData, ScaleData lastData) {
setDiffOnView(updateData.water, lastData.water);
}
@Override
String getFormat() {
return "%.1f %%";
}
@Override
void updatePreferences(SharedPreferences preferences) {
setVisible(preferences.getBoolean("waterEnable", true));
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateBodyWater(value);
}
@Override
float getMinValue() {
return 30;
}
@Override
float getMaxValue() {
return 80;
}
}
class MuscleMeasurementView extends MeasurementView {
public MuscleMeasurementView(Context context) {
super(context, context.getResources().getString(R.string.label_muscle), ContextCompat.getDrawable(context, R.drawable.muscle));
}
@Override
void updateValue(ScaleData updateData) {
setValueOnView(updateData.muscle);
}
@Override
void updateDiff(ScaleData updateData, ScaleData lastData) {
setDiffOnView(updateData.muscle, lastData.muscle);
}
@Override
String getFormat() {
return "%.1f %%";
}
@Override
void updatePreferences(SharedPreferences preferences) {
setVisible(preferences.getBoolean("muscleEnable", true));
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateBodyMuscle(value);
}
@Override
float getMinValue() {
return 10;
}
@Override
float getMaxValue() {
return 80;
}
}
class FatMeasurementView extends MeasurementView {
public FatMeasurementView(Context context) {
super(context, context.getResources().getString(R.string.label_fat), ContextCompat.getDrawable(context, R.drawable.fat));
}
@Override
void updateValue(ScaleData updateData) {
setValueOnView(updateData.fat);
}
@Override
void updateDiff(ScaleData updateData, ScaleData lastData) {
setDiffOnView(updateData.fat, lastData.fat);
}
@Override
String getFormat() {
return "%.1f %%";
}
@Override
void updatePreferences(SharedPreferences preferences) {
setVisible(preferences.getBoolean("fatEnable", true));
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateBodyFat(value);
}
@Override
float getMinValue() {
return 10;
}
@Override
float getMaxValue() {
return 40;
}
}
class WaistMeasurementView extends MeasurementView {
public WaistMeasurementView(Context context) {
super(context, context.getResources().getString(R.string.label_waist), ContextCompat.getDrawable(context, R.drawable.waist));
}
@Override
void updateValue(ScaleData updateData) {
setValueOnView(updateData.waist);
}
@Override
void updateDiff(ScaleData updateData, ScaleData lastData) {
setDiffOnView(updateData.waist, lastData.waist);
}
@Override
String getFormat() {
return "%.1f cm";
}
@Override
void updatePreferences(SharedPreferences preferences) {
setVisible(preferences.getBoolean("waistEnable", true));
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateWaist(value);
}
@Override
float getMinValue() {
return 30;
}
@Override
float getMaxValue() {
return 200;
}
}
class WHtRMeasurementView extends MeasurementView {
public WHtRMeasurementView(Context context) {
super(context, context.getResources().getString(R.string.label_whtr), ContextCompat.getDrawable(context, R.drawable.whtr));
}
@Override
void updateValue(ScaleData updateData) {
ScaleCalculator updateCalculator = new ScaleCalculator(updateData);
setValueOnView(updateCalculator.getWHtR(scaleUser.body_height));
}
@Override
void updateDiff(ScaleData updateData, ScaleData lastData) {
ScaleCalculator updateCalculator = new ScaleCalculator(updateData);
ScaleCalculator lastCalculator = new ScaleCalculator(lastData);
setDiffOnView(updateCalculator.getWHtR(scaleUser.body_height), lastCalculator.getWHtR(scaleUser.body_height));
}
@Override
String getFormat() {
return "%.2f";
}
@Override
void updatePreferences(SharedPreferences preferences) {
setVisible(preferences.getBoolean("waistEnable", true));
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateWHtR(value);
}
@Override
float getMinValue() {
return 0;
}
@Override
float getMaxValue() {
return 1;
}
}
class HipMeasurementView extends MeasurementView {
public HipMeasurementView(Context context) {
super(context, context.getResources().getString(R.string.label_hip), ContextCompat.getDrawable(context, R.drawable.hip));
}
@Override
void updateValue(ScaleData updateData) {
setValueOnView(updateData.hip);
}
@Override
void updateDiff(ScaleData updateData, ScaleData lastData) {
setDiffOnView(updateData.hip, lastData.hip);
}
@Override
String getFormat() {
return "%.1f cm";
}
@Override
void updatePreferences(SharedPreferences preferences) {
setVisible(preferences.getBoolean("hipEnable", true));
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateHip(value);
}
@Override
float getMinValue() {
return 30;
}
@Override
float getMaxValue() {
return 200;
}
}
class WHRMeasurementView extends MeasurementView {
public WHRMeasurementView(Context context) {
super(context, context.getResources().getString(R.string.label_whr), ContextCompat.getDrawable(context, R.drawable.whr));
}
@Override
void updateValue(ScaleData updateData) {
ScaleCalculator updateCalculator = new ScaleCalculator(updateData);
setValueOnView(updateCalculator.getWHR());
}
@Override
void updateDiff(ScaleData updateData, ScaleData lastData) {
ScaleCalculator updateCalculator = new ScaleCalculator(updateData);
ScaleCalculator lastCalculator = new ScaleCalculator(lastData);
setDiffOnView(updateCalculator.getWHR(), lastCalculator.getWHR());
}
@Override
String getFormat() {
return "%.2f";
}
@Override
void updatePreferences(SharedPreferences preferences) {
setVisible(preferences.getBoolean("hipEnable", true) && preferences.getBoolean("waistEnable", true));
}
@Override
EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
return evalSheet.evaluateWHR(value);
}
@Override
float getMinValue() {
return 0.5f;
}
@Override
float getMaxValue() {
return 1.5f;
}
}

View File

@@ -30,6 +30,7 @@ import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TableLayout;
import android.widget.TextView;
import android.widget.Toast;
@@ -69,15 +70,9 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
private TextView txtTitleGoal;
private TextView txtTitleStatistics;
private Measurement measurementWeightLast;
private Measurement measurementBMILast;
private Measurement measurementWaterLast;
private Measurement measurementMuscleLast;
private Measurement measurementFatLast;
private Measurement measurementWaistLast;
private Measurement measurementWHtRLast;
private Measurement measurementHipLast;
private Measurement measurementWHRLast;
private TableLayout tableOverviewLayout;
private ArrayList<MeasurementView> overviewMeasurements;
private TextView txtGoalWeight;
private TextView txtGoalDiff;
@@ -128,15 +123,23 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
txtTitleGoal = (TextView) overviewView.findViewById(R.id.txtTitleGoal);
txtTitleStatistics = (TextView) overviewView.findViewById(R.id.txtTitleStatistics);
measurementWeightLast = new WeightMeasurement(overviewView);
measurementBMILast = new BMIMeasurement(overviewView);
measurementWaterLast = new WaterMeasurement(overviewView);
measurementMuscleLast = new MuscleMeasurement(overviewView);
measurementFatLast = new FatMeasurement(overviewView);
measurementWaistLast = new WaistMeasurement(overviewView);
measurementWHtRLast = new WHtRMeasurement(overviewView);
measurementHipLast = new HipMeasurement(overviewView);
measurementWHRLast = new WHRMeasurement(overviewView);
tableOverviewLayout = (TableLayout)overviewView.findViewById(R.id.tableLayoutMeasurements);
overviewMeasurements = new ArrayList<>();
overviewMeasurements.add(new WeightMeasurementView(context));
overviewMeasurements.add(new BMIMeasurementView(context));
overviewMeasurements.add(new WaterMeasurementView(context));
overviewMeasurements.add(new MuscleMeasurementView(context));
overviewMeasurements.add(new FatMeasurementView(context));
overviewMeasurements.add(new WaistMeasurementView(context));
overviewMeasurements.add(new WHtRMeasurementView(context));
overviewMeasurements.add(new HipMeasurementView(context));
overviewMeasurements.add(new WHRMeasurementView(context));
for (MeasurementView measuremt : overviewMeasurements) {
tableOverviewLayout.addView(measuremt);
}
txtGoalWeight = (TextView) overviewView.findViewById(R.id.txtGoalWeight);
txtGoalDiff = (TextView) overviewView.findViewById(R.id.txtGoalDiff);
@@ -194,7 +197,7 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
lastScaleData = userSelectedData;
}
else {
lastScaleData = scaleDataList.get(0);
lastScaleData = scaleDataList.get(0);
}
@@ -206,12 +209,15 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
txtTitleStatistics.setText(getResources().getString(R.string.label_title_statistics).toUpperCase());
updateUserSelection();
updateVisibleRows();
updateLastPieChart();
updateLastLineChart(scaleDataList);
updateLastValues();
updateGoal(scaleDataList);
updateStatistics(scaleDataList);
for (MeasurementView measuremt : overviewMeasurements) {
measuremt.updatePreferences(prefs);
measuremt.updateValue(lastScaleData);
}
}
private void updateUserSelection() {
@@ -220,15 +226,9 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
userSelectedData = null;
measurementWeightLast.scaleUser = currentScaleUser;
measurementBMILast.scaleUser = currentScaleUser;
measurementWaterLast.scaleUser = currentScaleUser;
measurementMuscleLast.scaleUser = currentScaleUser;
measurementFatLast.scaleUser = currentScaleUser;
measurementWaistLast.scaleUser = currentScaleUser;
measurementWHtRLast.scaleUser = currentScaleUser;
measurementHipLast.scaleUser = currentScaleUser;
measurementWHRLast.scaleUser = currentScaleUser;
for (MeasurementView measuremt : overviewMeasurements) {
measuremt.updateScaleUser(currentScaleUser);
}
spinUserAdapter.clear();
ArrayList<ScaleUser> scaleUserList = OpenScale.getInstance(overviewView.getContext()).getScaleUserList();
@@ -249,34 +249,6 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
spinUser.setSelection(posUser, true);
}
private void updateVisibleRows() {
measurementWeightLast.updateVisibleRow(prefs);
measurementBMILast.updateVisibleRow(prefs);
measurementWaterLast.updateVisibleRow(prefs);
measurementMuscleLast.updateVisibleRow(prefs);
measurementHipLast.updateVisibleRow(prefs);
measurementFatLast.updateVisibleRow(prefs);
measurementWaistLast.updateVisibleRow(prefs);
measurementWHRLast.updateVisibleRow(prefs);
measurementWHtRLast.updateVisibleRow(prefs);
}
private void updateLastValues() {
ScaleCalculator calculator = new ScaleCalculator();
calculator.body_height = currentScaleUser.body_height;
calculator.setScaleData(lastScaleData);
measurementWeightLast.updateValue(lastScaleData.weight);
measurementBMILast.updateValue(calculator.getBMI());
measurementFatLast.updateValue(lastScaleData.fat);
measurementWaterLast.updateValue(lastScaleData.water);
measurementMuscleLast.updateValue(lastScaleData.muscle);
measurementWaistLast.updateValue(lastScaleData.waist);
measurementWHtRLast.updateValue(calculator.getWHtR());
measurementHipLast.updateValue(lastScaleData.hip);
measurementWHRLast.updateValue(calculator.getWHR());
}
private void updateGoal(ArrayList<ScaleData> scaleDataList) {
txtGoalWeight.setText(currentScaleUser.goal_weight + " " + ScaleUser.UNIT_STRING[currentScaleUser.scale_unit]);
@@ -290,19 +262,17 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
long days = daysBetween(curDate, goalDate);
txtGoalDayLeft.setText(days + " " + getResources().getString(R.string.label_days));
ScaleCalculator currentCalculator = new ScaleCalculator();
currentCalculator.body_height = currentScaleUser.body_height;
currentCalculator.weight = lastScaleData.weight;
ScaleCalculator currentCalculator = new ScaleCalculator(lastScaleData);
ScaleCalculator goalCalculator = new ScaleCalculator();
goalCalculator.body_height = currentScaleUser.body_height;
goalCalculator.weight = currentScaleUser.goal_weight;
ScaleData goalData = new ScaleData();
goalData.weight = currentScaleUser.goal_weight;
ScaleCalculator goalCalculator = new ScaleCalculator(goalData);
txtLabelGoalWeight.setText(
Html.fromHtml(
getResources().getString(R.string.label_goal_weight) +
" <br> <font color='grey'><small>BMI " +
String.format("%.1f", goalCalculator.getBMI()) +
String.format("%.1f", goalCalculator.getBMI(currentScaleUser.body_height)) +
" </small></font>"
)
);
@@ -310,7 +280,7 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
Html.fromHtml(
getResources().getString(R.string.label_weight_difference) +
" <br> <font color='grey'><small>BMI " +
String.format("%.1f", currentCalculator.getBMI() - goalCalculator.getBMI()) +
String.format("%.1f", currentCalculator.getBMI(currentScaleUser.body_height) - goalCalculator.getBMI(currentScaleUser.body_height)) +
" </small></font>"
)
);
@@ -334,23 +304,9 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
if (scaleDataIterator.hasNext()) {
ScaleData diffScaleData = scaleDataIterator.next();
ScaleCalculator lastScaleCalculator = new ScaleCalculator();
lastScaleCalculator.body_height = currentScaleUser.body_height;
lastScaleCalculator.setScaleData(lastScaleData);
ScaleCalculator diffScaleCalculator = new ScaleCalculator();
diffScaleCalculator.body_height = currentScaleUser.body_height;
diffScaleCalculator.setScaleData(diffScaleData);
measurementWeightLast.setDiff(lastScaleData.weight, diffScaleData.weight);
measurementBMILast.setDiff(lastScaleCalculator.getBMI(), diffScaleCalculator.getBMI());
measurementMuscleLast.setDiff(lastScaleData.muscle, diffScaleData.muscle);
measurementFatLast.setDiff(lastScaleData.fat, diffScaleData.fat);
measurementWaterLast.setDiff(lastScaleData.water, diffScaleData.water);
measurementWaistLast.setDiff(lastScaleData.waist, diffScaleData.waist);
measurementWHtRLast.setDiff(lastScaleCalculator.getWHtR(), diffScaleCalculator.getWHtR());
measurementHipLast.setDiff(lastScaleData.hip, diffScaleData.hip);
measurementWHRLast.setDiff(lastScaleCalculator.getWHR(), diffScaleCalculator.getWHR());
for (MeasurementView measuremt : overviewMeasurements) {
measuremt.updateDiff(lastScaleData, diffScaleData);
}
}
}
}
@@ -395,21 +351,19 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
{
histDate.setTime(scaleData.date_time);
ScaleCalculator calculator = new ScaleCalculator();
calculator.body_height = currentScaleUser.body_height;
calculator.setScaleData(scaleData);
ScaleCalculator calculator = new ScaleCalculator(scaleData);
if (weekPastDate.before(histDate)) {
weekSize++;
weekAvgWeight += scaleData.weight;
weekAvgBMI += calculator.getBMI();
weekAvgBMI += calculator.getBMI(currentScaleUser.body_height);
weekAvgFat += scaleData.fat;
weekAvgWater += scaleData.water;
weekAvgMuscle += scaleData.muscle;
weekAvgWaist += scaleData.waist;
weekAvgHip += scaleData.hip;
weekAvgWHtR += calculator.getWHtR();
weekAvgWHtR += calculator.getWHtR(currentScaleUser.body_height);
weekAvgWHR += calculator.getWHR();
}
@@ -417,13 +371,13 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
monthSize++;
monthAvgWeight += scaleData.weight;
monthAvgBMI += calculator.getBMI();
monthAvgBMI += calculator.getBMI(currentScaleUser.body_height);
monthAvgFat += scaleData.fat;
monthAvgWater += scaleData.water;
monthAvgMuscle += scaleData.muscle;
monthAvgWaist += scaleData.waist;
monthAvgHip += scaleData.hip;
monthAvgWHtR += calculator.getWHtR();
monthAvgWHtR += calculator.getWHtR(currentScaleUser.body_height);
monthAvgWHR += calculator.getWHR();
} else {
break;

View File

@@ -1,35 +0,0 @@
package com.health.openscale.gui;
import android.text.Html;
import android.widget.TextView;
public class ScaleDiff {
private static String SYMBOL_UP = "&#x2197;";
private static String SYMBOL_DOWN = "&#x2198;";
public static void setDiff(TextView txtLabel,
double diff,
String labelResource,
String format) {
String symbol;
if (diff > 0.0) {
symbol = SYMBOL_UP;
} else {
symbol = SYMBOL_DOWN;
}
txtLabel.setText(
Html.fromHtml(
labelResource +
" <br> <font color='grey'>" +
symbol +
"<small> " +
String.format(format, diff) +
"</small></font>"
)
);
}
}

View File

@@ -90,642 +90,6 @@
android:layout_weight="90"
android:stretchColumns="1"
android:id="@+id/tableLayoutMeasurements">
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="@+id/tableRowWeight">
<ImageView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:id="@+id/imageView11"
android:src="@drawable/weight"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_weight"
android:id="@+id/txtLabelWeight"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:layout_marginLeft="20dp"
android:password="false"
android:phoneNumber="false"
android:lines="2"
android:layout_marginRight="50dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1kg"
android:id="@+id/txtWeightLast"
android:layout_column="2"
android:layout_gravity="center_vertical"
android:layout_marginRight="20dp" />
<ImageView
android:layout_width="10dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorWeight" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/tableRowGaugeWeight"
android:visibility="gone"
android:layout_marginBottom="10dp">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeWeight" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="@+id/tableRowBMI">
<ImageView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:id="@+id/imageView"
android:src="@drawable/bmi"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_bmi"
android:id="@+id/txtLabelBMI"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:layout_marginLeft="20dp"
android:password="false"
android:phoneNumber="false"
android:lines="2"
android:layout_marginRight="50dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1"
android:id="@+id/txtBMILast"
android:layout_column="2"
android:layout_gravity="center_vertical"
android:layout_marginRight="20dp" />
<ImageView
android:layout_width="10dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorBMI" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="@+id/tableRowGaugeBMI"
android:visibility="gone">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeBMI" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/tableRowFat"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="40dp"
android:id="@+id/imageView2"
android:src="@drawable/fat"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_fat"
android:id="@+id/txtLabelFat"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:layout_marginLeft="20dp"
android:password="false"
android:phoneNumber="false"
android:lines="2"
android:layout_marginRight="50dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1 %"
android:id="@+id/txtFatLast"
android:layout_column="2"
android:layout_gravity="center_vertical" />
<ImageView
android:layout_width="10dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorFat" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="@+id/tableRowGaugeFat"
android:visibility="gone">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeFat" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/tableRowMuscle"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="40dp"
android:id="@+id/imageView3"
android:src="@drawable/muscle"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_muscle"
android:id="@+id/txtLabelMuscle"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:layout_marginLeft="20dp"
android:password="false"
android:phoneNumber="false"
android:lines="2"
android:layout_marginRight="50dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1 %"
android:id="@+id/txtMuscleLast"
android:layout_column="2"
android:layout_gravity="center_vertical"
android:layout_marginRight="20dp" />
<ImageView
android:layout_width="10dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorMuscle" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="@+id/tableRowGaugeMuscle"
android:visibility="gone">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeMuscle" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/tableRowWater"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="40dp"
android:id="@+id/imageView4"
android:src="@drawable/water"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_water"
android:id="@+id/txtLabelWater"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:layout_marginLeft="20dp"
android:password="false"
android:phoneNumber="false"
android:lines="2"
android:layout_marginRight="50dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1 %"
android:id="@+id/txtWaterLast"
android:layout_column="2"
android:layout_gravity="center_vertical"
android:layout_marginRight="20dp" />
<ImageView
android:layout_width="10dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorWater" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="@+id/tableRowGaugeWater"
android:visibility="gone">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeWater" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/tableRowWaist"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="40dp"
android:id="@+id/imageView45"
android:src="@drawable/waist"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_waist"
android:id="@+id/txtLabelWaist"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:layout_marginLeft="20dp"
android:password="false"
android:phoneNumber="false"
android:lines="2"
android:layout_marginRight="50dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1 %"
android:id="@+id/txtWaistLast"
android:layout_column="2"
android:layout_gravity="center_vertical"
android:layout_marginRight="20dp" />
<ImageView
android:layout_width="10dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorWaist" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="@+id/tableRowGaugeWaist"
android:visibility="gone">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeWaist" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/tableRowWHtR"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="40dp"
android:id="@+id/imageView456"
android:src="@drawable/whtr"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_whtr"
android:id="@+id/txtLabelWHtR"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:layout_marginLeft="20dp"
android:password="false"
android:phoneNumber="false"
android:lines="2"
android:layout_marginRight="50dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1"
android:id="@+id/txtWHtRLast"
android:layout_column="2"
android:layout_gravity="center_vertical"
android:layout_marginRight="20dp" />
<ImageView
android:layout_width="10dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorWHtR" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="@+id/tableRowGaugeWHtR"
android:visibility="gone">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeWHtR" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/tableRowHip"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="40dp"
android:id="@+id/imageView16"
android:src="@drawable/hip"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_hip"
android:id="@+id/txtLabelHip"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:layout_marginLeft="20dp"
android:password="false"
android:phoneNumber="false"
android:lines="2"
android:layout_marginRight="50dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1 %"
android:id="@+id/txtHipLast"
android:layout_column="2"
android:layout_gravity="center_vertical"
android:layout_marginRight="20dp" />
<ImageView
android:layout_width="10dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorHip" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="@+id/tableRowGaugeHip"
android:visibility="gone">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeHip" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/tableRowWHR"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="40dp"
android:id="@+id/imageView49"
android:src="@drawable/whr"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_whr"
android:id="@+id/txtLabelWHR"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:layout_marginLeft="20dp"
android:password="false"
android:phoneNumber="false"
android:lines="2"
android:layout_marginRight="50dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1"
android:id="@+id/txtWHRLast"
android:layout_column="2"
android:layout_gravity="center_vertical"
android:layout_marginRight="20dp" />
<ImageView
android:layout_width="10dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorWHR" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="@+id/tableRowGaugeWHR"
android:visibility="gone">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeWHR" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
</TableLayout>
<TextView

View File

@@ -81,665 +81,6 @@
android:layout_height="fill_parent"
android:stretchColumns="1"
android:id="@+id/tableLayoutMeasurements">
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="5dp"
android:weightSum="100"
android:id="@+id/tableRowWeight">
<ImageView
android:layout_width="wrap_content"
android:layout_height="25dp"
android:id="@+id/imageView11"
android:src="@drawable/weight"
android:layout_gravity="center"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="80"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_weight"
android:id="@+id/txtLabelWeight"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:password="false"
android:phoneNumber="false"
android:lines="2"/>
<TextView
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="20"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1kg"
android:layout_column="2"
android:id="@+id/txtWeightLast"
android:layout_gravity="center_vertical"/>
<ImageView
android:layout_width="2dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorWeight" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/tableRowGaugeWeight"
android:visibility="gone"
android:layout_marginBottom="10dp">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeWeight" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:weightSum="100"
android:id="@+id/tableRowBMI">
<ImageView
android:layout_width="wrap_content"
android:layout_height="25dp"
android:id="@+id/imageView"
android:src="@drawable/bmi"
android:layout_gravity="center" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="80"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_bmi"
android:id="@+id/txtLabelBMI"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:layout_marginLeft="5dp"
android:password="false"
android:phoneNumber="false"
android:lines="2" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="20"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1"
android:id="@+id/txtBMILast"
android:layout_column="2"
android:layout_gravity="center_vertical" />
<ImageView
android:layout_width="2dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorBMI" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:weightSum="100"
android:id="@+id/tableRowGaugeBMI"
android:visibility="gone">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeBMI" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/tableRowFat"
android:weightSum="100"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="25dp"
android:id="@+id/imageView2"
android:src="@drawable/fat"
android:layout_gravity="center" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="80"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_fat"
android:id="@+id/txtLabelFat"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:layout_marginLeft="5dp"
android:password="false"
android:phoneNumber="false"
android:lines="2"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="20"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1 %"
android:id="@+id/txtFatLast"
android:layout_column="2"
android:layout_gravity="center_vertical" />
<ImageView
android:layout_width="2dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorFat" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="@+id/tableRowGaugeFat"
android:visibility="gone">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeFat" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/tableRowMuscle"
android:weightSum="100"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="25dp"
android:id="@+id/imageView3"
android:src="@drawable/muscle"
android:layout_gravity="center" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="80"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_muscle"
android:id="@+id/txtLabelMuscle"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:layout_marginLeft="5dp"
android:password="false"
android:phoneNumber="false"
android:lines="2" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="20"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1 %"
android:id="@+id/txtMuscleLast"
android:layout_column="2"
android:layout_gravity="center_vertical" />
<ImageView
android:layout_width="2dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorMuscle" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="@+id/tableRowGaugeMuscle"
android:visibility="gone">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeMuscle" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/tableRowWater"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="25dp"
android:id="@+id/imageView4"
android:src="@drawable/water"
android:layout_gravity="center" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="80"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_water"
android:id="@+id/txtLabelWater"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:layout_marginLeft="5dp"
android:password="false"
android:phoneNumber="false"
android:lines="2"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="20"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1 %"
android:id="@+id/txtWaterLast"
android:layout_column="2"
android:layout_gravity="center_vertical" />
<ImageView
android:layout_width="2dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorWater" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="@+id/tableRowGaugeWater"
android:visibility="gone">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeWater" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/tableRowWaist"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="25dp"
android:id="@+id/imageView45"
android:src="@drawable/waist"
android:layout_gravity="center" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="80"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_waist"
android:id="@+id/txtLabelWaist"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:layout_marginLeft="5dp"
android:password="false"
android:phoneNumber="false"
android:lines="2" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="20"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1 %"
android:id="@+id/txtWaistLast"
android:layout_column="2"
android:layout_gravity="center_vertical" />
<ImageView
android:layout_width="2dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorWaist" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="@+id/tableRowGaugeWaist"
android:visibility="gone">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeWaist" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/tableRowWHtR"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="25dp"
android:id="@+id/imageView456"
android:src="@drawable/whtr"
android:layout_gravity="center" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="80"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_whtr"
android:id="@+id/txtLabelWHtR"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:layout_marginLeft="5dp"
android:password="false"
android:phoneNumber="false"
android:lines="2" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="20"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1"
android:id="@+id/txtWHtRLast"
android:layout_column="2"
android:layout_gravity="center_vertical" />
<ImageView
android:layout_width="2dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorWHtR" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="@+id/tableRowGaugeWHtR"
android:visibility="gone">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeWHtR" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/tableRowHip"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="25dp"
android:id="@+id/imageView16"
android:src="@drawable/hip"
android:layout_gravity="center" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="80"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_hip"
android:id="@+id/txtLabelHip"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:layout_marginLeft="5dp"
android:password="false"
android:phoneNumber="false"
android:lines="2" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="20"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1 %"
android:id="@+id/txtHipLast"
android:layout_column="2"
android:layout_gravity="center_vertical"/>
<ImageView
android:layout_width="10dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorHip" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="@+id/tableRowGaugeHip"
android:visibility="gone">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeHip" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/tableRowWHR"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="25dp"
android:id="@+id/imageView49"
android:src="@drawable/whr"
android:layout_gravity="center" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="80"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/label_whr"
android:id="@+id/txtLabelWHR"
android:layout_column="1"
android:textAlignment="center"
android:singleLine="false"
android:layout_marginLeft="5dp"
android:password="false"
android:phoneNumber="false"
android:lines="2" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="20"
android:textSize="15dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="-1"
android:id="@+id/txtWHRLast"
android:layout_column="2"
android:layout_gravity="center_vertical" />
<ImageView
android:layout_width="2dp"
android:layout_height="fill_parent"
android:id="@+id/indicatorWHR" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="@+id/tableRowGaugeWHR"
android:visibility="gone">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<com.health.openscale.gui.LinearGaugeView
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/linearGaugeWHR" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
</TableRow>
</TableLayout>
<TextView