Merge pull request #264 from oliexdev/body_measurements
Body measurements
@@ -0,0 +1,243 @@
|
||||
{
|
||||
"formatVersion": 1,
|
||||
"database": {
|
||||
"version": 3,
|
||||
"identityHash": "d64c7b69a0b7a1a0f93dd154a24b20f2",
|
||||
"entities": [
|
||||
{
|
||||
"tableName": "scaleMeasurements",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `userId` INTEGER NOT NULL, `enabled` INTEGER NOT NULL, `datetime` INTEGER, `weight` REAL NOT NULL, `fat` REAL NOT NULL, `water` REAL NOT NULL, `muscle` REAL NOT NULL, `visceralFat` REAL NOT NULL, `lbw` REAL NOT NULL, `waist` REAL NOT NULL, `hip` REAL NOT NULL, `bone` REAL NOT NULL, `chest` REAL NOT NULL, `thigh` REAL NOT NULL, `biceps` REAL NOT NULL, `neck` REAL NOT NULL, `caliper1` REAL NOT NULL, `caliper2` REAL NOT NULL, `caliper3` REAL NOT NULL, `comment` TEXT, FOREIGN KEY(`userId`) REFERENCES `scaleUsers`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "id",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "userId",
|
||||
"columnName": "userId",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "enabled",
|
||||
"columnName": "enabled",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "dateTime",
|
||||
"columnName": "datetime",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "weight",
|
||||
"columnName": "weight",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "fat",
|
||||
"columnName": "fat",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "water",
|
||||
"columnName": "water",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "muscle",
|
||||
"columnName": "muscle",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "visceralFat",
|
||||
"columnName": "visceralFat",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "lbm",
|
||||
"columnName": "lbw",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "waist",
|
||||
"columnName": "waist",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "hip",
|
||||
"columnName": "hip",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "bone",
|
||||
"columnName": "bone",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "chest",
|
||||
"columnName": "chest",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "thigh",
|
||||
"columnName": "thigh",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "biceps",
|
||||
"columnName": "biceps",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "neck",
|
||||
"columnName": "neck",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "caliper1",
|
||||
"columnName": "caliper1",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "caliper2",
|
||||
"columnName": "caliper2",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "caliper3",
|
||||
"columnName": "caliper3",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "comment",
|
||||
"columnName": "comment",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
"name": "index_scaleMeasurements_userId_datetime",
|
||||
"unique": true,
|
||||
"columnNames": [
|
||||
"userId",
|
||||
"datetime"
|
||||
],
|
||||
"createSql": "CREATE UNIQUE INDEX `index_scaleMeasurements_userId_datetime` ON `${TABLE_NAME}` (`userId`, `datetime`)"
|
||||
}
|
||||
],
|
||||
"foreignKeys": [
|
||||
{
|
||||
"table": "scaleUsers",
|
||||
"onDelete": "CASCADE",
|
||||
"onUpdate": "NO ACTION",
|
||||
"columns": [
|
||||
"userId"
|
||||
],
|
||||
"referencedColumns": [
|
||||
"id"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tableName": "scaleUsers",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `username` TEXT, `birthday` INTEGER, `bodyHeight` INTEGER NOT NULL, `scaleUnit` INTEGER NOT NULL, `gender` INTEGER NOT NULL, `initialWeight` REAL NOT NULL, `goalWeight` REAL NOT NULL, `goalDate` INTEGER)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "id",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "userName",
|
||||
"columnName": "username",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "birthday",
|
||||
"columnName": "birthday",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "bodyHeight",
|
||||
"columnName": "bodyHeight",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "scaleUnit",
|
||||
"columnName": "scaleUnit",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "gender",
|
||||
"columnName": "gender",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "initialWeight",
|
||||
"columnName": "initialWeight",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "goalWeight",
|
||||
"columnName": "goalWeight",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "goalDate",
|
||||
"columnName": "goalDate",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"autoGenerate": true
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
}
|
||||
],
|
||||
"setupQueries": [
|
||||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"d64c7b69a0b7a1a0f93dd154a24b20f2\")"
|
||||
]
|
||||
}
|
||||
}
|
@@ -137,7 +137,7 @@ public class OpenScale {
|
||||
db.setForeignKeyConstraintsEnabled(true);
|
||||
}
|
||||
})
|
||||
.addMigrations(AppDatabase.MIGRATION_1_2)
|
||||
.addMigrations(AppDatabase.MIGRATION_1_2, AppDatabase.MIGRATION_2_3)
|
||||
.build();
|
||||
measurementDAO = appDB.measurementDAO();
|
||||
userDAO = appDB.userDAO();
|
||||
|
@@ -86,8 +86,8 @@ public class BluetoothDigooDGSO38H extends BluetoothCommunication {
|
||||
}
|
||||
|
||||
private void parseBytes(byte[] weightBytes) {
|
||||
float weight, fat, water, muscle, boneWeight;
|
||||
//float subcutaneousFat, visceralFat, metabolicBaseRate, biologicalAge, boneWeight;
|
||||
float weight, fat, water, muscle, boneWeight, visceralFat;
|
||||
//float subcutaneousFat, metabolicBaseRate, biologicalAge, boneWeight;
|
||||
|
||||
final byte ctrlByte = weightBytes[5];
|
||||
final boolean allValues = isBitSet(ctrlByte, 1);
|
||||
@@ -125,19 +125,19 @@ public class BluetoothDigooDGSO38H extends BluetoothCommunication {
|
||||
"is done, but fat is still zero. Settling for just adding weight.");
|
||||
} else {
|
||||
//subcutaneousFat = (float) (((weightBytes[8] & 0xFF) << 8) | (weightBytes[9] & 0xFF)) / 10.0f;
|
||||
//visceralFat = (float) (weightBytes[10] & 0xFF) / 10.0f;
|
||||
visceralFat = (float) (weightBytes[10] & 0xFF) / 10.0f;
|
||||
water = (float) (((weightBytes[11] & 0xFF) << 8) | (weightBytes[12] & 0xFF)) / 10.0f;
|
||||
//metabolicBaseRate = (float) (((weightBytes[13] & 0xFF) << 8) | (weightBytes[14] & 0xFF));
|
||||
//biologicalAge = (float) (weightBytes[15] & 0xFF) + 1;
|
||||
muscle = (float) (((weightBytes[16] & 0xFF) << 8) | (weightBytes[17] & 0xFF)) / 10.0f;
|
||||
boneWeight = (float) (weightBytes[18] & 0xFF) / 10.0f;
|
||||
|
||||
//TODO: Add extra measurements?
|
||||
scaleBtData.setDateTime(new Date());
|
||||
scaleBtData.setFat(fat);
|
||||
scaleBtData.setMuscle(muscle);
|
||||
scaleBtData.setWater(water);
|
||||
scaleBtData.setBone(boneWeight);
|
||||
scaleBtData.setVisceralFat(visceralFat);
|
||||
}
|
||||
scaleBtData.setWeight(weight);
|
||||
addScaleData(scaleBtData);
|
||||
|
@@ -128,6 +128,7 @@ public class BluetoothExcelvanCF369BLE extends BluetoothCommunication {
|
||||
scaleBtData.setMuscle(muscle);
|
||||
scaleBtData.setWater(water);
|
||||
scaleBtData.setBone(bone);
|
||||
scaleBtData.setVisceralFat(visceralFat);
|
||||
|
||||
addScaleData(scaleBtData);
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.datatypes.ScaleUser;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
|
||||
@Database(entities = {ScaleMeasurement.class, ScaleUser.class}, version = 2)
|
||||
@Database(entities = {ScaleMeasurement.class, ScaleUser.class}, version = 3)
|
||||
@TypeConverters({Converters.class})
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
public abstract ScaleMeasurementDAO measurementDAO();
|
||||
@@ -75,5 +75,27 @@ public abstract class AppDatabase extends RoomDatabase {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public static final Migration MIGRATION_2_3 = new Migration(2, 3) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase database) {
|
||||
database.beginTransaction();
|
||||
try {
|
||||
database.execSQL("ALTER TABLE scaleMeasurements ADD COLUMN visceralFat REAL NOT NULL DEFAULT 0");
|
||||
database.execSQL("ALTER TABLE scaleMeasurements ADD COLUMN chest REAL NOT NULL DEFAULT 0");
|
||||
database.execSQL("ALTER TABLE scaleMeasurements ADD COLUMN thigh REAL NOT NULL DEFAULT 0");
|
||||
database.execSQL("ALTER TABLE scaleMeasurements ADD COLUMN biceps REAL NOT NULL DEFAULT 0");
|
||||
database.execSQL("ALTER TABLE scaleMeasurements ADD COLUMN neck REAL NOT NULL DEFAULT 0");
|
||||
database.execSQL("ALTER TABLE scaleMeasurements ADD COLUMN caliper1 REAL NOT NULL DEFAULT 0");
|
||||
database.execSQL("ALTER TABLE scaleMeasurements ADD COLUMN caliper2 REAL NOT NULL DEFAULT 0");
|
||||
database.execSQL("ALTER TABLE scaleMeasurements ADD COLUMN caliper3 REAL NOT NULL DEFAULT 0");
|
||||
|
||||
database.setTransactionSuccessful();
|
||||
}
|
||||
finally {
|
||||
database.endTransaction();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -62,6 +62,9 @@ public class ScaleMeasurement implements Cloneable {
|
||||
@ColumnInfo(name = "muscle")
|
||||
private float muscle;
|
||||
@CsvColumn(mustBeSupplied = false)
|
||||
@ColumnInfo(name = "visceralFat")
|
||||
private float visceralFat;
|
||||
@CsvColumn(mustBeSupplied = false)
|
||||
@ColumnInfo(name = "lbw")
|
||||
private float lbm;
|
||||
@CsvColumn(mustBeSupplied = false)
|
||||
@@ -74,6 +77,27 @@ public class ScaleMeasurement implements Cloneable {
|
||||
@ColumnInfo(name = "bone")
|
||||
private float bone;
|
||||
@CsvColumn(mustBeSupplied = false)
|
||||
@ColumnInfo(name = "chest")
|
||||
private float chest;
|
||||
@CsvColumn(mustBeSupplied = false)
|
||||
@ColumnInfo(name = "thigh")
|
||||
private float thigh;
|
||||
@CsvColumn(mustBeSupplied = false)
|
||||
@ColumnInfo(name = "biceps")
|
||||
private float biceps;
|
||||
@CsvColumn(mustBeSupplied = false)
|
||||
@ColumnInfo(name = "neck")
|
||||
private float neck;
|
||||
@CsvColumn(mustBeSupplied = false)
|
||||
@ColumnInfo(name = "caliper1")
|
||||
private float caliper1;
|
||||
@CsvColumn(mustBeSupplied = false)
|
||||
@ColumnInfo(name = "caliper2")
|
||||
private float caliper2;
|
||||
@CsvColumn(mustBeSupplied = false)
|
||||
@ColumnInfo(name = "caliper3")
|
||||
private float caliper3;
|
||||
@CsvColumn(mustBeSupplied = false)
|
||||
@ColumnInfo(name = "comment")
|
||||
private String comment;
|
||||
|
||||
@@ -90,6 +114,13 @@ public class ScaleMeasurement implements Cloneable {
|
||||
bone = 0.0f;
|
||||
waist = 0.0f;
|
||||
hip = 0.0f;
|
||||
chest = 0.0f;
|
||||
thigh = 0.0f;
|
||||
biceps = 0.0f;
|
||||
neck = 0.0f;
|
||||
caliper1 = 0.0f;
|
||||
caliper2 = 0.0f;
|
||||
caliper3 = 0.0f;
|
||||
comment = "";
|
||||
}
|
||||
|
||||
@@ -232,6 +263,14 @@ public class ScaleMeasurement implements Cloneable {
|
||||
this.muscle = muscle;
|
||||
}
|
||||
|
||||
public float getVisceralFat() {
|
||||
return visceralFat;
|
||||
}
|
||||
|
||||
public void setVisceralFat(float visceralFat) {
|
||||
this.visceralFat = visceralFat;
|
||||
}
|
||||
|
||||
public float getLbm() {
|
||||
return lbm;
|
||||
}
|
||||
@@ -260,6 +299,62 @@ public class ScaleMeasurement implements Cloneable {
|
||||
|
||||
public void setBone(float bone) {this.bone = bone; }
|
||||
|
||||
public float getChest() {
|
||||
return chest;
|
||||
}
|
||||
|
||||
public void setChest(float chest) {
|
||||
this.chest = chest;
|
||||
}
|
||||
|
||||
public float getThigh() {
|
||||
return thigh;
|
||||
}
|
||||
|
||||
public void setThigh(float thigh) {
|
||||
this.thigh = thigh;
|
||||
}
|
||||
|
||||
public float getBiceps() {
|
||||
return biceps;
|
||||
}
|
||||
|
||||
public void setBiceps(float biceps) {
|
||||
this.biceps = biceps;
|
||||
}
|
||||
|
||||
public float getNeck() {
|
||||
return neck;
|
||||
}
|
||||
|
||||
public void setNeck(float neck) {
|
||||
this.neck = neck;
|
||||
}
|
||||
|
||||
public float getCaliper1() {
|
||||
return caliper1;
|
||||
}
|
||||
|
||||
public void setCaliper1(float caliper1) {
|
||||
this.caliper1 = caliper1;
|
||||
}
|
||||
|
||||
public float getCaliper2() {
|
||||
return caliper2;
|
||||
}
|
||||
|
||||
public void setCaliper2(float caliper2) {
|
||||
this.caliper2 = caliper2;
|
||||
}
|
||||
|
||||
public float getCaliper3() {
|
||||
return caliper3;
|
||||
}
|
||||
|
||||
public void setCaliper3(float caliper3) {
|
||||
this.caliper3 = caliper3;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
@@ -297,13 +392,39 @@ public class ScaleMeasurement implements Cloneable {
|
||||
return waist / hip;
|
||||
}
|
||||
|
||||
public float getFatCaliper(ScaleUser scaleUser) {
|
||||
float fat_caliper;
|
||||
|
||||
float k0, k1, k2, ka;
|
||||
|
||||
float s = caliper1 + caliper2 + caliper3;
|
||||
|
||||
if (scaleUser.getGender().isMale()) {
|
||||
k0 = 1.10938f;
|
||||
k1 = 0.0008267f;
|
||||
k2 = 0.0000016f;
|
||||
ka = 0.0002574f;
|
||||
} else {
|
||||
k0 = 1.0994921f;
|
||||
k1 = 0.0009929f;
|
||||
k2 = 0.0000023f;
|
||||
ka = 0.0001392f;
|
||||
}
|
||||
|
||||
// calipometrie formula by Jackson, Pollock: Generalized equations for predicting body density of women. In: British Journal of Nutrition. Nr.40, Oktober 1978, S.497–504
|
||||
fat_caliper = ((4.95f / (k0 - (k1*s) + (k2 * s*s) - (ka*scaleUser.getAge()))) - 4.5f) * 100.0f;
|
||||
|
||||
return fat_caliper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format(
|
||||
"ID: %d, USER_ID: %d, DATE_TIME: %s, WEIGHT: %.2f, FAT: %.2f, WATER: %.2f, " +
|
||||
"MUSCLE: %.2f, LBM: %.2f, WAIST: %.2f, HIP: %.2f, BONE: %.2f, COMMENT: %s",
|
||||
"MUSCLE: %.2f, LBM: %.2f, WAIST: %.2f, HIP: %.2f, BONE: %.2f, CHEST: %.2f, " +
|
||||
"THIGH: %.2f, ARM: %.2f, NECK: %.2f, CALIPER1: %2.f, CALIPER2: %2.f, CALIPER3: %2.f, COMMENT: %s",
|
||||
id, userId, dateTime.toString(), weight, fat, water,
|
||||
muscle, lbm, waist, hip, bone, comment);
|
||||
muscle, lbm, waist, hip, bone, chest, thigh, biceps, neck, caliper1, caliper2, caliper3, comment);
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,68 @@
|
||||
/* Copyright (C) 2018 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.gui.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class BicepsMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "biceps";
|
||||
|
||||
public BicepsMeasurementView(Context context) {
|
||||
super(context, R.string.label_biceps, R.drawable.ic_biceps);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getBiceps();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setBiceps(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
return "cm";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMaxValue() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return Color.parseColor("#c0ca33");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
/* Copyright (C) 2018 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.gui.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class Caliper1MeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "caliper1";
|
||||
|
||||
public Caliper1MeasurementView(Context context) {
|
||||
super(context, R.string.label_caliper1_female, R.drawable.ic_caliper1);
|
||||
|
||||
if (getScaleUser().getGender().isMale()) {
|
||||
setNameView(getResources().getText(R.string.label_caliper1_male));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getCaliper1();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setCaliper1(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
return "mm";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMaxValue() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return Color.parseColor("#ba68c8");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
/* Copyright (C) 2018 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.gui.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class Caliper2MeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "caliper2";
|
||||
|
||||
public Caliper2MeasurementView(Context context) {
|
||||
super(context, R.string.label_caliper2_female, R.drawable.ic_caliper2);
|
||||
|
||||
if (getScaleUser().getGender().isMale()) {
|
||||
setNameView(getResources().getText(R.string.label_caliper2_male));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getCaliper2();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setCaliper2(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
return "mm";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMaxValue() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return Color.parseColor("#ce93d8");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
/* Copyright (C) 2018 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.gui.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class Caliper3MeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "caliper3";
|
||||
|
||||
public Caliper3MeasurementView(Context context) {
|
||||
super(context, R.string.label_caliper3_female, R.drawable.ic_caliper3);
|
||||
|
||||
if (getScaleUser().getGender().isMale()) {
|
||||
setNameView(getResources().getText(R.string.label_caliper3_male));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getCaliper3();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setCaliper3(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
return "mm";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMaxValue() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return Color.parseColor("#e1bee7");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
/* Copyright (C) 2018 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.gui.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class ChestMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "chest";
|
||||
|
||||
public ChestMeasurementView(Context context) {
|
||||
super(context, R.string.label_chest, R.drawable.ic_chest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getChest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setChest(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
return "cm";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMaxValue() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return Color.parseColor("#1e88e5");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,82 @@
|
||||
/* Copyright (C) 2018 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.gui.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class FatCaliperMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "fat_caliper";
|
||||
|
||||
public FatCaliperMeasurementView(Context context) {
|
||||
super(context, R.string.label_fat_caliper, R.drawable.ic_fat_caliper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supportsPercentageToAbsoluteWeightConversion() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getFatCaliper(getScaleUser());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
if (shouldConvertPercentageToAbsoluteWeight()) {
|
||||
return getScaleUser().getScaleUnit().toString();
|
||||
}
|
||||
|
||||
return "%";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMaxValue() {
|
||||
return maybeConvertPercentageToAbsoluteWeight(80);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return Color.parseColor("#f3e5f5");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
|
||||
return evalSheet.evaluateBodyFat(value);
|
||||
}
|
||||
}
|
@@ -68,7 +68,7 @@ public abstract class FloatMeasurementView extends MeasurementView {
|
||||
private float userConvertedWeight;
|
||||
private EvaluationResult evaluationResult;
|
||||
|
||||
private final String nameText;
|
||||
private String nameText;
|
||||
|
||||
private Button incButton;
|
||||
private Button decButton;
|
||||
@@ -474,6 +474,13 @@ public abstract class FloatMeasurementView extends MeasurementView {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setNameView(CharSequence text) {
|
||||
super.setNameView(text);
|
||||
|
||||
nameText = text.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExpand(boolean state) {
|
||||
final boolean show = state && isVisible() && evaluationResult != null;
|
||||
|
@@ -112,10 +112,19 @@ public abstract class MeasurementView extends TableLayout {
|
||||
unsorted.add(new LBMMeasurementView(context));
|
||||
unsorted.add(new FatMeasurementView(context));
|
||||
unsorted.add(new BoneMeasurementView(context));
|
||||
unsorted.add(new VisceralFatMeasurementView(context));
|
||||
unsorted.add(new WaistMeasurementView(context));
|
||||
unsorted.add(new WHtRMeasurementView(context));
|
||||
unsorted.add(new HipMeasurementView(context));
|
||||
unsorted.add(new WHRMeasurementView(context));
|
||||
unsorted.add(new ChestMeasurementView(context));
|
||||
unsorted.add(new ThighMeasurementView(context));
|
||||
unsorted.add(new BicepsMeasurementView(context));
|
||||
unsorted.add(new NeckMeasurementView(context));
|
||||
unsorted.add(new FatCaliperMeasurementView(context));
|
||||
unsorted.add(new Caliper1MeasurementView(context));
|
||||
unsorted.add(new Caliper2MeasurementView(context));
|
||||
unsorted.add(new Caliper3MeasurementView(context));
|
||||
unsorted.add(new BMRMeasurementView(context));
|
||||
unsorted.add(new CommentMeasurementView(context));
|
||||
|
||||
|
@@ -52,10 +52,18 @@ public class MeasurementViewSettings {
|
||||
case WeightMeasurementView.KEY:
|
||||
// Weight can't be disabled
|
||||
return true;
|
||||
case VisceralFatMeasurementView.KEY:
|
||||
case LBMMeasurementView.KEY:
|
||||
case BoneMeasurementView.KEY:
|
||||
case WaistMeasurementView.KEY:
|
||||
case HipMeasurementView.KEY:
|
||||
case ChestMeasurementView.KEY:
|
||||
case BicepsMeasurementView.KEY:
|
||||
case ThighMeasurementView.KEY:
|
||||
case NeckMeasurementView.KEY:
|
||||
case Caliper1MeasurementView.KEY:
|
||||
case Caliper2MeasurementView.KEY:
|
||||
case Caliper3MeasurementView.KEY:
|
||||
defaultValue = false;
|
||||
break;
|
||||
default:
|
||||
@@ -76,6 +84,11 @@ public class MeasurementViewSettings {
|
||||
|
||||
public boolean areDependenciesEnabled() {
|
||||
switch (key) {
|
||||
case FatCaliperMeasurementView.KEY:
|
||||
return isDependencyEnabled(Caliper1MeasurementView.KEY)
|
||||
&& isDependencyEnabled(Caliper2MeasurementView.KEY)
|
||||
&& isDependencyEnabled(Caliper3MeasurementView.KEY);
|
||||
|
||||
case BMIMeasurementView.KEY:
|
||||
case BMRMeasurementView.KEY:
|
||||
return isDependencyEnabled(WeightMeasurementView.KEY);
|
||||
|
@@ -0,0 +1,68 @@
|
||||
/* Copyright (C) 2018 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.gui.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class NeckMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "neck";
|
||||
|
||||
public NeckMeasurementView(Context context) {
|
||||
super(context, R.string.label_neck, R.drawable.ic_neck);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getNeck();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setNeck(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
return "cm";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMaxValue() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return Color.parseColor("#00acc1");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
/* Copyright (C) 2018 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.gui.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class ThighMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "thigh";
|
||||
|
||||
public ThighMeasurementView(Context context) {
|
||||
super(context, R.string.label_thigh, R.drawable.ic_thigh);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getThigh();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setThigh(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
return "cm";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMaxValue() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return Color.parseColor("#f4511e");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,77 @@
|
||||
/* Copyright (C) 2018 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.gui.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
|
||||
public class VisceralFatMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
public static final String KEY = "visceralFat";
|
||||
|
||||
public VisceralFatMeasurementView(Context context) {
|
||||
super(context, R.string.label_visceral_fat, R.drawable.ic_visceral_fat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supportsPercentageToAbsoluteWeightConversion() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getVisceralFat();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setVisceralFat(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
if (shouldConvertPercentageToAbsoluteWeight()) {
|
||||
return getScaleUser().getScaleUnit().toString();
|
||||
}
|
||||
|
||||
return "%";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getMaxValue() {
|
||||
return maybeConvertPercentageToAbsoluteWeight(80);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return Color.parseColor("#00bfa5");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EvaluationResult evaluateSheet(EvaluationSheet evalSheet, float value) {
|
||||
return null;
|
||||
}
|
||||
}
|
BIN
android_app/app/src/main/res/drawable-hdpi/ic_biceps.png
Normal file
After Width: | Height: | Size: 963 B |
BIN
android_app/app/src/main/res/drawable-hdpi/ic_caliper1.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
android_app/app/src/main/res/drawable-hdpi/ic_caliper2.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
android_app/app/src/main/res/drawable-hdpi/ic_caliper3.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
android_app/app/src/main/res/drawable-hdpi/ic_chest.png
Normal file
After Width: | Height: | Size: 943 B |
BIN
android_app/app/src/main/res/drawable-hdpi/ic_fat_caliper.png
Normal file
After Width: | Height: | Size: 891 B |
BIN
android_app/app/src/main/res/drawable-hdpi/ic_neck.png
Normal file
After Width: | Height: | Size: 634 B |
BIN
android_app/app/src/main/res/drawable-hdpi/ic_thigh.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
android_app/app/src/main/res/drawable-hdpi/ic_visceral_fat.png
Normal file
After Width: | Height: | Size: 795 B |
BIN
android_app/app/src/main/res/drawable-ldpi/ic_biceps.png
Normal file
After Width: | Height: | Size: 448 B |
BIN
android_app/app/src/main/res/drawable-ldpi/ic_caliper1.png
Normal file
After Width: | Height: | Size: 481 B |
BIN
android_app/app/src/main/res/drawable-ldpi/ic_caliper2.png
Normal file
After Width: | Height: | Size: 489 B |
BIN
android_app/app/src/main/res/drawable-ldpi/ic_caliper3.png
Normal file
After Width: | Height: | Size: 494 B |
BIN
android_app/app/src/main/res/drawable-ldpi/ic_chest.png
Normal file
After Width: | Height: | Size: 432 B |
BIN
android_app/app/src/main/res/drawable-ldpi/ic_fat_caliper.png
Normal file
After Width: | Height: | Size: 431 B |
BIN
android_app/app/src/main/res/drawable-ldpi/ic_neck.png
Normal file
After Width: | Height: | Size: 312 B |
BIN
android_app/app/src/main/res/drawable-ldpi/ic_thigh.png
Normal file
After Width: | Height: | Size: 467 B |
BIN
android_app/app/src/main/res/drawable-ldpi/ic_visceral_fat.png
Normal file
After Width: | Height: | Size: 405 B |
BIN
android_app/app/src/main/res/drawable-mdpi/ic_biceps.png
Normal file
After Width: | Height: | Size: 581 B |
BIN
android_app/app/src/main/res/drawable-mdpi/ic_caliper1.png
Normal file
After Width: | Height: | Size: 661 B |
BIN
android_app/app/src/main/res/drawable-mdpi/ic_caliper2.png
Normal file
After Width: | Height: | Size: 674 B |
BIN
android_app/app/src/main/res/drawable-mdpi/ic_caliper3.png
Normal file
After Width: | Height: | Size: 693 B |
BIN
android_app/app/src/main/res/drawable-mdpi/ic_chest.png
Normal file
After Width: | Height: | Size: 588 B |
BIN
android_app/app/src/main/res/drawable-mdpi/ic_fat_caliper.png
Normal file
After Width: | Height: | Size: 580 B |
BIN
android_app/app/src/main/res/drawable-mdpi/ic_neck.png
Normal file
After Width: | Height: | Size: 427 B |
BIN
android_app/app/src/main/res/drawable-mdpi/ic_thigh.png
Normal file
After Width: | Height: | Size: 625 B |
BIN
android_app/app/src/main/res/drawable-mdpi/ic_visceral_fat.png
Normal file
After Width: | Height: | Size: 524 B |
BIN
android_app/app/src/main/res/drawable-xhdpi/ic_biceps.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
android_app/app/src/main/res/drawable-xhdpi/ic_caliper1.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
android_app/app/src/main/res/drawable-xhdpi/ic_caliper2.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
android_app/app/src/main/res/drawable-xhdpi/ic_caliper3.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
android_app/app/src/main/res/drawable-xhdpi/ic_chest.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
android_app/app/src/main/res/drawable-xhdpi/ic_fat_caliper.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
android_app/app/src/main/res/drawable-xhdpi/ic_neck.png
Normal file
After Width: | Height: | Size: 856 B |
BIN
android_app/app/src/main/res/drawable-xhdpi/ic_thigh.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
android_app/app/src/main/res/drawable-xhdpi/ic_visceral_fat.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
android_app/app/src/main/res/drawable-xxhdpi/ic_biceps.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
android_app/app/src/main/res/drawable-xxhdpi/ic_caliper1.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
android_app/app/src/main/res/drawable-xxhdpi/ic_caliper2.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
android_app/app/src/main/res/drawable-xxhdpi/ic_caliper3.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
android_app/app/src/main/res/drawable-xxhdpi/ic_chest.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
android_app/app/src/main/res/drawable-xxhdpi/ic_fat_caliper.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
android_app/app/src/main/res/drawable-xxhdpi/ic_neck.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
android_app/app/src/main/res/drawable-xxhdpi/ic_thigh.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
android_app/app/src/main/res/drawable-xxhdpi/ic_visceral_fat.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
android_app/app/src/main/res/drawable-xxxhdpi/ic_biceps.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
android_app/app/src/main/res/drawable-xxxhdpi/ic_caliper1.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
android_app/app/src/main/res/drawable-xxxhdpi/ic_caliper2.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
android_app/app/src/main/res/drawable-xxxhdpi/ic_caliper3.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
android_app/app/src/main/res/drawable-xxxhdpi/ic_chest.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
android_app/app/src/main/res/drawable-xxxhdpi/ic_fat_caliper.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
android_app/app/src/main/res/drawable-xxxhdpi/ic_neck.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
android_app/app/src/main/res/drawable-xxxhdpi/ic_thigh.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 2.0 KiB |
@@ -223,4 +223,16 @@
|
||||
<string name="label_select_measurement">Select measurement</string>
|
||||
<string name="label_select_user">Select user</string>
|
||||
<string name="label_configure_widget">Configure widget</string>
|
||||
<string name="label_visceral_fat">Visceral fat</string>
|
||||
<string name="label_chest">Chest circumference</string>
|
||||
<string name="label_thigh">Thigh circumference</string>
|
||||
<string name="label_biceps">Biceps circumference</string>
|
||||
<string name="label_neck">Neck circumference</string>
|
||||
<string name="label_fat_caliper">Body fat caliper</string>
|
||||
<string name="label_caliper1_male">Chest skinfold</string>
|
||||
<string name="label_caliper2_male">Abdominal skinfold</string>
|
||||
<string name="label_caliper3_male">Thigh skinfold</string>
|
||||
<string name="label_caliper1_female">Triceps skinfold</string>
|
||||
<string name="label_caliper2_female">Abdominal skinfold</string>
|
||||
<string name="label_caliper3_female">Hip skinfold</string>
|
||||
</resources>
|
||||
|