mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-23 00:33:09 +02:00
- evaluates all body values
- calculates the waist-to-height ratio - calculates the waist-hip ratio - fix some bugs
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
/* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.health.openscale.core;
|
||||
|
||||
public class EvaluationResult {
|
||||
public static enum EVAL_STATE {LOW, NORMAL, HIGH, UNDEFINED};
|
||||
|
||||
public float value;
|
||||
public float lowLimit;
|
||||
public float highLimit;
|
||||
public EVAL_STATE eval_state;
|
||||
|
||||
public EvaluationResult(float value, float lowLimit, float highLimit, EVAL_STATE eval_state)
|
||||
{
|
||||
this.value = value;
|
||||
this.lowLimit = lowLimit;
|
||||
this.highLimit = highLimit;
|
||||
this.eval_state = eval_state;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,313 @@
|
||||
/* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.health.openscale.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class EvaluationSheet {
|
||||
|
||||
private ScaleUser evalUser;
|
||||
private int userAge;
|
||||
|
||||
private List<sheetEntry> fatEvaluateSheet_Man;
|
||||
private List<sheetEntry> fatEvaluateSheet_Woman;
|
||||
|
||||
private List<sheetEntry> waterEvaluateSheet_Man;
|
||||
private List<sheetEntry> waterEvaluateSheet_Woman;
|
||||
|
||||
private List<sheetEntry> muscleEvaluateSheet_Man;
|
||||
private List<sheetEntry> muscleEvaluateSheet_Woman;
|
||||
|
||||
private List<sheetEntry> bmiEvaluateSheet_Man;
|
||||
private List<sheetEntry> bmiEvaluateSheet_Woman;
|
||||
|
||||
private List<sheetEntry> waistEvaluateSheet_Man;
|
||||
private List<sheetEntry> waistEvaluateSheet_Woman;
|
||||
|
||||
private List<sheetEntry> whrtEvaluateSheet;
|
||||
|
||||
private List<sheetEntry> whrEvaluateSheet_Man;
|
||||
private List<sheetEntry> whrEvaluateSheet_Woman;
|
||||
|
||||
private class sheetEntry {
|
||||
public sheetEntry(int lowAge, int maxAge, float lowLimit, float highLimit)
|
||||
{
|
||||
this.lowAge = lowAge;
|
||||
this.maxAge = maxAge;
|
||||
this.lowLimit = lowLimit;
|
||||
this.highLimit = highLimit;
|
||||
}
|
||||
|
||||
public int lowAge;
|
||||
public int maxAge;
|
||||
public float lowLimit;
|
||||
public float highLimit;
|
||||
}
|
||||
|
||||
|
||||
public EvaluationSheet(ScaleUser user) {
|
||||
evalUser = user;
|
||||
userAge = getAge(evalUser.birthday);
|
||||
|
||||
fatEvaluateSheet_Man = new ArrayList<>();
|
||||
fatEvaluateSheet_Woman = new ArrayList<>();
|
||||
|
||||
waterEvaluateSheet_Man = new ArrayList<>();
|
||||
waterEvaluateSheet_Woman = new ArrayList<>();
|
||||
|
||||
muscleEvaluateSheet_Man = new ArrayList<>();
|
||||
muscleEvaluateSheet_Woman = new ArrayList<>();
|
||||
|
||||
bmiEvaluateSheet_Man = new ArrayList<>();
|
||||
bmiEvaluateSheet_Woman = new ArrayList<>();
|
||||
|
||||
waistEvaluateSheet_Man = new ArrayList<>();
|
||||
waistEvaluateSheet_Woman = new ArrayList<>();
|
||||
|
||||
whrtEvaluateSheet = new ArrayList<>();
|
||||
|
||||
whrEvaluateSheet_Man = new ArrayList<>();
|
||||
whrEvaluateSheet_Woman = new ArrayList<>();
|
||||
|
||||
initEvaluationSheets();
|
||||
}
|
||||
|
||||
private void initEvaluationSheets()
|
||||
{
|
||||
fatEvaluateSheet_Man.add(new sheetEntry(10, 14, 11, 16));
|
||||
fatEvaluateSheet_Man.add(new sheetEntry(15, 19, 12, 17));
|
||||
fatEvaluateSheet_Man.add(new sheetEntry(20, 29, 13, 18));
|
||||
fatEvaluateSheet_Man.add(new sheetEntry(30, 39, 14, 19));
|
||||
fatEvaluateSheet_Man.add(new sheetEntry(40, 49, 15, 20));
|
||||
fatEvaluateSheet_Man.add(new sheetEntry(50, 59, 16, 21));
|
||||
fatEvaluateSheet_Man.add(new sheetEntry(60, 69, 17, 22));
|
||||
fatEvaluateSheet_Man.add(new sheetEntry(70, 1000, 18, 23));
|
||||
|
||||
|
||||
fatEvaluateSheet_Woman.add(new sheetEntry(10, 14, 16, 21));
|
||||
fatEvaluateSheet_Woman.add(new sheetEntry(15, 19, 17, 22));
|
||||
fatEvaluateSheet_Woman.add(new sheetEntry(20, 29, 18, 23));
|
||||
fatEvaluateSheet_Woman.add(new sheetEntry(30, 39, 19, 24));
|
||||
fatEvaluateSheet_Woman.add(new sheetEntry(40, 49, 20, 25));
|
||||
fatEvaluateSheet_Woman.add(new sheetEntry(50, 59, 21, 26));
|
||||
fatEvaluateSheet_Woman.add(new sheetEntry(60, 69, 22, 27));
|
||||
fatEvaluateSheet_Woman.add(new sheetEntry(70, 1000, 23, 28));
|
||||
|
||||
waterEvaluateSheet_Man.add(new sheetEntry(10, 1000, 50, 65));
|
||||
|
||||
waterEvaluateSheet_Woman.add(new sheetEntry(10, 1000, 45, 60));
|
||||
|
||||
muscleEvaluateSheet_Man.add(new sheetEntry(10, 14, 44, 57));
|
||||
muscleEvaluateSheet_Man.add(new sheetEntry(15, 19, 43, 56));
|
||||
muscleEvaluateSheet_Man.add(new sheetEntry(20, 29, 42, 54));
|
||||
muscleEvaluateSheet_Man.add(new sheetEntry(30, 39, 41, 52));
|
||||
muscleEvaluateSheet_Man.add(new sheetEntry(40, 49, 40, 50));
|
||||
muscleEvaluateSheet_Man.add(new sheetEntry(50, 59, 39, 48));
|
||||
muscleEvaluateSheet_Man.add(new sheetEntry(60, 69, 38, 47));
|
||||
muscleEvaluateSheet_Man.add(new sheetEntry(70, 1000, 37, 46));
|
||||
|
||||
|
||||
muscleEvaluateSheet_Woman.add(new sheetEntry(10, 14, 36, 43));
|
||||
muscleEvaluateSheet_Woman.add(new sheetEntry(15, 19, 35, 41));
|
||||
muscleEvaluateSheet_Woman.add(new sheetEntry(20, 29, 34, 39));
|
||||
muscleEvaluateSheet_Woman.add(new sheetEntry(30, 39, 33, 38));
|
||||
muscleEvaluateSheet_Woman.add(new sheetEntry(40, 49, 31, 36));
|
||||
muscleEvaluateSheet_Woman.add(new sheetEntry(50, 59, 29, 34));
|
||||
muscleEvaluateSheet_Woman.add(new sheetEntry(60, 69, 28, 33));
|
||||
muscleEvaluateSheet_Woman.add(new sheetEntry(70, 1000, 27, 32));
|
||||
|
||||
|
||||
bmiEvaluateSheet_Man.add(new sheetEntry(16, 24, 20, 25));
|
||||
bmiEvaluateSheet_Man.add(new sheetEntry(25, 34, 21, 26));
|
||||
bmiEvaluateSheet_Man.add(new sheetEntry(35, 44, 22, 27));
|
||||
bmiEvaluateSheet_Man.add(new sheetEntry(45, 54, 23, 28));
|
||||
bmiEvaluateSheet_Man.add(new sheetEntry(55, 64, 24, 29));
|
||||
bmiEvaluateSheet_Man.add(new sheetEntry(65, 90, 25, 30));
|
||||
|
||||
|
||||
bmiEvaluateSheet_Woman.add(new sheetEntry(16, 24, 19, 24));
|
||||
bmiEvaluateSheet_Woman.add(new sheetEntry(25, 34, 20, 25));
|
||||
bmiEvaluateSheet_Woman.add(new sheetEntry(35, 44, 21, 26));
|
||||
bmiEvaluateSheet_Woman.add(new sheetEntry(45, 54, 22, 27));
|
||||
bmiEvaluateSheet_Woman.add(new sheetEntry(55, 64, 23, 28));
|
||||
bmiEvaluateSheet_Woman.add(new sheetEntry(65, 90, 24, 29));
|
||||
|
||||
waistEvaluateSheet_Man.add(new sheetEntry(18, 90, -1, 94));
|
||||
waistEvaluateSheet_Woman.add(new sheetEntry(18, 90, -1, 80));
|
||||
|
||||
whrtEvaluateSheet.add(new sheetEntry(15, 40, 0.4f, 0.5f));
|
||||
whrtEvaluateSheet.add(new sheetEntry(41, 42, 0.4f, 0.51f));
|
||||
whrtEvaluateSheet.add(new sheetEntry(43, 44, 0.4f, 0.53f));
|
||||
whrtEvaluateSheet.add(new sheetEntry(45, 46, 0.4f, 0.55f));
|
||||
whrtEvaluateSheet.add(new sheetEntry(47, 48, 0.4f, 0.57f));
|
||||
whrtEvaluateSheet.add(new sheetEntry(49, 50, 0.4f, 0.59f));
|
||||
whrtEvaluateSheet.add(new sheetEntry(51, 90, 0.4f, 0.6f));
|
||||
|
||||
whrEvaluateSheet_Man.add(new sheetEntry(18, 90, 0.8f, 0.9f));
|
||||
whrEvaluateSheet_Woman.add(new sheetEntry(18, 90, 0.7f, 0.8f));
|
||||
}
|
||||
|
||||
|
||||
public EvaluationResult evaluateWeight(float weight) {
|
||||
float body_height_squared = (evalUser.body_height / 100.0f) * (evalUser.body_height / 100.0f);
|
||||
float lowLimit = 0.0f;
|
||||
float highLimit = 0.0f;
|
||||
|
||||
if (evalUser.isMale()) {
|
||||
lowLimit = body_height_squared * 20.0f;
|
||||
highLimit = body_height_squared * 25.0f;
|
||||
} else {
|
||||
lowLimit = body_height_squared * 19.0f;
|
||||
highLimit = body_height_squared * 24.0f;
|
||||
}
|
||||
|
||||
if (weight < lowLimit) { // low
|
||||
return new EvaluationResult(weight, Math.round(lowLimit), Math.round(highLimit), EvaluationResult.EVAL_STATE.LOW);
|
||||
} else if (weight >= lowLimit && weight <= highLimit) { // normal
|
||||
return new EvaluationResult(weight, Math.round(lowLimit), Math.round(highLimit), EvaluationResult.EVAL_STATE.NORMAL);
|
||||
} else if (weight > highLimit) { //high
|
||||
return new EvaluationResult(weight, Math.round(lowLimit), Math.round(highLimit), EvaluationResult.EVAL_STATE.HIGH);
|
||||
}
|
||||
|
||||
return new EvaluationResult(0, -1, -1, EvaluationResult.EVAL_STATE.UNDEFINED);
|
||||
}
|
||||
|
||||
|
||||
public EvaluationResult evaluateBodyFat(float fat) {
|
||||
List<sheetEntry> bodyEvaluateSheet;
|
||||
|
||||
if (evalUser.isMale()) {
|
||||
bodyEvaluateSheet = fatEvaluateSheet_Man;
|
||||
} else {
|
||||
bodyEvaluateSheet = fatEvaluateSheet_Woman;
|
||||
}
|
||||
|
||||
return evaluateSheet(fat, bodyEvaluateSheet);
|
||||
}
|
||||
|
||||
public EvaluationResult evaluateBodyWater(float water) {
|
||||
List<sheetEntry> bodyEvaluateSheet;
|
||||
|
||||
if (evalUser.isMale()) {
|
||||
bodyEvaluateSheet = waterEvaluateSheet_Man;
|
||||
} else {
|
||||
bodyEvaluateSheet = waterEvaluateSheet_Woman;
|
||||
}
|
||||
|
||||
return evaluateSheet(water, bodyEvaluateSheet);
|
||||
}
|
||||
|
||||
public EvaluationResult evaluateBodyMuscle(float muscle) {
|
||||
List<sheetEntry> bodyEvaluateSheet;
|
||||
|
||||
if (evalUser.isMale()) {
|
||||
bodyEvaluateSheet = muscleEvaluateSheet_Man;
|
||||
} else {
|
||||
bodyEvaluateSheet = muscleEvaluateSheet_Woman;
|
||||
}
|
||||
|
||||
return evaluateSheet(muscle, bodyEvaluateSheet);
|
||||
}
|
||||
|
||||
public EvaluationResult evaluateBMI(float bmi) {
|
||||
List<sheetEntry> bodyEvaluateSheet;
|
||||
|
||||
if (evalUser.isMale()) {
|
||||
bodyEvaluateSheet = bmiEvaluateSheet_Man;
|
||||
} else {
|
||||
bodyEvaluateSheet = bmiEvaluateSheet_Woman;
|
||||
}
|
||||
|
||||
return evaluateSheet(bmi, bodyEvaluateSheet);
|
||||
}
|
||||
|
||||
public EvaluationResult evaluateWaist(float waist) {
|
||||
List<sheetEntry> bodyEvaluateSheet;
|
||||
|
||||
if (evalUser.isMale()) {
|
||||
bodyEvaluateSheet = waistEvaluateSheet_Man;
|
||||
} else {
|
||||
bodyEvaluateSheet = waistEvaluateSheet_Woman;
|
||||
}
|
||||
|
||||
return evaluateSheet(waist, bodyEvaluateSheet);
|
||||
}
|
||||
|
||||
public EvaluationResult evaluateWHtR(float whrt) {
|
||||
return evaluateSheet(whrt, whrtEvaluateSheet);
|
||||
}
|
||||
|
||||
public EvaluationResult evaluateWHR(float whr) {
|
||||
List<sheetEntry> bodyEvaluateSheet;
|
||||
|
||||
if (evalUser.isMale()) {
|
||||
bodyEvaluateSheet = whrEvaluateSheet_Man;
|
||||
} else {
|
||||
bodyEvaluateSheet = whrEvaluateSheet_Woman;
|
||||
}
|
||||
|
||||
return evaluateSheet(whr, bodyEvaluateSheet);
|
||||
}
|
||||
|
||||
private EvaluationResult evaluateSheet(float value, List<sheetEntry> sheet) {
|
||||
for (int i=0; i < sheet.size(); i++) {
|
||||
sheetEntry curEntry = sheet.get(i);
|
||||
|
||||
if (curEntry.lowAge <= userAge && curEntry.maxAge >= userAge) {
|
||||
if (value < curEntry.lowLimit) { // low
|
||||
return new EvaluationResult(value, curEntry.lowLimit, curEntry.highLimit, EvaluationResult.EVAL_STATE.LOW);
|
||||
} else if (value >= curEntry.lowLimit && value <= curEntry.highLimit) { // normal
|
||||
return new EvaluationResult(value, curEntry.lowLimit, curEntry.highLimit, EvaluationResult.EVAL_STATE.NORMAL);
|
||||
} else if (value > curEntry.highLimit) { //high
|
||||
return new EvaluationResult(value, curEntry.lowLimit, curEntry.highLimit, EvaluationResult.EVAL_STATE.HIGH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new EvaluationResult(0, -1, -1, EvaluationResult.EVAL_STATE.UNDEFINED);
|
||||
}
|
||||
|
||||
private int getAge(Date dateOfBirth) {
|
||||
|
||||
Calendar today = Calendar.getInstance();
|
||||
Calendar birthDate = Calendar.getInstance();
|
||||
|
||||
int age = 0;
|
||||
|
||||
birthDate.setTime(dateOfBirth);
|
||||
if (birthDate.after(today)) {
|
||||
throw new IllegalArgumentException("Can't be born in the future");
|
||||
}
|
||||
|
||||
age = today.get(Calendar.YEAR) - birthDate.get(Calendar.YEAR);
|
||||
|
||||
// If birth date is greater than todays date (after 2 days adjustment of leap year) then decrement age one year
|
||||
if ( (birthDate.get(Calendar.DAY_OF_YEAR) - today.get(Calendar.DAY_OF_YEAR) > 3) ||
|
||||
(birthDate.get(Calendar.MONTH) > today.get(Calendar.MONTH ))){
|
||||
age--;
|
||||
|
||||
// If birth date and todays date are of same month and birth day of month is greater than todays day of month then decrement age
|
||||
}else if ((birthDate.get(Calendar.MONTH) == today.get(Calendar.MONTH )) &&
|
||||
(birthDate.get(Calendar.DAY_OF_MONTH) > today.get(Calendar.DAY_OF_MONTH ))){
|
||||
age--;
|
||||
}
|
||||
|
||||
return age;
|
||||
}
|
||||
}
|
@@ -0,0 +1,220 @@
|
||||
/* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package com.health.openscale.core;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import com.health.openscale.R;
|
||||
|
||||
|
||||
public class LinearGaugeView extends View {
|
||||
|
||||
public static final int COLOR_BLUE = Color.parseColor("#33B5E5");
|
||||
public static final int COLOR_VIOLET = Color.parseColor("#AA66CC");
|
||||
public static final int COLOR_GREEN = Color.parseColor("#99CC00");
|
||||
public static final int COLOR_ORANGE = Color.parseColor("#FFBB33");
|
||||
public static final int COLOR_RED = Color.parseColor("#FF4444");
|
||||
|
||||
private final float barHeight = 10;
|
||||
private final float limitLineHeight = 20;
|
||||
private final float lineThickness = 5.0f;
|
||||
private final float textOffset = 10.0f;
|
||||
|
||||
private float firstPercent;
|
||||
private float firstPos;
|
||||
private float secondPercent;
|
||||
private float secondPos;
|
||||
private float valuePercent;
|
||||
private float valuePos;
|
||||
|
||||
private Paint rectPaintLow;
|
||||
private Paint rectPaintNormal;
|
||||
private Paint rectPaintHigh;
|
||||
private Paint textPaint;
|
||||
private Paint indicatorPaint;
|
||||
private Paint infoTextPaint;
|
||||
|
||||
private float value;
|
||||
private int minValue;
|
||||
private int maxValue;
|
||||
private float firstLimit;
|
||||
private float secondLimit;
|
||||
|
||||
public LinearGaugeView(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public LinearGaugeView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public LinearGaugeView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
rectPaintLow = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
rectPaintLow.setColor(COLOR_BLUE);
|
||||
|
||||
rectPaintNormal = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
rectPaintNormal.setColor(COLOR_GREEN);
|
||||
|
||||
rectPaintHigh = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
rectPaintHigh.setColor(COLOR_RED);
|
||||
|
||||
textPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
textPaint.setColor(Color.GRAY);
|
||||
textPaint.setTextSize(20);
|
||||
|
||||
indicatorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
indicatorPaint.setColor(Color.BLACK);
|
||||
indicatorPaint.setTextSize(20);
|
||||
|
||||
infoTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
infoTextPaint.setColor(Color.GRAY);
|
||||
infoTextPaint.setTextSize(30);
|
||||
infoTextPaint.setTextAlign(Paint.Align.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
|
||||
if (firstLimit < 0 && secondLimit < 0) {
|
||||
float textY=getHeight() / 2.0f;
|
||||
float textX=getWidth() / 2.0f;
|
||||
canvas.drawText(getResources().getString(R.string.info_no_evaluation_available),textX,textY,infoTextPaint);
|
||||
return;
|
||||
}
|
||||
|
||||
firstPercent = (firstLimit / (float)maxValue) * 100.0f;
|
||||
firstPos = (getWidth() / 100.0f) * firstPercent;
|
||||
|
||||
secondPercent = (secondLimit / (float)maxValue) * 100.0f;
|
||||
secondPos = (getWidth() / 100.0f) * secondPercent;
|
||||
|
||||
valuePercent = (value / (float)maxValue) * 100.0f;
|
||||
valuePos = (getWidth() / 100.0f) * valuePercent;
|
||||
|
||||
// Bar
|
||||
if (firstLimit > 0) {
|
||||
canvas.drawRect(0, (getHeight() / 2.0f) - (barHeight / 2.0f), firstPos, (getHeight() / 2.0f) + (barHeight / 2.0f), rectPaintLow);
|
||||
} else {
|
||||
canvas.drawRect(0, (getHeight() / 2.0f) - (barHeight / 2.0f), firstPos, (getHeight() / 2.0f) + (barHeight / 2.0f), rectPaintNormal);
|
||||
}
|
||||
canvas.drawRect(firstPos, (getHeight() / 2.0f) - (barHeight / 2.0f), secondPos , (getHeight() / 2.0f) + (barHeight / 2.0f), rectPaintNormal);
|
||||
canvas.drawRect(secondPos,(getHeight() / 2.0f) - (barHeight / 2.0f), getWidth() , (getHeight() / 2.0f) + (barHeight / 2.0f), rectPaintHigh);
|
||||
|
||||
// Limit Lines
|
||||
canvas.drawRect(0, (getHeight() / 2.0f) - (limitLineHeight / 2.0f), 0+lineThickness, (getHeight() / 2.0f) + (limitLineHeight / 2.0f), textPaint);
|
||||
if (firstLimit > 0) {
|
||||
canvas.drawRect(firstPos, (getHeight() / 2.0f) - (limitLineHeight / 2.0f), firstPos + lineThickness, (getHeight() / 2.0f) + (limitLineHeight / 2.0f), textPaint);
|
||||
}
|
||||
canvas.drawRect(secondPos, (getHeight() / 2.0f) - (limitLineHeight / 2.0f), secondPos+lineThickness, (getHeight() / 2.0f) + (limitLineHeight / 2.0f), textPaint);
|
||||
canvas.drawRect(getWidth()-lineThickness, (getHeight() / 2.0f) - (limitLineHeight / 2.0f), getWidth(), (getHeight() / 2.0f) + (limitLineHeight / 2.0f), textPaint);
|
||||
|
||||
// Text
|
||||
canvas.drawText(Integer.toString(minValue), 0.0f, (getHeight() / 2.0f) - (barHeight / 2.0f) - textOffset, textPaint);
|
||||
if (firstLimit > 0) {
|
||||
canvas.drawText(Float.toString(firstLimit), firstPos - 5.0f, (getHeight() / 2.0f) - (barHeight / 2.0f) - textOffset, textPaint);
|
||||
}
|
||||
canvas.drawText(Float.toString(secondLimit), secondPos-5.0f, (getHeight() / 2.0f) - (barHeight / 2.0f) - textOffset, textPaint);
|
||||
canvas.drawText(Float.toString(maxValue), getWidth()-40.0f, (getHeight() / 2.0f) - (barHeight / 2.0f)- textOffset, textPaint);
|
||||
|
||||
// Indicator
|
||||
Path path = new Path();
|
||||
path.setFillType(Path.FillType.EVEN_ODD);
|
||||
path.moveTo(valuePos, (getHeight() / 2.0f) - 10.0f);
|
||||
path.lineTo(valuePos + 10.0f, (getHeight() / 2.0f) + 20.0f);
|
||||
path.lineTo(valuePos - 10.0f, (getHeight() / 2.0f) + 20.0f);
|
||||
path.lineTo(valuePos, (getHeight() / 2.0f) - 10.0f);
|
||||
path.close();
|
||||
|
||||
canvas.drawPath(path, indicatorPaint);
|
||||
canvas.drawText(String.format("%.2f", value), valuePos-15.0f, (getHeight() / 2.0f) - (barHeight / 2.0f) - textOffset, indicatorPaint);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
|
||||
int desiredWidth = 100;
|
||||
int desiredHeight = 100;
|
||||
|
||||
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
|
||||
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
|
||||
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
|
||||
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
|
||||
|
||||
int width;
|
||||
int height;
|
||||
|
||||
//Measure Width
|
||||
if (widthMode == MeasureSpec.EXACTLY) {
|
||||
//Must be this size
|
||||
width = widthSize;
|
||||
} else if (widthMode == MeasureSpec.AT_MOST) {
|
||||
//Can't be bigger than...
|
||||
width = Math.min(desiredWidth, widthSize);
|
||||
} else {
|
||||
//Be whatever you want
|
||||
width = desiredWidth;
|
||||
}
|
||||
|
||||
//Measure Height
|
||||
if (heightMode == MeasureSpec.EXACTLY) {
|
||||
//Must be this size
|
||||
height = heightSize;
|
||||
} else if (heightMode == MeasureSpec.AT_MOST) {
|
||||
//Can't be bigger than...
|
||||
height = Math.min(desiredHeight, heightSize);
|
||||
} else {
|
||||
//Be whatever you want
|
||||
height = desiredHeight;
|
||||
}
|
||||
|
||||
//MUST CALL THIS
|
||||
setMeasuredDimension(width, height);
|
||||
}
|
||||
|
||||
public void setMinMaxValue(int min, int max) {
|
||||
minValue = min;
|
||||
maxValue = max;
|
||||
invalidate();
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public void setLimits(float first, float second) {
|
||||
firstLimit = first;
|
||||
secondLimit = second;
|
||||
invalidate();
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public void setValue(float value) {
|
||||
this.value = value;
|
||||
invalidate();
|
||||
requestLayout();
|
||||
}
|
||||
}
|
@@ -23,6 +23,8 @@ import android.os.Message;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.health.openscale.gui.FragmentUpdateListener;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -49,11 +51,14 @@ public class OpenScale {
|
||||
|
||||
private Context context;
|
||||
|
||||
private ArrayList<FragmentUpdateListener> fragmentList;
|
||||
|
||||
private OpenScale(Context con) {
|
||||
context = con;
|
||||
scaleDB = new ScaleDatabase(context);
|
||||
scaleUserDB = new ScaleUserDatabase(context);
|
||||
btCom = null;
|
||||
fragmentList = new ArrayList<>();
|
||||
|
||||
updateScaleData();
|
||||
}
|
||||
@@ -66,7 +71,7 @@ public class OpenScale {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void addScaleUser(String name, String birthday, int body_height, int scale_unit, int gender, double goal_weight, String goal_date)
|
||||
public void addScaleUser(String name, String birthday, int body_height, int scale_unit, int gender, float goal_weight, String goal_date)
|
||||
{
|
||||
ScaleUser scaleUser = new ScaleUser();
|
||||
|
||||
@@ -88,8 +93,6 @@ public class OpenScale {
|
||||
|
||||
public ArrayList<ScaleUser> getScaleUserList()
|
||||
{
|
||||
updateScaleData();
|
||||
|
||||
return scaleUserDB.getScaleUserList();
|
||||
}
|
||||
|
||||
@@ -117,7 +120,7 @@ public class OpenScale {
|
||||
scaleUserDB.deleteEntry(id);
|
||||
}
|
||||
|
||||
public void updateScaleUser(int id, String name, String birthday, int body_height, int scale_unit, int gender, double goal_weight, String goal_date)
|
||||
public void updateScaleUser(int id, String name, String birthday, int body_height, int scale_unit, int gender, float goal_weight, String goal_date)
|
||||
{
|
||||
ScaleUser scaleUser = new ScaleUser();
|
||||
|
||||
@@ -312,11 +315,10 @@ public class OpenScale {
|
||||
}
|
||||
|
||||
public void stopBluetoothServer() {
|
||||
Log.d("OpenScale", "Bluetooth Server stopped!");
|
||||
|
||||
if (btCom != null) {
|
||||
btCom.cancel();
|
||||
}
|
||||
Log.d("OpenScale", "Bluetooth Server stopped!");
|
||||
}
|
||||
}
|
||||
|
||||
private final Handler btHandler = new Handler() {
|
||||
@@ -411,11 +413,22 @@ public class OpenScale {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateScaleData()
|
||||
public void registerFragment(FragmentUpdateListener fragment) {
|
||||
fragmentList.add(fragment);
|
||||
fragment.updateOnView(scaleDataList);
|
||||
}
|
||||
|
||||
public void updateScaleData()
|
||||
{
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
int selectedUserId = prefs.getInt("selectedUserId", -1);
|
||||
|
||||
scaleDataList = scaleDB.getScaleDataList(selectedUserId);
|
||||
|
||||
for(FragmentUpdateListener fragment : fragmentList) {
|
||||
if (fragment != null) {
|
||||
fragment.updateOnView(scaleDataList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -77,6 +77,9 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
COLUMN_NAME_COMMENT
|
||||
};
|
||||
|
||||
private final SQLiteDatabase dbWrite = getWritableDatabase();
|
||||
private final SQLiteDatabase dbRead = getReadableDatabase();
|
||||
|
||||
private SimpleDateFormat formatDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);
|
||||
|
||||
public ScaleDatabase(Context context) {
|
||||
@@ -101,9 +104,7 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
public void clearScaleData(int userId) {
|
||||
SQLiteDatabase db = getWritableDatabase();
|
||||
|
||||
db.delete(TABLE_NAME, COLUMN_NAME_USER_ID + "=" + Integer.toString(userId), null);
|
||||
dbWrite.delete(TABLE_NAME, COLUMN_NAME_USER_ID + "=" + Integer.toString(userId), null);
|
||||
}
|
||||
|
||||
public boolean insertEntry(ScaleData scaleData) {
|
||||
@@ -138,12 +139,12 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
}
|
||||
}
|
||||
|
||||
cursorScaleDB.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateEntry(long id, ScaleData scaleData) {
|
||||
SQLiteDatabase db = getWritableDatabase();
|
||||
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(COLUMN_NAME_DATE_TIME, formatDateTime.format(scaleData.date_time));
|
||||
values.put(COLUMN_NAME_WEIGHT, scaleData.weight);
|
||||
@@ -154,14 +155,12 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
values.put(COLUMN_NAME_HIP, scaleData.hip);
|
||||
values.put(COLUMN_NAME_COMMENT, scaleData.comment);
|
||||
|
||||
db.update(TABLE_NAME, values, COLUMN_NAME_ID + "=" + id, null);
|
||||
dbWrite.update(TABLE_NAME, values, COLUMN_NAME_ID + "=" + id, null);
|
||||
}
|
||||
|
||||
public ScaleData getDataEntry(long id)
|
||||
{
|
||||
SQLiteDatabase db = getReadableDatabase();;
|
||||
|
||||
Cursor cursorScaleDB = db.query(
|
||||
Cursor cursorScaleDB = dbRead.query(
|
||||
TABLE_NAME, // The table to query
|
||||
projection, // The columns to return
|
||||
COLUMN_NAME_ID + "=?", // The columns for the WHERE clause
|
||||
@@ -173,20 +172,20 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
|
||||
cursorScaleDB.moveToFirst();
|
||||
|
||||
return readAtCursor(cursorScaleDB);
|
||||
ScaleData scaleData = readAtCursor(cursorScaleDB);
|
||||
|
||||
cursorScaleDB.close();
|
||||
|
||||
return scaleData;
|
||||
}
|
||||
|
||||
public void deleteEntry(long id) {
|
||||
SQLiteDatabase db = getWritableDatabase();
|
||||
|
||||
db.delete(TABLE_NAME, COLUMN_NAME_ID + "= ?", new String[] {String.valueOf(id)});
|
||||
dbWrite.delete(TABLE_NAME, COLUMN_NAME_ID + "= ?", new String[] {String.valueOf(id)});
|
||||
}
|
||||
|
||||
public int[] getCountsOfAllMonth(int userId, int year) {
|
||||
int [] numOfMonth = new int[12];
|
||||
|
||||
SQLiteDatabase db = getReadableDatabase();
|
||||
|
||||
Calendar start_cal = Calendar.getInstance();
|
||||
Calendar end_cal = Calendar.getInstance();
|
||||
|
||||
@@ -195,7 +194,7 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
end_cal.set(year, i, 1, 0, 0, 0);
|
||||
end_cal.add(Calendar.MONTH, 1);
|
||||
|
||||
Cursor cursorScaleDB = db.query(
|
||||
Cursor cursorScaleDB = dbRead.query(
|
||||
TABLE_NAME, // The table to query
|
||||
new String[]{"count(*)"}, // The columns to return
|
||||
COLUMN_NAME_DATE_TIME + " >= ? AND " + COLUMN_NAME_DATE_TIME + " < ? AND " + COLUMN_NAME_USER_ID + "=?", // The columns for the WHERE clause
|
||||
@@ -208,13 +207,14 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
cursorScaleDB.moveToFirst();
|
||||
|
||||
numOfMonth[i] = cursorScaleDB.getInt(0);
|
||||
|
||||
cursorScaleDB.close();
|
||||
}
|
||||
|
||||
return numOfMonth;
|
||||
}
|
||||
|
||||
public ArrayList<ScaleData> getScaleDataOfMonth(int userId, int year, int month) {
|
||||
SQLiteDatabase db = getReadableDatabase();
|
||||
ArrayList<ScaleData> scaleDataList = new ArrayList<ScaleData>();
|
||||
|
||||
String sortOrder = COLUMN_NAME_DATE_TIME + " DESC";
|
||||
@@ -226,7 +226,7 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
end_cal.set(year, month, 1, 0, 0, 0);
|
||||
end_cal.add(Calendar.MONTH, 1);
|
||||
|
||||
Cursor cursorScaleDB = db.query(
|
||||
Cursor cursorScaleDB = dbRead.query(
|
||||
TABLE_NAME, // The table to query
|
||||
projection, // The columns to return
|
||||
COLUMN_NAME_DATE_TIME + " >= ? AND " + COLUMN_NAME_DATE_TIME + " < ? AND " + COLUMN_NAME_USER_ID + "=?", // The columns for the WHERE clause
|
||||
@@ -244,16 +244,17 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
cursorScaleDB.moveToNext();
|
||||
}
|
||||
|
||||
cursorScaleDB.close();
|
||||
|
||||
return scaleDataList;
|
||||
}
|
||||
|
||||
public ArrayList<ScaleData> getScaleDataList(int userId) {
|
||||
SQLiteDatabase db = getReadableDatabase();
|
||||
ArrayList<ScaleData> scaleDataList = new ArrayList<ScaleData>();
|
||||
|
||||
String sortOrder = COLUMN_NAME_DATE_TIME + " DESC";
|
||||
|
||||
Cursor cursorScaleDB = db.query(
|
||||
Cursor cursorScaleDB = dbRead.query(
|
||||
TABLE_NAME, // The table to query
|
||||
projection, // The columns to return
|
||||
COLUMN_NAME_USER_ID + "=?", // The columns for the WHERE clause
|
||||
@@ -270,6 +271,8 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
|
||||
cursorScaleDB.moveToNext();
|
||||
}
|
||||
|
||||
cursorScaleDB.close();
|
||||
|
||||
return scaleDataList;
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ public class ScaleUser {
|
||||
public int body_height;
|
||||
public int scale_unit;
|
||||
public int gender;
|
||||
public double goal_weight;
|
||||
public float goal_weight;
|
||||
public Date goal_date;
|
||||
|
||||
public ScaleUser() {
|
||||
@@ -35,8 +35,8 @@ public class ScaleUser {
|
||||
user_name = new String();
|
||||
birthday = new Date();
|
||||
body_height = -1;
|
||||
scale_unit = -1;
|
||||
gender = -1;
|
||||
scale_unit = 0;
|
||||
gender = 0;
|
||||
goal_weight = -1;
|
||||
goal_date = new Date();
|
||||
}
|
||||
@@ -49,8 +49,20 @@ public class ScaleUser {
|
||||
return false;
|
||||
}
|
||||
|
||||
public double getBMI(double weight) {
|
||||
return weight / ((body_height / 100.0)*(body_height / 100.0));
|
||||
public float getBMI(float weight) {
|
||||
return weight / ((body_height / 100.0f)*(body_height / 100.0f));
|
||||
}
|
||||
|
||||
public float getWHtR(float waist) {
|
||||
return waist / (float)body_height;
|
||||
}
|
||||
|
||||
public float getWHR(float waist, float hip) {
|
||||
if (hip == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return waist / hip;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -158,7 +158,11 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
||||
|
||||
cursorScaleDB.moveToFirst();
|
||||
|
||||
return readAtCursor(cursorScaleDB);
|
||||
ScaleUser scaleUser = readAtCursor(cursorScaleDB);
|
||||
|
||||
cursorScaleDB.close();
|
||||
|
||||
return scaleUser;
|
||||
}
|
||||
|
||||
public ArrayList<ScaleUser> getScaleUserList() {
|
||||
@@ -184,6 +188,8 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
||||
|
||||
cursorScaleDB.moveToNext();
|
||||
}
|
||||
|
||||
cursorScaleDB.close();
|
||||
|
||||
return scaleUserDBEntries;
|
||||
}
|
||||
@@ -204,7 +210,7 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
||||
scaleUser.birthday = formatDateTime.parse(birthday);
|
||||
scaleUser.goal_date = formatDateTime.parse(goal_date);
|
||||
|
||||
scaleUser.goal_weight = Math.round(goal_weight * 100.0) / 100.0;
|
||||
scaleUser.goal_weight = Math.round(goal_weight * 100.0f) / 100.0f;
|
||||
} catch (ParseException ex) {
|
||||
Log.e("ScaleDatabase", "Can't parse the date time string: " + ex.getMessage());
|
||||
}
|
||||
|
@@ -104,10 +104,12 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
||||
updateOnView(null);
|
||||
}
|
||||
});
|
||||
openScale = OpenScale.getInstance(graphView.getContext());
|
||||
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(graphView.getContext());
|
||||
|
||||
openScale = OpenScale.getInstance(graphView.getContext());
|
||||
openScale.registerFragment(this);
|
||||
|
||||
return graphView;
|
||||
}
|
||||
|
||||
|
@@ -89,11 +89,6 @@ public class MainActivity extends ActionBarActivity implements
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
actionBar.setSelectedNavigationItem(position);
|
||||
|
||||
FragmentUpdateListener fragment = (FragmentUpdateListener) mSectionsPagerAdapter.instantiateItem(mViewPager, position);
|
||||
if (fragment != null) {
|
||||
fragment.updateOnView(OpenScale.getInstance(mViewPager.getContext()).getScaleDataList());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -31,12 +31,17 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TableRow;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.EvaluationResult;
|
||||
import com.health.openscale.core.EvaluationSheet;
|
||||
import com.health.openscale.core.LinearGaugeView;
|
||||
import com.health.openscale.core.OpenScale;
|
||||
import com.health.openscale.core.ScaleData;
|
||||
import com.health.openscale.core.ScaleUser;
|
||||
@@ -45,6 +50,7 @@ import java.text.DateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import lecho.lib.hellocharts.formatter.SimpleLineChartValueFormatter;
|
||||
@@ -61,8 +67,8 @@ import lecho.lib.hellocharts.util.ChartUtils;
|
||||
import lecho.lib.hellocharts.view.LineChartView;
|
||||
import lecho.lib.hellocharts.view.PieChartView;
|
||||
|
||||
public class OverviewFragment extends Fragment implements FragmentUpdateListener {
|
||||
private View overviewView;
|
||||
public class OverviewFragment extends Fragment implements FragmentUpdateListener {
|
||||
private View overviewView;
|
||||
|
||||
private TextView txtTitleUser;
|
||||
private TextView txtTitleLastMeasurement;
|
||||
@@ -75,7 +81,9 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
private TextView txtMuscleLast;
|
||||
private TextView txtFatLast;
|
||||
private TextView txtWaistLast;
|
||||
private TextView txtWHtRLast;
|
||||
private TextView txtHipLast;
|
||||
private TextView txtWHRLast;
|
||||
|
||||
private TextView txtGoalWeight;
|
||||
private TextView txtGoalDiff;
|
||||
@@ -90,7 +98,9 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
private TextView txtLabelMuscle;
|
||||
private TextView txtLabelWater;
|
||||
private TextView txtLabelWaist;
|
||||
private TextView txtLabelWHtR;
|
||||
private TextView txtLabelHip;
|
||||
private TextView txtLabelWHR;
|
||||
|
||||
private TextView txtLabelGoalWeight;
|
||||
private TextView txtLabelGoalDiff;
|
||||
@@ -99,27 +109,43 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
private TextView txtLabelAvgWeek;
|
||||
private TextView txtLabelAvgMonth;
|
||||
|
||||
private PieChartView pieChartLast;
|
||||
private PieChartView pieChartLast;
|
||||
private LineChartView lineChartLast;
|
||||
|
||||
private Spinner spinUser;
|
||||
|
||||
private enum lines {WEIGHT, FAT, WATER, MUSCLE, WAIST, HIP}
|
||||
private ArrayList<lines> activeLines;
|
||||
private LinearGaugeView linearGaugeWeight;
|
||||
private LinearGaugeView linearGaugeBMI;
|
||||
private LinearGaugeView linearGaugeFat;
|
||||
private LinearGaugeView linearGaugeMuscle;
|
||||
private LinearGaugeView linearGaugeWater;
|
||||
private LinearGaugeView linearGaugeWaist;
|
||||
private LinearGaugeView linearGaugeWHtR;
|
||||
private LinearGaugeView linearGaugeHip;
|
||||
private LinearGaugeView linearGaugeWHR;
|
||||
|
||||
private SharedPreferences prefs;
|
||||
|
||||
private ScaleData lastScaleData;
|
||||
private ScaleData userSelectedData;
|
||||
private ScaleUser currentScaleUser;
|
||||
|
||||
private List<ScaleData> scaleDataLastDays;
|
||||
|
||||
private ArrayAdapter<String> spinUserAdapter;
|
||||
|
||||
private Context context;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
overviewView = inflater.inflate(R.layout.fragment_overview, container, false);
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// retain this fragment otherwise the app crashed in landscape mode for small devices (see "Handling Runtime Changes")
|
||||
setRetainInstance(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
overviewView = inflater.inflate(R.layout.fragment_overview, container, false);
|
||||
|
||||
context = overviewView.getContext();
|
||||
|
||||
@@ -134,7 +160,9 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
txtMuscleLast = (TextView) overviewView.findViewById(R.id.txtMuscleLast);
|
||||
txtFatLast = (TextView) overviewView.findViewById(R.id.txtFatLast);
|
||||
txtWaistLast = (TextView) overviewView.findViewById(R.id.txtWaistLast);
|
||||
txtWHtRLast = (TextView) overviewView.findViewById(R.id.txtWHtRLast);
|
||||
txtHipLast = (TextView) overviewView.findViewById(R.id.txtHipLast);
|
||||
txtWHRLast = (TextView) overviewView.findViewById(R.id.txtWHRLast);
|
||||
|
||||
txtGoalWeight = (TextView) overviewView.findViewById(R.id.txtGoalWeight);
|
||||
txtGoalDiff = (TextView) overviewView.findViewById(R.id.txtGoalDiff);
|
||||
@@ -149,8 +177,9 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
txtLabelMuscle = (TextView) overviewView.findViewById(R.id.txtLabelMuscle);
|
||||
txtLabelWater = (TextView) overviewView.findViewById(R.id.txtLabelWater);
|
||||
txtLabelWaist = (TextView) overviewView.findViewById(R.id.txtLabelWaist);
|
||||
txtLabelWHtR = (TextView) overviewView.findViewById(R.id.txtLabelWHtR);
|
||||
txtLabelHip = (TextView) overviewView.findViewById(R.id.txtLabelHip);
|
||||
|
||||
txtLabelWHR = (TextView) overviewView.findViewById(R.id.txtLabelWHR);
|
||||
|
||||
txtLabelGoalWeight = (TextView) overviewView.findViewById(R.id.txtLabelGoalWeight);
|
||||
txtLabelGoalDiff = (TextView) overviewView.findViewById(R.id.txtLabelGoalDiff);
|
||||
@@ -164,58 +193,96 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
|
||||
spinUser = (Spinner) overviewView.findViewById(R.id.spinUser);
|
||||
|
||||
linearGaugeWeight = (LinearGaugeView) overviewView.findViewById(R.id.linearGaugeWeight);
|
||||
linearGaugeBMI = (LinearGaugeView) overviewView.findViewById(R.id.linearGaugeBMI);
|
||||
linearGaugeFat = (LinearGaugeView) overviewView.findViewById(R.id.linearGaugeFat);
|
||||
linearGaugeMuscle = (LinearGaugeView) overviewView.findViewById(R.id.linearGaugeMuscle);
|
||||
linearGaugeWater = (LinearGaugeView) overviewView.findViewById(R.id.linearGaugeWater);
|
||||
linearGaugeWaist = (LinearGaugeView) overviewView.findViewById(R.id.linearGaugeWaist);
|
||||
linearGaugeWHtR = (LinearGaugeView) overviewView.findViewById(R.id.linearGaugeWHtR);
|
||||
linearGaugeHip = (LinearGaugeView) overviewView.findViewById(R.id.linearGaugeHip);
|
||||
linearGaugeWHR = (LinearGaugeView) overviewView.findViewById(R.id.linearGaugeWHR);
|
||||
|
||||
lineChartLast.setOnValueTouchListener(new LineChartTouchListener());
|
||||
|
||||
pieChartLast.setOnValueTouchListener(new PieChartLastTouchListener());
|
||||
pieChartLast.setChartRotationEnabled(false);
|
||||
|
||||
overviewView.findViewById(R.id.btnInsertData).setOnClickListener(new View.OnClickListener() {
|
||||
overviewView.findViewById(R.id.btnInsertData).setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
btnOnClickInsertData();
|
||||
btnOnClickInsertData();
|
||||
}
|
||||
});
|
||||
|
||||
overviewView.findViewById(R.id.tableRowWeight).setOnClickListener(new onClickListenerEvaluation());
|
||||
overviewView.findViewById(R.id.tableRowBMI).setOnClickListener(new onClickListenerEvaluation());
|
||||
overviewView.findViewById(R.id.tableRowFat).setOnClickListener(new onClickListenerEvaluation());
|
||||
overviewView.findViewById(R.id.tableRowMuscle).setOnClickListener(new onClickListenerEvaluation());
|
||||
overviewView.findViewById(R.id.tableRowWater).setOnClickListener(new onClickListenerEvaluation());
|
||||
overviewView.findViewById(R.id.tableRowWaist).setOnClickListener(new onClickListenerEvaluation());
|
||||
overviewView.findViewById(R.id.tableRowWHtR).setOnClickListener(new onClickListenerEvaluation());
|
||||
overviewView.findViewById(R.id.tableRowHip).setOnClickListener(new onClickListenerEvaluation());
|
||||
overviewView.findViewById(R.id.tableRowWHR).setOnClickListener(new onClickListenerEvaluation());
|
||||
|
||||
userSelectedData = null;
|
||||
|
||||
spinUserAdapter = new ArrayAdapter<>(overviewView.getContext(), R.layout.support_simple_spinner_dropdown_item, new ArrayList<String>());
|
||||
spinUser.setAdapter(spinUserAdapter);
|
||||
|
||||
// Set item select listener after spinner is created because otherwise item listener fires a lot!?!?
|
||||
spinUser.post(new Runnable() {
|
||||
public void run() {
|
||||
spinUser.setOnItemSelectedListener(new spinUserSelectionListener());
|
||||
updateUserSelection();
|
||||
}
|
||||
});
|
||||
|
||||
OpenScale.getInstance(overviewView.getContext()).registerFragment(this);
|
||||
|
||||
return overviewView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOnView(ArrayList<ScaleData> scaleDataList) {
|
||||
if (scaleDataList.isEmpty()) {
|
||||
lastScaleData = new ScaleData();
|
||||
} else if (userSelectedData != null) {
|
||||
lastScaleData = userSelectedData;
|
||||
}
|
||||
else {
|
||||
lastScaleData = scaleDataList.get(0);
|
||||
}
|
||||
|
||||
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(overviewView.getContext());
|
||||
currentScaleUser = OpenScale.getInstance(overviewView.getContext()).getSelectedScaleUser();
|
||||
|
||||
updateOnView(OpenScale.getInstance(overviewView.getContext()).getScaleDataList());
|
||||
txtTitleUser.setText(getResources().getString(R.string.label_title_user).toUpperCase());
|
||||
txtTitleLastMeasurement.setText(getResources().getString(R.string.label_title_last_measurement).toUpperCase());
|
||||
txtTitleGoal.setText(getResources().getString(R.string.label_title_goal).toUpperCase());
|
||||
txtTitleStatistics.setText(getResources().getString(R.string.label_title_statistics).toUpperCase());
|
||||
|
||||
if(!prefs.getBoolean("fatEnable", true)) {
|
||||
TableRow row = (TableRow)overviewView.findViewById(R.id.tableRowFat);
|
||||
row.setVisibility(View.GONE);
|
||||
}
|
||||
updateUserSelection();
|
||||
updateVisibleRows();
|
||||
updateLastPieChart();
|
||||
updateLastLineChart(scaleDataList);
|
||||
updateLastMeasurement();
|
||||
updateGoal(scaleDataList);
|
||||
updateStatistics(scaleDataList);
|
||||
updateEvaluation();
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("muscleEnable", true)) {
|
||||
TableRow row = (TableRow)overviewView.findViewById(R.id.tableRowMuscle);
|
||||
row.setVisibility(View.GONE);
|
||||
}
|
||||
private void updateUserSelection() {
|
||||
|
||||
if(!prefs.getBoolean("waterEnable", true)) {
|
||||
TableRow row = (TableRow)overviewView.findViewById(R.id.tableRowWater);
|
||||
row.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("waistEnable", true)) {
|
||||
TableRow row = (TableRow)overviewView.findViewById(R.id.tableRowWaist);
|
||||
row.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("hipEnable", true)) {
|
||||
TableRow row = (TableRow)overviewView.findViewById(R.id.tableRowHip);
|
||||
row.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
spinUser.setOnItemSelectedListener(new spinUserSelectionListener());
|
||||
|
||||
ArrayList<String> userItems = new ArrayList<>();
|
||||
currentScaleUser = OpenScale.getInstance(overviewView.getContext()).getSelectedScaleUser();
|
||||
|
||||
spinUserAdapter.clear();
|
||||
ArrayList<ScaleUser> scaleUserList = OpenScale.getInstance(overviewView.getContext()).getScaleUserList();
|
||||
|
||||
int posUser = 0;
|
||||
int pos = 0;
|
||||
|
||||
for (ScaleUser scaleUser : scaleUserList) {
|
||||
userItems.add(scaleUser.user_name);
|
||||
for(ScaleUser scaleUser :scaleUserList) {
|
||||
spinUserAdapter.add(scaleUser.user_name);
|
||||
|
||||
if (scaleUser.id == currentScaleUser.id) {
|
||||
posUser = pos;
|
||||
@@ -224,34 +291,134 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
pos++;
|
||||
}
|
||||
|
||||
ArrayAdapter<String> spinAdapter = new ArrayAdapter<>(overviewView.getContext(), R.layout.support_simple_spinner_dropdown_item, userItems);
|
||||
spinUser.setSelection(posUser, true);
|
||||
}
|
||||
|
||||
spinUser.setAdapter(spinAdapter);
|
||||
spinUser.setSelection(posUser);
|
||||
|
||||
return overviewView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOnView(ArrayList<ScaleData> scaleDataList)
|
||||
{
|
||||
if (scaleDataList.isEmpty()) {
|
||||
lastScaleData = null;
|
||||
return;
|
||||
private void updateVisibleRows() {
|
||||
if(!prefs.getBoolean("fatEnable", true)) {
|
||||
TableRow row = (TableRow)overviewView.findViewById(R.id.tableRowFat);
|
||||
row.setVisibility(View.GONE);
|
||||
} else {
|
||||
TableRow row = (TableRow)overviewView.findViewById(R.id.tableRowFat);
|
||||
row.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
lastScaleData = scaleDataList.get(0);
|
||||
if(!prefs.getBoolean("muscleEnable", true)) {
|
||||
TableRow row = (TableRow)overviewView.findViewById(R.id.tableRowMuscle);
|
||||
row.setVisibility(View.GONE);
|
||||
} else {
|
||||
TableRow row = (TableRow)overviewView.findViewById(R.id.tableRowMuscle);
|
||||
row.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
txtTitleUser.setText(getResources().getString(R.string.label_title_user).toUpperCase());
|
||||
txtTitleLastMeasurement.setText(getResources().getString(R.string.label_title_last_measurement).toUpperCase());
|
||||
txtTitleGoal.setText(getResources().getString(R.string.label_title_goal).toUpperCase());
|
||||
txtTitleStatistics.setText(getResources().getString(R.string.label_title_statistics).toUpperCase());
|
||||
if(!prefs.getBoolean("waterEnable", true)) {
|
||||
TableRow row = (TableRow)overviewView.findViewById(R.id.tableRowWater);
|
||||
row.setVisibility(View.GONE);
|
||||
} else {
|
||||
TableRow row = (TableRow)overviewView.findViewById(R.id.tableRowWater);
|
||||
row.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
updateLastPieChart();
|
||||
updateLastLineChart(scaleDataList);
|
||||
updateLastMeasurement();
|
||||
updateGoal(scaleDataList);
|
||||
updateStatistics(scaleDataList);
|
||||
if(!prefs.getBoolean("waistEnable", true)) {
|
||||
TableRow row = (TableRow)overviewView.findViewById(R.id.tableRowWaist);
|
||||
row.setVisibility(View.GONE);
|
||||
|
||||
row = (TableRow)overviewView.findViewById(R.id.tableRowWHtR);
|
||||
row.setVisibility(View.GONE);
|
||||
} else {
|
||||
TableRow row = (TableRow)overviewView.findViewById(R.id.tableRowWaist);
|
||||
row.setVisibility(View.VISIBLE);
|
||||
|
||||
row = (TableRow)overviewView.findViewById(R.id.tableRowWHtR);
|
||||
row.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("hipEnable", true)) {
|
||||
TableRow row = (TableRow)overviewView.findViewById(R.id.tableRowHip);
|
||||
row.setVisibility(View.GONE);
|
||||
} else {
|
||||
TableRow row = (TableRow)overviewView.findViewById(R.id.tableRowHip);
|
||||
row.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("hipEnable", true) || !prefs.getBoolean("waistEnable", true)) {
|
||||
TableRow row = (TableRow)overviewView.findViewById(R.id.tableRowWHR);
|
||||
row.setVisibility(View.GONE);
|
||||
} else {
|
||||
TableRow row = (TableRow)overviewView.findViewById(R.id.tableRowWHR);
|
||||
row.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateEvaluation() {
|
||||
linearGaugeWeight.setMinMaxValue(30, 300);
|
||||
linearGaugeBMI.setMinMaxValue(10, 50);
|
||||
linearGaugeFat.setMinMaxValue(10, 40);
|
||||
linearGaugeMuscle.setMinMaxValue(10, 80);
|
||||
linearGaugeWater.setMinMaxValue(30, 80);
|
||||
linearGaugeWaist.setMinMaxValue(30, 200);
|
||||
linearGaugeWHtR.setMinMaxValue(0, 1);
|
||||
linearGaugeHip.setMinMaxValue(30, 200);
|
||||
linearGaugeWHR.setMinMaxValue(0, 1);
|
||||
|
||||
EvaluationSheet evalSheet = new EvaluationSheet(currentScaleUser);
|
||||
|
||||
EvaluationResult sheetWeight = evalSheet.evaluateWeight(lastScaleData.weight);
|
||||
EvaluationResult sheetBMI = evalSheet.evaluateBMI(currentScaleUser.getBMI(lastScaleData.weight));
|
||||
EvaluationResult sheetFat = evalSheet.evaluateBodyFat(lastScaleData.fat);
|
||||
EvaluationResult sheetMuscle = evalSheet.evaluateBodyMuscle(lastScaleData.muscle);
|
||||
EvaluationResult sheetWater = evalSheet.evaluateBodyWater(lastScaleData.water);
|
||||
EvaluationResult sheetWaist = evalSheet.evaluateWaist(lastScaleData.waist);
|
||||
EvaluationResult sheetWHtR = evalSheet.evaluateWHtR(currentScaleUser.getWHtR(lastScaleData.waist));
|
||||
EvaluationResult sheetWHR = evalSheet.evaluateWHR(currentScaleUser.getWHR(lastScaleData.waist, lastScaleData.hip));
|
||||
|
||||
updateIndicator((ImageView)overviewView.findViewById(R.id.indicatorWeight), sheetWeight.eval_state);
|
||||
updateIndicator((ImageView)overviewView.findViewById(R.id.indicatorBMI), sheetBMI.eval_state);
|
||||
updateIndicator((ImageView)overviewView.findViewById(R.id.indicatorFat), sheetFat.eval_state);
|
||||
updateIndicator((ImageView)overviewView.findViewById(R.id.indicatorMuscle), sheetMuscle.eval_state);
|
||||
updateIndicator((ImageView)overviewView.findViewById(R.id.indicatorWater), sheetWater.eval_state);
|
||||
updateIndicator((ImageView) overviewView.findViewById(R.id.indicatorWaist), sheetWaist.eval_state);
|
||||
updateIndicator((ImageView)overviewView.findViewById(R.id.indicatorWHtR), sheetWHtR.eval_state);
|
||||
updateIndicator((ImageView)overviewView.findViewById(R.id.indicatorHip), EvaluationResult.EVAL_STATE.UNDEFINED);
|
||||
updateIndicator((ImageView)overviewView.findViewById(R.id.indicatorWHR), sheetWHR.eval_state);
|
||||
|
||||
linearGaugeWeight.setLimits(sheetWeight.lowLimit, sheetWeight.highLimit);
|
||||
linearGaugeBMI.setLimits(sheetBMI.lowLimit, sheetBMI.highLimit);
|
||||
linearGaugeFat.setLimits(sheetFat.lowLimit, sheetFat.highLimit);
|
||||
linearGaugeMuscle.setLimits(sheetMuscle.lowLimit, sheetMuscle.highLimit);
|
||||
linearGaugeWater.setLimits(sheetWater.lowLimit, sheetWater.highLimit);
|
||||
linearGaugeWaist.setLimits(sheetWaist.lowLimit, sheetWaist.highLimit);
|
||||
linearGaugeWHtR.setLimits(sheetWHtR.lowLimit, sheetWHtR.highLimit);
|
||||
linearGaugeHip.setLimits(-1f, -1f);
|
||||
linearGaugeWHR.setLimits(sheetWHR.lowLimit, sheetWHR.highLimit);
|
||||
|
||||
linearGaugeWeight.setValue(lastScaleData.weight);
|
||||
linearGaugeBMI.setValue(currentScaleUser.getBMI(lastScaleData.weight));
|
||||
linearGaugeFat.setValue(lastScaleData.fat);
|
||||
linearGaugeMuscle.setValue(lastScaleData.muscle);
|
||||
linearGaugeWater.setValue(lastScaleData.water);
|
||||
linearGaugeWaist.setValue(lastScaleData.waist);
|
||||
linearGaugeWHtR.setValue(currentScaleUser.getWHtR(lastScaleData.waist));
|
||||
linearGaugeHip.setValue(lastScaleData.hip);
|
||||
linearGaugeWHR.setValue(currentScaleUser.getWHR(lastScaleData.waist, lastScaleData.hip));
|
||||
}
|
||||
|
||||
private void updateIndicator(ImageView view, EvaluationResult.EVAL_STATE state) {
|
||||
switch(state)
|
||||
{
|
||||
case LOW:
|
||||
view.setBackgroundColor(ChartUtils.COLOR_BLUE);
|
||||
break;
|
||||
case NORMAL:
|
||||
view.setBackgroundColor(ChartUtils.COLOR_GREEN);
|
||||
break;
|
||||
case HIGH:
|
||||
view.setBackgroundColor(ChartUtils.COLOR_RED);
|
||||
break;
|
||||
case UNDEFINED:
|
||||
view.setBackgroundColor(Color.GRAY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateLastMeasurement() {
|
||||
@@ -261,7 +428,9 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
txtWaterLast.setText(lastScaleData.water + " %");
|
||||
txtMuscleLast.setText(lastScaleData.muscle + " %");
|
||||
txtWaistLast.setText(lastScaleData.waist + " cm");
|
||||
txtWHtRLast.setText(String.format("%.2f", currentScaleUser.getWHtR(lastScaleData.waist)));
|
||||
txtHipLast.setText(lastScaleData.hip + " cm");
|
||||
txtWHRLast.setText(String.format("%.2f", currentScaleUser.getWHR(lastScaleData.waist, lastScaleData.hip)));
|
||||
}
|
||||
|
||||
private void updateGoal(ArrayList<ScaleData> scaleDataList) {
|
||||
@@ -281,54 +450,76 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
txtLabelGoalDiff.setText(Html.fromHtml(getResources().getString(R.string.label_weight_difference) + " <br> <font color='grey'><small>BMI " + String.format("%.1f", currentScaleUser.getBMI(lastScaleData.weight) - currentScaleUser.getBMI(currentScaleUser.goal_weight)) + " </small></font>"));
|
||||
txtLabelDayLeft.setText(Html.fromHtml(getResources().getString(R.string.label_days_left) + " <br> <font color='grey'><small>" + getResources().getString(R.string.label_goal_date_is) + " " + DateFormat.getDateInstance(DateFormat.LONG).format(currentScaleUser.goal_date) + " </small></font>")); // currentScaleUser.goal_date
|
||||
|
||||
if (scaleDataList.size() >= 2) {
|
||||
ScaleData diffScaleData = scaleDataList.get(1);
|
||||
ListIterator<ScaleData> scaleDataIterator = scaleDataList.listIterator();
|
||||
|
||||
double diffWeight = lastScaleData.weight - diffScaleData.weight;
|
||||
double diffBMI = currentScaleUser.getBMI(lastScaleData.weight) - currentScaleUser.getBMI(diffScaleData.weight);
|
||||
double diffFat = lastScaleData.fat - diffScaleData.fat;
|
||||
double diffMuscle = lastScaleData.muscle - diffScaleData.muscle;
|
||||
double diffWater = lastScaleData.water - diffScaleData.water;
|
||||
double diffWaist = lastScaleData.waist - diffScaleData.waist;
|
||||
double diffHip = lastScaleData.hip - diffScaleData.hip;
|
||||
while(scaleDataIterator.hasNext()) {
|
||||
ScaleData scaleData = scaleDataIterator.next();
|
||||
|
||||
if (scaleData.id == lastScaleData.id) {
|
||||
if (scaleDataIterator.hasNext()) {
|
||||
ScaleData diffScaleData = scaleDataIterator.next();
|
||||
|
||||
double diffWeight = lastScaleData.weight - diffScaleData.weight;
|
||||
double diffBMI = currentScaleUser.getBMI(lastScaleData.weight) - currentScaleUser.getBMI(diffScaleData.weight);
|
||||
double diffFat = lastScaleData.fat - diffScaleData.fat;
|
||||
double diffMuscle = lastScaleData.muscle - diffScaleData.muscle;
|
||||
double diffWater = lastScaleData.water - diffScaleData.water;
|
||||
double diffWaist = lastScaleData.waist - diffScaleData.waist;
|
||||
double diffWHtR = currentScaleUser.getWHtR(lastScaleData.waist) - currentScaleUser.getWHtR(diffScaleData.waist);
|
||||
double diffHip = lastScaleData.hip - diffScaleData.hip;
|
||||
double diffWHR = currentScaleUser.getWHR(lastScaleData.waist, lastScaleData.hip) - currentScaleUser.getWHR(diffScaleData.waist, diffScaleData.hip);
|
||||
|
||||
|
||||
if (diffWeight > 0.0)
|
||||
txtLabelWeight.setText(Html.fromHtml(getResources().getString(R.string.label_weight) + " <br> <font color='grey'>↗<small> " + String.format("%.1f ", diffWeight) + ScaleUser.UNIT_STRING[currentScaleUser.scale_unit] + "</small></font>"));
|
||||
else
|
||||
txtLabelWeight.setText(Html.fromHtml(getResources().getString(R.string.label_weight) + " <br> <font color='grey'>↘<small> " + String.format("%.1f ", diffWeight) + ScaleUser.UNIT_STRING[currentScaleUser.scale_unit] + "</small></font>"));
|
||||
if (diffWeight > 0.0)
|
||||
txtLabelWeight.setText(Html.fromHtml(getResources().getString(R.string.label_weight) + " <br> <font color='grey'>↗<small> " + String.format("%.1f ", diffWeight) + ScaleUser.UNIT_STRING[currentScaleUser.scale_unit] + "</small></font>"));
|
||||
else
|
||||
txtLabelWeight.setText(Html.fromHtml(getResources().getString(R.string.label_weight) + " <br> <font color='grey'>↘<small> " + String.format("%.1f ", diffWeight) + ScaleUser.UNIT_STRING[currentScaleUser.scale_unit] + "</small></font>"));
|
||||
|
||||
|
||||
if (diffBMI > 0.0)
|
||||
txtLabelBMI.setText(Html.fromHtml(getResources().getString(R.string.label_bmi) + " <br> <font color='grey'>↗<small> " + String.format("%.1f", diffBMI) + "</small></font>"));
|
||||
else
|
||||
txtLabelBMI.setText(Html.fromHtml(getResources().getString(R.string.label_bmi) + " <br> <font color='grey'>↘<small> " + String.format("%.1f", diffBMI) + "</small></font>"));
|
||||
if (diffBMI > 0.0)
|
||||
txtLabelBMI.setText(Html.fromHtml(getResources().getString(R.string.label_bmi) + " <br> <font color='grey'>↗<small> " + String.format("%.1f", diffBMI) + "</small></font>"));
|
||||
else
|
||||
txtLabelBMI.setText(Html.fromHtml(getResources().getString(R.string.label_bmi) + " <br> <font color='grey'>↘<small> " + String.format("%.1f", diffBMI) + "</small></font>"));
|
||||
|
||||
if (diffFat > 0.0)
|
||||
txtLabelFat.setText(Html.fromHtml(getResources().getString(R.string.label_fat) + " <br> <font color='grey'>↗<small> " + String.format("%.1f", diffFat) + "%</small></font>"));
|
||||
else
|
||||
txtLabelFat.setText(Html.fromHtml(getResources().getString(R.string.label_fat) + " <br> <font color='grey'>↘<small> " + String.format("%.1f", diffFat) + "%</small></font>"));
|
||||
if (diffFat > 0.0)
|
||||
txtLabelFat.setText(Html.fromHtml(getResources().getString(R.string.label_fat) + " <br> <font color='grey'>↗<small> " + String.format("%.1f", diffFat) + "%</small></font>"));
|
||||
else
|
||||
txtLabelFat.setText(Html.fromHtml(getResources().getString(R.string.label_fat) + " <br> <font color='grey'>↘<small> " + String.format("%.1f", diffFat) + "%</small></font>"));
|
||||
|
||||
if (diffMuscle > 0.0)
|
||||
txtLabelMuscle.setText(Html.fromHtml(getResources().getString(R.string.label_muscle) + " <br> <font color='grey'>↗<small> " + String.format("%.1f", diffMuscle) + "%</small></font>"));
|
||||
else
|
||||
txtLabelMuscle.setText(Html.fromHtml(getResources().getString(R.string.label_muscle) + " <br> <font color='grey'>↘<small> " + String.format("%.1f", diffMuscle) + "%</small></font>"));
|
||||
if (diffMuscle > 0.0)
|
||||
txtLabelMuscle.setText(Html.fromHtml(getResources().getString(R.string.label_muscle) + " <br> <font color='grey'>↗<small> " + String.format("%.1f", diffMuscle) + "%</small></font>"));
|
||||
else
|
||||
txtLabelMuscle.setText(Html.fromHtml(getResources().getString(R.string.label_muscle) + " <br> <font color='grey'>↘<small> " + String.format("%.1f", diffMuscle) + "%</small></font>"));
|
||||
|
||||
if (diffWater > 0.0)
|
||||
txtLabelWater.setText(Html.fromHtml(getResources().getString(R.string.label_water) + " <br> <font color='grey'>↗<small> " + String.format("%.1f", diffWater) + "%</small></font>"));
|
||||
else
|
||||
txtLabelWater.setText(Html.fromHtml(getResources().getString(R.string.label_water) + " <br> <font color='grey'>↘<small> " + String.format("%.1f", diffWater) + "%</small></font>"));
|
||||
if (diffWater > 0.0)
|
||||
txtLabelWater.setText(Html.fromHtml(getResources().getString(R.string.label_water) + " <br> <font color='grey'>↗<small> " + String.format("%.1f", diffWater) + "%</small></font>"));
|
||||
else
|
||||
txtLabelWater.setText(Html.fromHtml(getResources().getString(R.string.label_water) + " <br> <font color='grey'>↘<small> " + String.format("%.1f", diffWater) + "%</small></font>"));
|
||||
|
||||
if (diffWaist > 0.0)
|
||||
txtLabelWaist.setText(Html.fromHtml(getResources().getString(R.string.label_waist) + " <br> <font color='grey'>↗<small> " + String.format("%.1f", diffWaist) + "cm</small></font>"));
|
||||
else
|
||||
txtLabelWaist.setText(Html.fromHtml(getResources().getString(R.string.label_waist) + " <br> <font color='grey'>↘<small> " + String.format("%.1f", diffWaist) + "cm</small></font>"));
|
||||
if (diffWaist > 0.0)
|
||||
txtLabelWaist.setText(Html.fromHtml(getResources().getString(R.string.label_waist) + " <br> <font color='grey'>↗<small> " + String.format("%.1f", diffWaist) + "cm</small></font>"));
|
||||
else
|
||||
txtLabelWaist.setText(Html.fromHtml(getResources().getString(R.string.label_waist) + " <br> <font color='grey'>↘<small> " + String.format("%.1f", diffWaist) + "cm</small></font>"));
|
||||
|
||||
if (diffHip > 0.0)
|
||||
txtLabelHip.setText(Html.fromHtml(getResources().getString(R.string.label_hip) + " <br> <font color='grey'>↗<small> " + String.format("%.1f", diffHip) + "cm</small></font>"));
|
||||
else
|
||||
txtLabelHip.setText(Html.fromHtml(getResources().getString(R.string.label_hip) + " <br> <font color='grey'>↘<small> " + String.format("%.1f", diffHip) + "cm</small></font>"));
|
||||
if (diffWHtR > 0.0)
|
||||
txtLabelWHtR.setText(Html.fromHtml(getResources().getString(R.string.label_whtr) + " <br> <font color='grey'>↗<small> " + String.format("%.2f", diffWHtR) + "</small></font>"));
|
||||
else
|
||||
txtLabelWHtR.setText(Html.fromHtml(getResources().getString(R.string.label_whtr) + " <br> <font color='grey'>↘<small> " + String.format("%.2f", diffWHtR) + "</small></font>"));
|
||||
|
||||
if (diffHip > 0.0)
|
||||
txtLabelHip.setText(Html.fromHtml(getResources().getString(R.string.label_hip) + " <br> <font color='grey'>↗<small> " + String.format("%.1f", diffHip) + "cm</small></font>"));
|
||||
else
|
||||
txtLabelHip.setText(Html.fromHtml(getResources().getString(R.string.label_hip) + " <br> <font color='grey'>↘<small> " + String.format("%.1f", diffHip) + "cm</small></font>"));
|
||||
|
||||
if (diffWHR > 0.0)
|
||||
txtLabelWHR.setText(Html.fromHtml(getResources().getString(R.string.label_whr) + " <br> <font color='grey'>↗<small> " + String.format("%.2f", diffWHR) + "</small></font>"));
|
||||
else
|
||||
txtLabelWHR.setText(Html.fromHtml(getResources().getString(R.string.label_whr) + " <br> <font color='grey'>↘<small> " + String.format("%.2f", diffWHR) + "</small></font>"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void updateStatistics(ArrayList<ScaleData> scaleDataList) {
|
||||
@@ -349,7 +540,9 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
float weekAvgWater = 0;
|
||||
float weekAvgMuscle = 0;
|
||||
float weekAvgWaist = 0;
|
||||
float weekAvgWHtR = 0;
|
||||
float weekAvgHip = 0;
|
||||
float weekAvgWHR = 0;
|
||||
|
||||
int monthSize = 0;
|
||||
float monthAvgWeight = 0;
|
||||
@@ -358,8 +551,9 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
float monthAvgWater = 0;
|
||||
float monthAvgMuscle = 0;
|
||||
float monthAvgWaist = 0;
|
||||
float monthAvgWHtR = 0;
|
||||
float monthAvgHip = 0;
|
||||
|
||||
float monthAvgWHR = 0;
|
||||
|
||||
for (ScaleData scaleData : scaleDataList)
|
||||
{
|
||||
@@ -375,6 +569,8 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
weekAvgMuscle += scaleData.muscle;
|
||||
weekAvgWaist += scaleData.waist;
|
||||
weekAvgHip += scaleData.hip;
|
||||
weekAvgWHtR += currentScaleUser.getWHtR(scaleData.waist);
|
||||
weekAvgWHR += currentScaleUser.getWHR(scaleData.waist, scaleData.hip);
|
||||
}
|
||||
|
||||
if (monthPastDate.before(histDate)) {
|
||||
@@ -387,6 +583,8 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
monthAvgMuscle += scaleData.muscle;
|
||||
monthAvgWaist += scaleData.waist;
|
||||
monthAvgHip += scaleData.hip;
|
||||
monthAvgWHtR += currentScaleUser.getWHtR(scaleData.waist);
|
||||
monthAvgWHR += currentScaleUser.getWHR(scaleData.waist, scaleData.hip);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@@ -398,7 +596,9 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
weekAvgWater /= weekSize;
|
||||
weekAvgMuscle /= weekSize;
|
||||
weekAvgWaist /= weekSize;
|
||||
weekAvgWHtR /= weekSize;
|
||||
weekAvgHip /= weekSize;
|
||||
weekAvgWHR /= weekSize;
|
||||
|
||||
monthAvgWeight /= monthSize;
|
||||
monthAvgBMI /= monthSize;
|
||||
@@ -406,7 +606,9 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
monthAvgWater /= monthSize;
|
||||
monthAvgMuscle /= monthSize;
|
||||
monthAvgWaist /= monthSize;
|
||||
monthAvgWHtR /= monthSize;
|
||||
monthAvgHip /= monthSize;
|
||||
monthAvgWHR /= monthSize;
|
||||
|
||||
String info_week = new String();
|
||||
String info_month = new String();
|
||||
@@ -443,6 +645,10 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
info_week += String.format("Ø-"+getResources().getString(R.string.label_waist)+": %.1fcm <br>", weekAvgWaist);
|
||||
info_month += String.format("Ø-"+getResources().getString(R.string.label_waist)+": %.1fcm <br>", monthAvgWaist);
|
||||
lines++;
|
||||
|
||||
info_week += String.format("Ø-"+getResources().getString(R.string.label_whtr)+": %.2f <br>", weekAvgWHtR);
|
||||
info_month += String.format("Ø-"+getResources().getString(R.string.label_whtr)+": %.2f <br>", monthAvgWHtR);
|
||||
lines++;
|
||||
}
|
||||
|
||||
if(prefs.getBoolean("hipEnable", true)) {
|
||||
@@ -451,6 +657,12 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
lines++;
|
||||
}
|
||||
|
||||
if(prefs.getBoolean("hipEnable", true) && prefs.getBoolean("waistEnable", true)) {
|
||||
info_week += String.format("Ø-"+getResources().getString(R.string.label_whr)+": %.2f <br>", weekAvgWHR);
|
||||
info_month += String.format("Ø-"+getResources().getString(R.string.label_whr)+": %.2f <br>", monthAvgWHR);
|
||||
lines++;
|
||||
}
|
||||
|
||||
txtLabelAvgWeek.setLines(lines);
|
||||
txtLabelAvgMonth.setLines(lines);
|
||||
|
||||
@@ -481,7 +693,7 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
Calendar histDate = Calendar.getInstance();
|
||||
Calendar lastDate = Calendar.getInstance();
|
||||
|
||||
lastDate.setTime(scaleDataList.get(0).date_time);
|
||||
lastDate.setTime(lastScaleData.date_time);
|
||||
|
||||
scaleDataLastDays = new ArrayList<ScaleData>();
|
||||
|
||||
@@ -533,37 +745,28 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
||||
setFormatter(new SimpleLineChartValueFormatter(1));
|
||||
|
||||
activeLines = new ArrayList<lines>();
|
||||
|
||||
if(prefs.getBoolean("weightEnable", true)) {
|
||||
lines.add(lineWeight);
|
||||
activeLines.add(OverviewFragment.lines.WEIGHT);
|
||||
}
|
||||
|
||||
if(prefs.getBoolean("fatEnable", true)) {
|
||||
lines.add(lineFat);
|
||||
activeLines.add(OverviewFragment.lines.FAT);
|
||||
}
|
||||
|
||||
if(prefs.getBoolean("waterEnable", true)) {
|
||||
lines.add(lineWater);
|
||||
activeLines.add(OverviewFragment.lines.WATER);
|
||||
}
|
||||
|
||||
if(prefs.getBoolean("muscleEnable", true)) {
|
||||
lines.add(lineMuscle);
|
||||
activeLines.add(OverviewFragment.lines.MUSCLE);
|
||||
}
|
||||
|
||||
if(prefs.getBoolean("waistEnable", true)) {
|
||||
lines.add(lineWaist);
|
||||
activeLines.add(OverviewFragment.lines.WAIST);
|
||||
|
||||
}
|
||||
|
||||
if(prefs.getBoolean("hipEnable", true)) {
|
||||
lines.add(lineHip);
|
||||
activeLines.add(OverviewFragment.lines.HIP);
|
||||
}
|
||||
|
||||
LineChartData lineData = new LineChartData(lines);
|
||||
@@ -672,12 +875,6 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data)
|
||||
{
|
||||
updateOnView(OpenScale.getInstance(overviewView.getContext()).getScaleDataList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUserVisibleHint(boolean isVisibleToUser) {
|
||||
super.setUserVisibleHint(isVisibleToUser);
|
||||
@@ -694,33 +891,9 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
private class LineChartTouchListener implements LineChartOnValueSelectListener {
|
||||
@Override
|
||||
public void onValueSelected(int lineIndex, int pointIndex, PointValue pointValue) {
|
||||
ScaleData scaleData = scaleDataLastDays.get(pointIndex);
|
||||
lines selectedLine = activeLines.get(lineIndex);
|
||||
userSelectedData = scaleDataLastDays.get(pointIndex);
|
||||
|
||||
String date_time = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.SHORT).format(scaleData.date_time);
|
||||
|
||||
switch (selectedLine) {
|
||||
case WEIGHT:
|
||||
Toast.makeText(getActivity(), getResources().getString(R.string.info_your_weight) + " " + scaleData.weight + ScaleUser.UNIT_STRING[OpenScale.getInstance(overviewView.getContext()).getSelectedScaleUser().scale_unit] + " " + getResources().getString(R.string.info_on_date) + " " + date_time, Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case FAT:
|
||||
Toast.makeText(getActivity(), getResources().getString(R.string.info_your_fat) + " " + scaleData.fat + "% " + getResources().getString(R.string.info_on_date) + " " + date_time, Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case WATER:
|
||||
Toast.makeText(getActivity(), getResources().getString(R.string.info_your_water) + " " + scaleData.water + "% " + getResources().getString(R.string.info_on_date) + " " + date_time, Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case MUSCLE:
|
||||
Toast.makeText(getActivity(), getResources().getString(R.string.info_your_muscle) + " " + scaleData.muscle + "% " + getResources().getString(R.string.info_on_date) + " " + date_time, Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case WAIST:
|
||||
Toast.makeText(getActivity(), getResources().getString(R.string.info_your_waist) + " " + scaleData.waist + "cm " + getResources().getString(R.string.info_on_date) + " " + date_time, Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case HIP:
|
||||
Toast.makeText(getActivity(), getResources().getString(R.string.info_your_hip) + " " + scaleData.hip + "cm " + getResources().getString(R.string.info_on_date) + " " + date_time, Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
updateOnView( OpenScale.getInstance(overviewView.getContext()).getScaleDataList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -742,6 +915,7 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
prefs.edit().putInt("selectedUserId", scaleUser.id).commit();
|
||||
OpenScale.getInstance(overviewView.getContext()).updateScaleData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -750,4 +924,22 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -119,6 +119,8 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, Strin
|
||||
} else {
|
||||
OpenScale.getInstance(getApplicationContext()).stopBluetoothServer();
|
||||
}
|
||||
|
||||
OpenScale.getInstance(getApplicationContext()).updateScaleData();
|
||||
}
|
||||
|
||||
private void initSummary(Preference p) {
|
||||
|
@@ -96,32 +96,7 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
||||
btnDeleteAll.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
|
||||
}
|
||||
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(tableView.getContext());
|
||||
|
||||
if(!prefs.getBoolean("fatEnable", true)) {
|
||||
TextView txtFatTableHeader = (TextView)tableView.findViewById(R.id.txtFatTableHeader);
|
||||
txtFatTableHeader.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("muscleEnable", true)) {
|
||||
TextView txtMuscleTableHeader = (TextView)tableView.findViewById(R.id.txtMuscleTableHeader);
|
||||
txtMuscleTableHeader.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("waterEnable", true)) {
|
||||
TextView txtWaterTableHeader = (TextView)tableView.findViewById(R.id.txtWaterTableHeader);
|
||||
txtWaterTableHeader.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("waistEnable", true)) {
|
||||
TextView txtWaistTableHeader = (TextView)tableView.findViewById(R.id.txtWaistTableHeader);
|
||||
txtWaistTableHeader.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("hipEnable", true)) {
|
||||
TextView txtHipTableHeader = (TextView)tableView.findViewById(R.id.txtHipTableHeader);
|
||||
txtHipTableHeader.setVisibility(View.GONE);
|
||||
}
|
||||
OpenScale.getInstance(tableView.getContext()).registerFragment(this);
|
||||
|
||||
return tableView;
|
||||
}
|
||||
@@ -129,9 +104,52 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
||||
@Override
|
||||
public void updateOnView(ArrayList<ScaleData> scaleDataList)
|
||||
{
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(tableView.getContext());
|
||||
|
||||
if(!prefs.getBoolean("fatEnable", true)) {
|
||||
TextView txtFatTableHeader = (TextView)tableView.findViewById(R.id.txtFatTableHeader);
|
||||
txtFatTableHeader.setVisibility(View.GONE);
|
||||
} else {
|
||||
TextView txtFatTableHeader = (TextView)tableView.findViewById(R.id.txtFatTableHeader);
|
||||
txtFatTableHeader.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("muscleEnable", true)) {
|
||||
TextView txtMuscleTableHeader = (TextView)tableView.findViewById(R.id.txtMuscleTableHeader);
|
||||
txtMuscleTableHeader.setVisibility(View.GONE);
|
||||
} else {
|
||||
TextView txtMuscleTableHeader = (TextView)tableView.findViewById(R.id.txtMuscleTableHeader);
|
||||
txtMuscleTableHeader.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("waterEnable", true)) {
|
||||
TextView txtWaterTableHeader = (TextView)tableView.findViewById(R.id.txtWaterTableHeader);
|
||||
txtWaterTableHeader.setVisibility(View.GONE);
|
||||
} else {
|
||||
TextView txtWaterTableHeader = (TextView)tableView.findViewById(R.id.txtWaterTableHeader);
|
||||
txtWaterTableHeader.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("waistEnable", true)) {
|
||||
TextView txtWaistTableHeader = (TextView)tableView.findViewById(R.id.txtWaistTableHeader);
|
||||
txtWaistTableHeader.setVisibility(View.GONE);
|
||||
} else {
|
||||
TextView txtWaistTableHeader = (TextView)tableView.findViewById(R.id.txtWaistTableHeader);
|
||||
txtWaistTableHeader.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("hipEnable", true)) {
|
||||
TextView txtHipTableHeader = (TextView)tableView.findViewById(R.id.txtHipTableHeader);
|
||||
txtHipTableHeader.setVisibility(View.GONE);
|
||||
} else {
|
||||
TextView txtHipTableHeader = (TextView)tableView.findViewById(R.id.txtHipTableHeader);
|
||||
txtHipTableHeader.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
tableDataView.setColumnStretchable(1, true);
|
||||
tableDataView.setColumnStretchable(2, true);
|
||||
tableDataView.setColumnStretchable(3, true);
|
||||
|
||||
if(prefs.getBoolean("fatEnable", true)) {
|
||||
tableDataView.setColumnStretchable(4, true);
|
||||
}
|
||||
@@ -149,9 +167,9 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
||||
}
|
||||
tableDataView.setColumnStretchable(9, true);
|
||||
|
||||
TableRow headerRow = (TableRow) tableView.findViewById(R.id.tableHeader);
|
||||
tableDataView.removeAllViews();
|
||||
tableDataView.addView(headerRow);
|
||||
TableRow headerRow = (TableRow) tableView.findViewById(R.id.tableHeader);
|
||||
tableDataView.removeAllViews();
|
||||
tableDataView.addView(headerRow);
|
||||
|
||||
for(ScaleData scaleData: scaleDataList)
|
||||
{
|
||||
|
@@ -52,8 +52,6 @@ public class UserSettingsActivity extends Activity {
|
||||
private RadioGroup radioScaleUnit;
|
||||
private RadioGroup radioGender;
|
||||
|
||||
private Button btnBirthdaySet;
|
||||
private Button btnGoalDateSet;
|
||||
private Button btnOk;
|
||||
private Button btnCancel;
|
||||
private Button btnDelete;
|
||||
@@ -85,7 +83,6 @@ public class UserSettingsActivity extends Activity {
|
||||
btnCancel.setOnClickListener(new onClickListenerCancel());
|
||||
btnDelete.setOnClickListener(new onClickListenerDelete());
|
||||
|
||||
|
||||
txtBirthday.setText(dateFormat.format(new Date()));
|
||||
txtGoalDate.setText(dateFormat.format(new Date()));
|
||||
|
||||
@@ -94,7 +91,7 @@ public class UserSettingsActivity extends Activity {
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (hasFocus) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
DatePickerDialog datePicker = new DatePickerDialog(context, goalDatePickerListener, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
|
||||
DatePickerDialog datePicker = new DatePickerDialog(context, datePickerListener, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
|
||||
datePicker.show();
|
||||
}
|
||||
}
|
||||
@@ -211,8 +208,8 @@ public class UserSettingsActivity extends Activity {
|
||||
int userId = getIntent().getExtras().getInt("id");
|
||||
|
||||
OpenScale openScale = OpenScale.getInstance(context);
|
||||
openScale.deleteScaleUser(userId);
|
||||
openScale.clearScaleData(userId);
|
||||
openScale.deleteScaleUser(userId);
|
||||
|
||||
ArrayList<ScaleUser> scaleUser = openScale.getScaleUserList();
|
||||
|
||||
@@ -225,6 +222,8 @@ public class UserSettingsActivity extends Activity {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
prefs.edit().putInt("selectedUserId", lastUserId).commit();
|
||||
|
||||
openScale.updateScaleData();
|
||||
|
||||
Intent returnIntent = new Intent();
|
||||
setResult(RESULT_OK, returnIntent);
|
||||
|
||||
@@ -253,7 +252,7 @@ public class UserSettingsActivity extends Activity {
|
||||
int body_height = Integer.valueOf(txtBodyHeight.getText().toString());
|
||||
int checkedRadioButtonId = radioScaleUnit.getCheckedRadioButtonId();
|
||||
int checkedGenderId = radioGender.getCheckedRadioButtonId();
|
||||
double goal_weight = Double.valueOf(txtGoalWeight.getText().toString());
|
||||
float goal_weight = Float.valueOf(txtGoalWeight.getText().toString());
|
||||
|
||||
int scale_unit = -1;
|
||||
|
||||
@@ -299,6 +298,8 @@ public class UserSettingsActivity extends Activity {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
prefs.edit().putInt("selectedUserId", id).commit();
|
||||
|
||||
openScale.updateScaleData();
|
||||
|
||||
Intent returnIntent = new Intent();
|
||||
setResult(RESULT_OK, returnIntent);
|
||||
|
||||
|
BIN
android_app/app/src/main/res/drawable/whr.png
Normal file
BIN
android_app/app/src/main/res/drawable/whr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 684 B |
BIN
android_app/app/src/main/res/drawable/whtr.png
Normal file
BIN
android_app/app/src/main/res/drawable/whtr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
@@ -30,7 +30,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="USER"
|
||||
android:text="@string/label_title_user"
|
||||
android:id="@+id/txtTitleUser"
|
||||
android:layout_weight="0"
|
||||
android:textSize="20dp"/>
|
||||
@@ -74,7 +74,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="LAST MEASUREMENT"
|
||||
android:text="@string/label_title_last_measurement"
|
||||
android:id="@+id/txtTitleLastMeasurment"
|
||||
android:autoText="false"
|
||||
android:textSize="20dp"
|
||||
@@ -109,7 +109,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="Weight"
|
||||
android:text="@string/label_weight"
|
||||
android:id="@+id/txtLabelWeight"
|
||||
android:layout_column="1"
|
||||
android:textAlignment="center"
|
||||
@@ -129,6 +129,36 @@
|
||||
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.core.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
|
||||
@@ -149,7 +179,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="BMI"
|
||||
android:text="@string/label_bmi"
|
||||
android:id="@+id/txtLabelBMI"
|
||||
android:layout_column="1"
|
||||
android:textAlignment="center"
|
||||
@@ -169,8 +199,39 @@
|
||||
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.core.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"
|
||||
@@ -189,7 +250,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="Fat"
|
||||
android:text="@string/label_fat"
|
||||
android:id="@+id/txtLabelFat"
|
||||
android:layout_column="1"
|
||||
android:textAlignment="center"
|
||||
@@ -208,8 +269,39 @@
|
||||
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.core.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"
|
||||
@@ -228,7 +320,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="Muscle"
|
||||
android:text="@string/label_muscle"
|
||||
android:id="@+id/txtLabelMuscle"
|
||||
android:layout_column="1"
|
||||
android:textAlignment="center"
|
||||
@@ -248,8 +340,39 @@
|
||||
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.core.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"
|
||||
@@ -268,7 +391,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="Water"
|
||||
android:text="@string/label_water"
|
||||
android:id="@+id/txtLabelWater"
|
||||
android:layout_column="1"
|
||||
android:textAlignment="center"
|
||||
@@ -288,8 +411,39 @@
|
||||
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.core.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"
|
||||
@@ -308,7 +462,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="Waist"
|
||||
android:text="@string/label_waist"
|
||||
android:id="@+id/txtLabelWaist"
|
||||
android:layout_column="1"
|
||||
android:textAlignment="center"
|
||||
@@ -328,6 +482,106 @@
|
||||
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.core.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.core.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
|
||||
@@ -348,7 +602,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:text="Hip"
|
||||
android:text="@string/label_hip"
|
||||
android:id="@+id/txtLabelHip"
|
||||
android:layout_column="1"
|
||||
android:textAlignment="center"
|
||||
@@ -368,6 +622,108 @@
|
||||
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.core.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.core.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>
|
||||
@@ -375,7 +731,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="GOAL"
|
||||
android:text="@string/label_title_goal"
|
||||
android:id="@+id/txtTitleGoal"
|
||||
android:autoText="false"
|
||||
android:textSize="20dp"
|
||||
@@ -517,7 +873,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="STATISTICS"
|
||||
android:text="@string/label_title_statistics"
|
||||
android:id="@+id/txtTitleStatistics"
|
||||
android:autoText="false"
|
||||
android:textSize="20dp"
|
||||
|
@@ -89,8 +89,11 @@
|
||||
<string name="title_data">Daten</string>
|
||||
<string name="info_is_not_enable">ist ausgeschaltet</string>
|
||||
<string name="info_is_enable">ist eingeschaltet</string>
|
||||
<string name="label_waist">Bauchumfang</string>
|
||||
<string name="label_waist">Taillenumfang</string>
|
||||
<string name="label_hip">Hüftumfang</string>
|
||||
<string name="info_your_hip">Dein Hüftumfang war</string>
|
||||
<string name="info_your_waist">Dein Bauchumfang war</string>
|
||||
<string name="info_no_evaluation_available">Kann den Wert nicht evaluieren</string>
|
||||
<string name="label_whtr">Taille-zu-Größe Verhältnis</string>
|
||||
<string name="label_whr">Taille-Hüft Verhältnis</string>
|
||||
</resources>
|
@@ -93,4 +93,7 @@
|
||||
<string name="label_hip">腰囲</string>
|
||||
<string name="info_your_waist">あなたは胴囲が</string>
|
||||
<string name="info_your_hip">あなたは腰囲が</string>
|
||||
<string name="info_no_evaluation_available">値を評価することはできません</string>
|
||||
<string name="label_whtr">腰と高さの比</string>
|
||||
<string name="label_whr">ウエストヒップ比</string>
|
||||
</resources>
|
@@ -0,0 +1,4 @@
|
||||
<resources>
|
||||
<declare-styleable name="LinearGaugeView">
|
||||
</declare-styleable>
|
||||
</resources>
|
@@ -27,6 +27,8 @@
|
||||
<string name="label_waist">Waist circumference</string>
|
||||
<string name="label_hip">Hip circumference</string>
|
||||
<string name="label_comment">Comment</string>
|
||||
<string name="label_whtr">Waist-to-height ratio</string>
|
||||
<string name="label_whr">Waist-hip ratio</string>
|
||||
|
||||
<string name="label_days">days</string>
|
||||
<string name="label_measures">measures</string>
|
||||
@@ -91,6 +93,7 @@
|
||||
<string name="info_bluetooth_not_established">Bluetooth connection not established</string>
|
||||
<string name="info_enter_user_name">Enter your name</string>
|
||||
<string name="info_no_selected_user">No user exist! Please create a new user in the settings</string>
|
||||
<string name="info_no_evaluation_available">Can\'t evaluate the value</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>
|
||||
|
Reference in New Issue
Block a user