mirror of
https://github.com/oliexdev/openScale.git
synced 2025-09-07 23:20:55 +02:00
- added option to set a measurement unit
- removed converted methods
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"formatVersion": 1,
|
||||
"database": {
|
||||
"version": 3,
|
||||
"identityHash": "2c2512af7063099727b54e5560c277e3",
|
||||
"identityHash": "974ad0a810bf389300cf67b40862bb75",
|
||||
"entities": [
|
||||
{
|
||||
"tableName": "scaleMeasurements",
|
||||
@@ -168,7 +168,7 @@
|
||||
},
|
||||
{
|
||||
"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, `heightUnit` INTEGER NOT NULL, `activityLevel` INTEGER NOT NULL)",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `username` TEXT NOT NULL, `birthday` INTEGER NOT NULL, `bodyHeight` REAL NOT NULL, `scaleUnit` INTEGER NOT NULL, `gender` INTEGER NOT NULL, `initialWeight` REAL NOT NULL, `goalWeight` REAL NOT NULL, `goalDate` INTEGER, `measureUnit` INTEGER NOT NULL, `activityLevel` INTEGER NOT NULL)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "id",
|
||||
@@ -180,18 +180,18 @@
|
||||
"fieldPath": "userName",
|
||||
"columnName": "username",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "birthday",
|
||||
"columnName": "birthday",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "bodyHeight",
|
||||
"columnName": "bodyHeight",
|
||||
"affinity": "INTEGER",
|
||||
"affinity": "REAL",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
@@ -225,8 +225,8 @@
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "heightUnit",
|
||||
"columnName": "heightUnit",
|
||||
"fieldPath": "measureUnit",
|
||||
"columnName": "measureUnit",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
@@ -249,7 +249,7 @@
|
||||
],
|
||||
"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, \"2c2512af7063099727b54e5560c277e3\")"
|
||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"974ad0a810bf389300cf67b40862bb75\")"
|
||||
]
|
||||
}
|
||||
}
|
@@ -31,6 +31,8 @@ import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertNotSame;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
@@ -116,6 +118,7 @@ public class DatabaseMigrationTest {
|
||||
for (int i = 1; i < 4; ++i) {
|
||||
users.put("id", i);
|
||||
users.put("username", String.format("test%d", i));
|
||||
users.put("birthday", i*100);
|
||||
users.put("bodyHeight", i * 50);
|
||||
users.put("scaleUnit", 0);
|
||||
users.put("gender", 0);
|
||||
@@ -146,10 +149,22 @@ public class DatabaseMigrationTest {
|
||||
|
||||
// MigrationTestHelper automatically verifies the schema changes.
|
||||
|
||||
assertEquals(3, db.query("SELECT * FROM scaleUsers WHERE heightUnit = 0").getCount());
|
||||
assertEquals(3, db.query("SELECT * FROM scaleUsers WHERE measureUnit = 0").getCount());
|
||||
assertEquals(3, db.query("SELECT * FROM scaleUsers WHERE activityLevel = 0").getCount());
|
||||
|
||||
Cursor cursor = db.query("SELECT * FROM scaleMeasurements ORDER BY id, userId");
|
||||
Cursor cursor = db.query("SELECT * FROM scaleUsers ORDER BY id");
|
||||
|
||||
cursor.moveToFirst();
|
||||
for (int i = 1; i < 4; ++i) {
|
||||
assertEquals(i, cursor.getInt(cursor.getColumnIndex("id")));
|
||||
assertEquals(i*100, cursor.getInt(cursor.getColumnIndex("birthday")));
|
||||
assertEquals(i*50, cursor.getInt(cursor.getColumnIndex("bodyHeight")));
|
||||
assertEquals(i*25, cursor.getInt(cursor.getColumnIndex("initialWeight")));
|
||||
assertEquals(i*20, cursor.getInt(cursor.getColumnIndex("goalWeight")));
|
||||
cursor.moveToNext();
|
||||
}
|
||||
|
||||
cursor = db.query("SELECT * FROM scaleMeasurements ORDER BY id, userId");
|
||||
assertEquals(2 * 2, cursor.getCount());
|
||||
|
||||
cursor.moveToFirst();
|
||||
|
@@ -335,7 +335,7 @@ public class OpenScale {
|
||||
|
||||
if (!silent) {
|
||||
String infoText = String.format(context.getString(R.string.info_new_data_added),
|
||||
scaleMeasurement.getConvertedWeight(unit), unit.toString(),
|
||||
Converters.fromKilogram(scaleMeasurement.getWeight(), unit), unit.toString(),
|
||||
dateFormat.format(dateTime) + " " + timeFormat.format(dateTime),
|
||||
scaleUser.getUserName());
|
||||
Toast.makeText(context, infoText, Toast.LENGTH_LONG).show();
|
||||
|
@@ -23,6 +23,7 @@ import android.content.Context;
|
||||
import com.health.openscale.core.OpenScale;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.datatypes.ScaleUser;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
@@ -97,7 +98,7 @@ public class BluetoothDigooDGSO38H extends BluetoothCommunication {
|
||||
if (weightStabilized) {
|
||||
//The weight is stabilized, now we want to measure all available values
|
||||
byte gender = selectedUser.getGender().isMale() ? (byte)0x00: (byte)0x01;
|
||||
byte height = (byte) (selectedUser.getBodyHeight() & 0xFF);
|
||||
byte height = (byte) (((int)selectedUser.getBodyHeight()) & 0xFF);
|
||||
byte age = (byte)(selectedUser.getAge() & 0xff);
|
||||
byte unit = 0x01; // kg
|
||||
switch (selectedUser.getScaleUnit()) {
|
||||
|
@@ -123,7 +123,7 @@ public class BluetoothExcelvanCF369BLE extends BluetoothCommunication {
|
||||
|
||||
final ScaleUser selectedUser = OpenScale.getInstance().getSelectedScaleUser();
|
||||
|
||||
scaleBtData.setConvertedWeight(weight, selectedUser.getScaleUnit());
|
||||
scaleBtData.setWeight(Converters.toKilogram(weight, selectedUser.getScaleUnit()));
|
||||
scaleBtData.setFat(fat);
|
||||
scaleBtData.setMuscle(muscle);
|
||||
scaleBtData.setWater(water);
|
||||
|
@@ -53,7 +53,7 @@ public class BluetoothExingtechY1 extends BluetoothCommunication {
|
||||
final ScaleUser selectedUser = OpenScale.getInstance().getSelectedScaleUser();
|
||||
|
||||
byte gender = selectedUser.getGender().isMale() ? (byte)0x00 : (byte)0x01; // 00 - male; 01 - female
|
||||
byte height = (byte)(selectedUser.getBodyHeight() & 0xff); // cm
|
||||
byte height = (byte)(((int)selectedUser.getBodyHeight()) & 0xff); // cm
|
||||
byte age = (byte)(selectedUser.getAge() & 0xff);
|
||||
|
||||
int userId = selectedUser.getId();
|
||||
@@ -106,7 +106,7 @@ public class BluetoothExingtechY1 extends BluetoothCommunication {
|
||||
|
||||
final ScaleUser selectedUser = OpenScale.getInstance().getSelectedScaleUser();
|
||||
|
||||
scaleBtData.setConvertedWeight(weight, selectedUser.getScaleUnit());
|
||||
scaleBtData.setWeight(Converters.toKilogram(weight, selectedUser.getScaleUnit()));
|
||||
scaleBtData.setFat(fat);
|
||||
scaleBtData.setMuscle(muscle);
|
||||
scaleBtData.setWater(water);
|
||||
|
@@ -101,7 +101,7 @@ public class BluetoothMGB extends BluetoothCommunication {
|
||||
break;
|
||||
|
||||
case 3:
|
||||
writeCfg(0xFB, (user.getGender().isMale() ? 1 : 2), user.getAge(), user.getBodyHeight());
|
||||
writeCfg(0xFB, (user.getGender().isMale() ? 1 : 2), user.getAge(), (int)user.getBodyHeight());
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
@@ -25,6 +25,7 @@ import android.preference.PreferenceManager;
|
||||
import com.health.openscale.core.OpenScale;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.datatypes.ScaleUser;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -238,7 +239,7 @@ public class BluetoothMiScale extends BluetoothCommunication {
|
||||
final ScaleUser selectedUser = OpenScale.getInstance().getSelectedScaleUser();
|
||||
ScaleMeasurement scaleBtData = new ScaleMeasurement();
|
||||
|
||||
scaleBtData.setConvertedWeight(weight, selectedUser.getScaleUnit());
|
||||
scaleBtData.setWeight(Converters.toKilogram(weight, selectedUser.getScaleUnit()));
|
||||
scaleBtData.setDateTime(date_time);
|
||||
|
||||
addScaleData(scaleBtData);
|
||||
|
@@ -25,6 +25,7 @@ import android.preference.PreferenceManager;
|
||||
import com.health.openscale.core.OpenScale;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.datatypes.ScaleUser;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -209,7 +210,7 @@ public class BluetoothMiScale2 extends BluetoothCommunication {
|
||||
final ScaleUser selectedUser = OpenScale.getInstance().getSelectedScaleUser();
|
||||
ScaleMeasurement scaleBtData = new ScaleMeasurement();
|
||||
|
||||
scaleBtData.setConvertedWeight(weight, selectedUser.getScaleUnit());
|
||||
scaleBtData.setWeight(Converters.toKilogram(weight, selectedUser.getScaleUnit()));
|
||||
scaleBtData.setDateTime(date_time);
|
||||
|
||||
addScaleData(scaleBtData);
|
||||
|
@@ -127,7 +127,7 @@ public class BluetoothYunmaiSE_Mini extends BluetoothCommunication {
|
||||
scaleBtData.setDateTime(new Date(timestamp));
|
||||
|
||||
float weight = Converters.fromUnsignedInt16Be(weightBytes, 13) / 100.0f;
|
||||
scaleBtData.setConvertedWeight(weight, selectedUser.getScaleUnit());
|
||||
scaleBtData.setWeight(Converters.toKilogram(weight, selectedUser.getScaleUnit()));
|
||||
|
||||
if (isMini) {
|
||||
float fat = Converters.fromUnsignedInt16Be(weightBytes, 17) / 100.0f;
|
||||
|
@@ -78,15 +78,14 @@ public abstract class AppDatabase extends RoomDatabase {
|
||||
public void migrate(SupportSQLiteDatabase database) {
|
||||
database.beginTransaction();
|
||||
try {
|
||||
// Add new columns to scaleUsers
|
||||
database.execSQL("ALTER TABLE scaleUsers ADD COLUMN heightUnit INTEGER NOT NULL DEFAULT 0");
|
||||
database.execSQL("ALTER TABLE scaleUsers ADD COLUMN activityLevel INTEGER NOT NULL DEFAULT 0");
|
||||
|
||||
|
||||
// Drop old index
|
||||
database.execSQL("DROP INDEX index_scaleMeasurements_userId_datetime");
|
||||
|
||||
// Rename old table
|
||||
database.execSQL("ALTER TABLE scaleMeasurements RENAME TO scaleMeasurementsOld");
|
||||
database.execSQL("ALTER TABLE scaleUsers RENAME TO scaleUsersOld");
|
||||
|
||||
// Create new table with foreign key
|
||||
database.execSQL("CREATE TABLE scaleMeasurements"
|
||||
@@ -101,6 +100,12 @@ public abstract class AppDatabase extends RoomDatabase {
|
||||
+ " FOREIGN KEY(userId) REFERENCES scaleUsers(id)"
|
||||
+ " ON UPDATE NO ACTION ON DELETE CASCADE)");
|
||||
|
||||
database.execSQL("CREATE TABLE scaleUsers "
|
||||
+ "(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "
|
||||
+ "username TEXT NOT NULL, birthday INTEGER NOT NULL, bodyHeight REAL NOT NULL, "
|
||||
+ "scaleUnit INTEGER NOT NULL, gender INTEGER NOT NULL, initialWeight REAL NOT NULL, "
|
||||
+ "goalWeight REAL NOT NULL, goalDate INTEGER, measureUnit INTEGER NOT NULL, activityLevel INTEGER NOT NULL)");
|
||||
|
||||
// Create new index on datetime + userId
|
||||
database.execSQL("CREATE UNIQUE INDEX index_scaleMeasurements_userId_datetime"
|
||||
+ " ON scaleMeasurements (userId, datetime)");
|
||||
@@ -112,8 +117,13 @@ public abstract class AppDatabase extends RoomDatabase {
|
||||
+ " 0 as thigh, 0 as biceps, 0 as neck, 0 as caliper1,"
|
||||
+ " 0 as caliper2, 0 as caliper3, comment FROM scaleMeasurementsOld");
|
||||
|
||||
database.execSQL("INSERT INTO scaleUsers"
|
||||
+ " SELECT id, username, birthday, bodyHeight, scaleUnit, gender, initialWeight, goalWeight,"
|
||||
+ " goalDate, 0 AS measureUnit, 0 AS activityLevel FROM scaleUsersOld");
|
||||
|
||||
// Delete old table
|
||||
database.execSQL("DROP TABLE scaleMeasurementsOld");
|
||||
database.execSQL("DROP TABLE scaleUsersOld");
|
||||
|
||||
database.setTransactionSuccessful();
|
||||
}
|
||||
|
@@ -227,18 +227,10 @@ public class ScaleMeasurement implements Cloneable {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public float getConvertedWeight(Converters.WeightUnit unit) {
|
||||
return Converters.fromKilogram(weight, unit);
|
||||
}
|
||||
|
||||
public void setWeight(float weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public void setConvertedWeight(float weight, Converters.WeightUnit unit) {
|
||||
this.weight = Converters.toKilogram(weight, unit);
|
||||
}
|
||||
|
||||
public float getFat() {
|
||||
return fat;
|
||||
}
|
||||
@@ -363,7 +355,7 @@ public class ScaleMeasurement implements Cloneable {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public float getBMI(int body_height) {
|
||||
public float getBMI(float body_height) {
|
||||
return weight / ((body_height / 100.0f)*(body_height / 100.0f));
|
||||
}
|
||||
|
||||
@@ -380,8 +372,8 @@ public class ScaleMeasurement implements Cloneable {
|
||||
return bmr; // kCal / day
|
||||
}
|
||||
|
||||
public float getWHtR(int body_height) {
|
||||
return waist / (float)body_height;
|
||||
public float getWHtR(float body_height) {
|
||||
return waist / body_height;
|
||||
}
|
||||
|
||||
public float getWHR() {
|
||||
@@ -397,7 +389,7 @@ public class ScaleMeasurement implements Cloneable {
|
||||
|
||||
float k0, k1, k2, ka;
|
||||
|
||||
float s = caliper1 + caliper2 + caliper3;
|
||||
float s = (caliper1 + caliper2 + caliper3) * 10.0f; // cm to mm
|
||||
|
||||
if (scaleUser.getGender().isMale()) {
|
||||
k0 = 1.10938f;
|
||||
|
@@ -32,12 +32,15 @@ public class ScaleUser {
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
private int id;
|
||||
|
||||
@NonNull
|
||||
@ColumnInfo(name = "username")
|
||||
private String userName;
|
||||
@NonNull
|
||||
@ColumnInfo(name = "birthday")
|
||||
private Date birthday;
|
||||
@NonNull
|
||||
@ColumnInfo(name = "bodyHeight")
|
||||
private int bodyHeight;
|
||||
private float bodyHeight;
|
||||
@ColumnInfo(name = "scaleUnit")
|
||||
@NonNull
|
||||
private Converters.WeightUnit scaleUnit;
|
||||
@@ -50,8 +53,9 @@ public class ScaleUser {
|
||||
private float goalWeight;
|
||||
@ColumnInfo(name = "goalDate")
|
||||
private Date goalDate;
|
||||
@ColumnInfo(name = "heightUnit")
|
||||
private int heightUnit;
|
||||
@NonNull
|
||||
@ColumnInfo(name = "measureUnit")
|
||||
private Converters.MeasureUnit measureUnit;
|
||||
@ColumnInfo(name = "activityLevel")
|
||||
private int activityLevel;
|
||||
|
||||
@@ -64,7 +68,7 @@ public class ScaleUser {
|
||||
initialWeight = -1;
|
||||
goalWeight = -1;
|
||||
goalDate = new Date();
|
||||
heightUnit = 0;
|
||||
measureUnit = Converters.MeasureUnit.CM;
|
||||
activityLevel = 0;
|
||||
}
|
||||
|
||||
@@ -92,11 +96,11 @@ public class ScaleUser {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
public int getBodyHeight() {
|
||||
public float getBodyHeight() {
|
||||
return bodyHeight;
|
||||
}
|
||||
|
||||
public void setBodyHeight(int bodyHeight) {
|
||||
public void setBodyHeight(float bodyHeight) {
|
||||
this.bodyHeight = bodyHeight;
|
||||
}
|
||||
|
||||
@@ -152,24 +156,16 @@ public class ScaleUser {
|
||||
this.initialWeight = weight;
|
||||
}
|
||||
|
||||
public void setConvertedInitialWeight(float weight) {
|
||||
initialWeight = Converters.toKilogram(weight, scaleUnit);
|
||||
}
|
||||
|
||||
public float getInitialWeight() {
|
||||
return initialWeight;
|
||||
}
|
||||
|
||||
public float getConvertedInitialWeight() {
|
||||
return Converters.fromKilogram(initialWeight, scaleUnit);
|
||||
public void setMeasureUnit(Converters.MeasureUnit unit) {
|
||||
measureUnit = unit;
|
||||
}
|
||||
|
||||
public void setHeightUnit(int unit) {
|
||||
heightUnit = unit;
|
||||
}
|
||||
|
||||
public int getHeightUnit() {
|
||||
return heightUnit;
|
||||
public Converters.MeasureUnit getMeasureUnit() {
|
||||
return measureUnit;
|
||||
}
|
||||
|
||||
public void setActivityLevel(int level) {
|
||||
@@ -192,7 +188,7 @@ public class ScaleUser {
|
||||
public String toString()
|
||||
{
|
||||
return String.format(
|
||||
"ID: %d, NAME: %s, BIRTHDAY: %s, BODY_HEIGHT: %d, SCALE_UNIT: %s, " +
|
||||
"ID: %d, NAME: %s, BIRTHDAY: %s, BODY_HEIGHT: %.2f, SCALE_UNIT: %s, " +
|
||||
"GENDER: %s, INITIAL_WEIGHT: %.2f, GOAL_WEIGHT: %.2f, GOAL_DATE: %s",
|
||||
id, userName, birthday.toString(), bodyHeight, scaleUnit.toString(),
|
||||
gender.toString().toLowerCase(), initialWeight, goalWeight, goalDate.toString());
|
||||
|
@@ -150,8 +150,8 @@ public class EvaluationSheet {
|
||||
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));
|
||||
waistEvaluateSheet_Man.add(new sheetEntry(18, 90, -1, Converters.fromCentimeter(94, evalUser.getMeasureUnit())));
|
||||
waistEvaluateSheet_Woman.add(new sheetEntry(18, 90, -1, Converters.fromCentimeter(80, evalUser.getMeasureUnit())));
|
||||
|
||||
whrtEvaluateSheet.add(new sheetEntry(15, 40, 0.4f, 0.5f));
|
||||
whrtEvaluateSheet.add(new sheetEntry(41, 42, 0.4f, 0.51f));
|
||||
|
@@ -21,6 +21,42 @@ import android.arch.persistence.room.TypeConverter;
|
||||
import java.util.Date;
|
||||
|
||||
public class Converters {
|
||||
public enum MeasureUnit {
|
||||
CM, INCH;
|
||||
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case CM:
|
||||
return "cm";
|
||||
case INCH:
|
||||
return "in";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public static MeasureUnit fromInt(int unit) {
|
||||
switch (unit) {
|
||||
case 0:
|
||||
return CM;
|
||||
case 1:
|
||||
return INCH;
|
||||
}
|
||||
return CM;
|
||||
}
|
||||
|
||||
public int toInt() {
|
||||
switch (this) {
|
||||
case CM:
|
||||
return 0;
|
||||
case INCH:
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public enum WeightUnit {
|
||||
KG, LB, ST;
|
||||
|
||||
@@ -73,6 +109,7 @@ public class Converters {
|
||||
|
||||
private static final float KG_LB = 2.20462f;
|
||||
private static final float KG_ST = 0.157473f;
|
||||
private static final float CM_IN = 0.393701f;
|
||||
|
||||
@TypeConverter
|
||||
public static Date fromTimestamp(Long value) {
|
||||
@@ -84,6 +121,16 @@ public class Converters {
|
||||
return date == null ? null : date.getTime();
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
public static MeasureUnit fromMeasureUnitInt(int unit) {
|
||||
return MeasureUnit.fromInt(unit);
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
public static int toMeasureUnitInt(MeasureUnit unit) {
|
||||
return unit.toInt();
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
public static WeightUnit fromWeightUnitInt(int unit) {
|
||||
return WeightUnit.fromInt(unit);
|
||||
@@ -104,6 +151,22 @@ public class Converters {
|
||||
return gender.toInt();
|
||||
}
|
||||
|
||||
public static float toCentimeter(float value, MeasureUnit unit) {
|
||||
switch (unit) {
|
||||
case INCH:
|
||||
return value / CM_IN;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static float fromCentimeter(float cm, MeasureUnit unit) {
|
||||
switch (unit) {
|
||||
case INCH:
|
||||
return cm * CM_IN;
|
||||
}
|
||||
return cm;
|
||||
}
|
||||
|
||||
public static float toKilogram(float value, WeightUnit unit) {
|
||||
switch (unit) {
|
||||
case LB:
|
||||
|
@@ -62,6 +62,7 @@ public class UserSettingsActivity extends BaseAppCompatActivity {
|
||||
private EditText txtGoalDate;
|
||||
private RadioGroup radioScaleUnit;
|
||||
private RadioGroup radioGender;
|
||||
private RadioGroup radioMeasurementUnit;
|
||||
|
||||
private final DateFormat dateFormat = DateFormat.getDateInstance();
|
||||
|
||||
@@ -84,6 +85,7 @@ public class UserSettingsActivity extends BaseAppCompatActivity {
|
||||
txtBodyHeight = findViewById(R.id.txtBodyHeight);
|
||||
radioScaleUnit = findViewById(R.id.groupScaleUnit);
|
||||
radioGender = findViewById(R.id.groupGender);
|
||||
radioMeasurementUnit = findViewById(R.id.groupMeasureUnit);
|
||||
txtInitialWeight = findViewById(R.id.txtInitialWeight);
|
||||
txtGoalWeight = findViewById(R.id.txtGoalWeight);
|
||||
|
||||
@@ -205,11 +207,20 @@ public class UserSettingsActivity extends BaseAppCompatActivity {
|
||||
goal_date = scaleUser.getGoalDate();
|
||||
|
||||
txtUserName.setText(scaleUser.getUserName());
|
||||
txtBodyHeight.setText(Integer.toString(scaleUser.getBodyHeight()));
|
||||
txtBodyHeight.setText(Float.toString(Math.round(Converters.fromCentimeter(scaleUser.getBodyHeight(), scaleUser.getMeasureUnit()) * 100.0f) / 100.0f));
|
||||
txtBirthday.setText(dateFormat.format(birthday));
|
||||
txtGoalDate.setText(dateFormat.format(goal_date));
|
||||
txtInitialWeight.setText(Math.round(scaleUser.getConvertedInitialWeight()*100.0f)/100.0f + "");
|
||||
txtGoalWeight.setText(scaleUser.getGoalWeight() +"");
|
||||
txtInitialWeight.setText(Float.toString(Math.round(Converters.fromKilogram(scaleUser.getInitialWeight(), scaleUser.getScaleUnit())*100.0f)/100.0f));
|
||||
txtGoalWeight.setText(Float.toString(Math.round(Converters.fromKilogram(scaleUser.getGoalWeight(), scaleUser.getScaleUnit())*100.0f)/100.0f));
|
||||
|
||||
switch (scaleUser.getMeasureUnit()) {
|
||||
case CM:
|
||||
radioMeasurementUnit.check(R.id.btnRadioCM);
|
||||
break;
|
||||
case INCH:
|
||||
radioMeasurementUnit.check(R.id.btnRadioINCH);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (scaleUser.getScaleUnit())
|
||||
{
|
||||
@@ -338,15 +349,24 @@ public class UserSettingsActivity extends BaseAppCompatActivity {
|
||||
OpenScale openScale = OpenScale.getInstance();
|
||||
|
||||
String name = txtUserName.getText().toString();
|
||||
int body_height = Integer.valueOf(txtBodyHeight.getText().toString());
|
||||
int checkedRadioButtonId = radioScaleUnit.getCheckedRadioButtonId();
|
||||
int checkedGenderId = radioGender.getCheckedRadioButtonId();
|
||||
float body_height = Float.valueOf(txtBodyHeight.getText().toString());
|
||||
float initial_weight = Float.valueOf(txtInitialWeight.getText().toString());
|
||||
float goal_weight = Float.valueOf(txtGoalWeight.getText().toString());
|
||||
|
||||
Converters.MeasureUnit measure_unit = Converters.MeasureUnit.CM;
|
||||
|
||||
switch (radioMeasurementUnit.getCheckedRadioButtonId()) {
|
||||
case R.id.btnRadioCM:
|
||||
measure_unit = Converters.MeasureUnit.CM;
|
||||
break;
|
||||
case R.id.btnRadioINCH:
|
||||
measure_unit = Converters.MeasureUnit.INCH;
|
||||
break;
|
||||
}
|
||||
|
||||
Converters.WeightUnit scale_unit = Converters.WeightUnit.KG;
|
||||
|
||||
switch (checkedRadioButtonId) {
|
||||
switch (radioScaleUnit.getCheckedRadioButtonId()) {
|
||||
case R.id.btnRadioKG:
|
||||
scale_unit = Converters.WeightUnit.KG;
|
||||
break;
|
||||
@@ -360,7 +380,7 @@ public class UserSettingsActivity extends BaseAppCompatActivity {
|
||||
|
||||
Converters.Gender gender = Converters.Gender.MALE;
|
||||
|
||||
switch (checkedGenderId) {
|
||||
switch (radioGender.getCheckedRadioButtonId()) {
|
||||
case R.id.btnRadioMale:
|
||||
gender = Converters.Gender.MALE;
|
||||
break;
|
||||
@@ -373,11 +393,12 @@ public class UserSettingsActivity extends BaseAppCompatActivity {
|
||||
|
||||
scaleUser.setUserName(name);
|
||||
scaleUser.setBirthday(birthday);
|
||||
scaleUser.setBodyHeight(body_height);
|
||||
scaleUser.setBodyHeight(Converters.toCentimeter(body_height, measure_unit));
|
||||
scaleUser.setScaleUnit(scale_unit);
|
||||
scaleUser.setMeasureUnit(measure_unit);
|
||||
scaleUser.setGender(gender);
|
||||
scaleUser.setConvertedInitialWeight(initial_weight);
|
||||
scaleUser.setGoalWeight(goal_weight);
|
||||
scaleUser.setInitialWeight(Converters.toKilogram(initial_weight, scale_unit));
|
||||
scaleUser.setGoalWeight(Converters.toKilogram(goal_weight, scale_unit));
|
||||
scaleUser.setGoalDate(goal_date);
|
||||
|
||||
if (getIntent().getExtras().getInt(EXTRA_MODE) == EDIT_USER_REQUEST) {
|
||||
|
@@ -290,7 +290,7 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
PieChartData pieChartData = new PieChartData(arcValuesLast);
|
||||
pieChartData.setHasLabels(false);
|
||||
pieChartData.setHasCenterCircle(true);
|
||||
pieChartData.setCenterText1(String.format("%.2f %s", lastScaleMeasurement.getConvertedWeight(unit), unit.toString()));
|
||||
pieChartData.setCenterText1(String.format("%.2f %s", Converters.fromKilogram(lastScaleMeasurement.getWeight(), unit), unit.toString()));
|
||||
pieChartData.setCenterText2(DateFormat.getDateInstance(DateFormat.MEDIUM).format(lastScaleMeasurement.getDateTime()));
|
||||
pieChartData.setCenterText1Color(txtTitleLastMeasurement.getCurrentTextColor());
|
||||
pieChartData.setCenterText2Color(txtTitleLastMeasurement.getCurrentTextColor());
|
||||
|
@@ -185,11 +185,11 @@ public class StatisticsFragment extends Fragment implements FragmentUpdateListen
|
||||
|
||||
ScaleMeasurement goalScaleMeasurement = new ScaleMeasurement();
|
||||
goalScaleMeasurement.setUserId(currentScaleUser.getId());
|
||||
goalScaleMeasurement.setConvertedWeight(currentScaleUser.getGoalWeight(), unit);
|
||||
goalScaleMeasurement.setWeight(Converters.toKilogram(currentScaleUser.getGoalWeight(), unit));
|
||||
|
||||
txtGoalWeight.setText(String.format("%.1f %s", goalScaleMeasurement.getConvertedWeight(unit), unit.toString()));
|
||||
txtGoalWeight.setText(String.format("%.1f %s", Converters.fromKilogram(goalScaleMeasurement.getWeight(), unit), unit.toString()));
|
||||
|
||||
double weight_diff = goalScaleMeasurement.getConvertedWeight(unit) - lastScaleMeasurement.getConvertedWeight(unit);
|
||||
double weight_diff = Converters.fromKilogram(goalScaleMeasurement.getWeight() - lastScaleMeasurement.getWeight(), unit);
|
||||
txtGoalDiff.setText(String.format("%.1f %s", weight_diff, unit.toString()));
|
||||
|
||||
Calendar goalCalendar = Calendar.getInstance();
|
||||
|
@@ -22,6 +22,7 @@ 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;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
|
||||
public class BicepsMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
@@ -38,17 +39,17 @@ public class BicepsMeasurementView extends FloatMeasurementView {
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getBiceps();
|
||||
return Converters.fromCentimeter(measurement.getBiceps(), getScaleUser().getMeasureUnit());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setBiceps(value);
|
||||
measurement.setBiceps(Converters.toCentimeter(value, getScaleUser().getMeasureUnit()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
return "cm";
|
||||
return getScaleUser().getMeasureUnit().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -22,6 +22,7 @@ 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;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
|
||||
public class Caliper1MeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
@@ -42,17 +43,17 @@ public class Caliper1MeasurementView extends FloatMeasurementView {
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getCaliper1();
|
||||
return Converters.fromCentimeter(measurement.getCaliper1(), getScaleUser().getMeasureUnit());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setCaliper1(value);
|
||||
measurement.setCaliper1(Converters.toCentimeter(value, getScaleUser().getMeasureUnit()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
return "mm";
|
||||
return getScaleUser().getMeasureUnit().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -22,6 +22,7 @@ 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;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
|
||||
public class Caliper2MeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
@@ -42,17 +43,17 @@ public class Caliper2MeasurementView extends FloatMeasurementView {
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getCaliper2();
|
||||
return Converters.fromCentimeter(measurement.getCaliper2(), getScaleUser().getMeasureUnit());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setCaliper2(value);
|
||||
measurement.setCaliper2(Converters.toCentimeter(value, getScaleUser().getMeasureUnit()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
return "mm";
|
||||
return getScaleUser().getMeasureUnit().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -22,6 +22,7 @@ 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;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
|
||||
public class Caliper3MeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
@@ -42,17 +43,17 @@ public class Caliper3MeasurementView extends FloatMeasurementView {
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getCaliper3();
|
||||
return Converters.fromCentimeter(measurement.getCaliper3(), getScaleUser().getMeasureUnit());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setCaliper3(value);
|
||||
measurement.setCaliper3(Converters.toCentimeter(value, getScaleUser().getMeasureUnit()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
return "mm";
|
||||
return getScaleUser().getMeasureUnit().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -22,6 +22,7 @@ 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;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
|
||||
public class ChestMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
@@ -38,17 +39,17 @@ public class ChestMeasurementView extends FloatMeasurementView {
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getChest();
|
||||
return Converters.fromCentimeter(measurement.getChest(), getScaleUser().getMeasureUnit());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setChest(value);
|
||||
measurement.setChest(Converters.toCentimeter(value, getScaleUser().getMeasureUnit()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
return "cm";
|
||||
return getScaleUser().getMeasureUnit().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -49,6 +49,7 @@ 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;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
@@ -321,7 +322,7 @@ public abstract class FloatMeasurementView extends MeasurementView {
|
||||
if (shouldConvert()) {
|
||||
// Make sure weight is never 0 to avoid division by 0
|
||||
userConvertedWeight = Math.max(1.0f,
|
||||
measurement.getConvertedWeight(getScaleUser().getScaleUnit()));
|
||||
Converters.fromKilogram(measurement.getWeight(), getScaleUser().getScaleUnit()));
|
||||
}
|
||||
else {
|
||||
// Only valid when a conversion is enabled
|
||||
|
@@ -22,6 +22,7 @@ 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;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
|
||||
public class HipMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
@@ -38,17 +39,17 @@ public class HipMeasurementView extends FloatMeasurementView {
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getHip();
|
||||
return Converters.fromCentimeter(measurement.getHip(), getScaleUser().getMeasureUnit());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setHip(value);
|
||||
measurement.setHip(Converters.toCentimeter(value, getScaleUser().getMeasureUnit()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
return "cm";
|
||||
return getScaleUser().getMeasureUnit().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -22,6 +22,7 @@ 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;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
|
||||
public class NeckMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
@@ -38,17 +39,17 @@ public class NeckMeasurementView extends FloatMeasurementView {
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getNeck();
|
||||
return Converters.fromCentimeter(measurement.getNeck(), getScaleUser().getMeasureUnit());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setNeck(value);
|
||||
measurement.setNeck(Converters.toCentimeter(value, getScaleUser().getMeasureUnit()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
return "cm";
|
||||
return getScaleUser().getMeasureUnit().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -22,6 +22,7 @@ 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;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
|
||||
public class ThighMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
@@ -38,17 +39,17 @@ public class ThighMeasurementView extends FloatMeasurementView {
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getThigh();
|
||||
return Converters.fromCentimeter(measurement.getThigh(), getScaleUser().getMeasureUnit());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setThigh(value);
|
||||
measurement.setThigh(Converters.toCentimeter(value, getScaleUser().getMeasureUnit()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
return "cm";
|
||||
return getScaleUser().getMeasureUnit().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -22,6 +22,7 @@ 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;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
|
||||
public class WaistMeasurementView extends FloatMeasurementView {
|
||||
// Don't change key value, it may be stored persistent in preferences
|
||||
@@ -38,17 +39,17 @@ public class WaistMeasurementView extends FloatMeasurementView {
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getWaist();
|
||||
return Converters.fromCentimeter(measurement.getWaist(), getScaleUser().getMeasureUnit());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setWaist(value);
|
||||
measurement.setWaist(Converters.toCentimeter(value, getScaleUser().getMeasureUnit()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit() {
|
||||
return "cm";
|
||||
return getScaleUser().getMeasureUnit().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -39,12 +39,12 @@ public class WeightMeasurementView extends FloatMeasurementView {
|
||||
|
||||
@Override
|
||||
protected float getMeasurementValue(ScaleMeasurement measurement) {
|
||||
return measurement.getConvertedWeight(getScaleUser().getScaleUnit());
|
||||
return Converters.fromKilogram(measurement.getWeight(), getScaleUser().getScaleUnit());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setMeasurementValue(float value, ScaleMeasurement measurement) {
|
||||
measurement.setConvertedWeight(value, getScaleUser().getScaleUnit());
|
||||
Converters.toKilogram(value, getScaleUser().getScaleUnit());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -56,27 +56,6 @@
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/rowBodyHeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lblBodyHeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_height" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtBodyHeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:hint="@string/info_enter_value_cm"
|
||||
android:inputType="numberSigned" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/rowGender"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -113,6 +92,41 @@
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/rowMeasureUnit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/measureUnit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/label_measure_unit" />
|
||||
|
||||
<RadioGroup
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="1"
|
||||
android:orientation="horizontal"
|
||||
android:id="@+id/groupMeasureUnit">
|
||||
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="cm"
|
||||
android:id="@+id/btnRadioCM"
|
||||
android:checked="true" />
|
||||
|
||||
<RadioButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="in"
|
||||
android:id="@+id/btnRadioINCH" />
|
||||
</RadioGroup>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/rowUnit"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -154,6 +168,27 @@
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/rowBodyHeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lblBodyHeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_height" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtBodyHeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:hint="@string/info_enter_value_measurement_unit"
|
||||
android:inputType="numberDecimal|numberSigned" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/rowBirthday"
|
||||
android:layout_width="wrap_content"
|
||||
|
@@ -78,7 +78,7 @@
|
||||
<string name="info_data_all_deleted">Totes les entrades eliminades</string>
|
||||
<string name="info_data_exported">Dades exportades a</string>
|
||||
<string name="info_data_imported">Dades importades de</string>
|
||||
<string name="info_enter_value_cm">Valor en cm</string>
|
||||
<string name="info_enter_value_measurement_unit">Valor en cm</string>
|
||||
<string name="info_enter_comment">Comentari opcional</string>
|
||||
<string name="info_is_visible">està visible</string>
|
||||
<string name="info_is_not_visible">no està visible</string>
|
||||
|
@@ -72,7 +72,7 @@
|
||||
<string name="info_data_all_deleted">Všechny položky vymazány z databáze</string>
|
||||
<string name="info_data_exported">Data exportována na</string>
|
||||
<string name="info_data_imported">Data importována z</string>
|
||||
<string name="info_enter_value_cm">Zadejte hodnotu v cm</string>
|
||||
<string name="info_enter_value_measurement_unit">Zadejte hodnotu v cm</string>
|
||||
<string name="info_enter_comment">Zadejte volitelný komentář</string>
|
||||
<string name="info_is_visible">je viditelné</string>
|
||||
<string name="info_is_not_visible">není viditelné</string>
|
||||
|
@@ -11,7 +11,7 @@
|
||||
<string name="info_data_imported">Importiert von</string>
|
||||
<string name="info_enter_comment">Gib einen optionalen Kommentar ein</string>
|
||||
<string name="info_enter_user_name">Dein Name</string>
|
||||
<string name="info_enter_value_cm">Wert in cm</string>
|
||||
<string name="info_enter_value_measurement_unit">Wert in cm</string>
|
||||
<string name="info_is_not_visible">ist nicht sichtbar</string>
|
||||
<string name="info_is_visible">ist sichtbar</string>
|
||||
<string name="info_is_not_available">nicht verfügbar</string>
|
||||
|
@@ -81,7 +81,7 @@
|
||||
<string name="info_data_all_deleted">Όλες οι καταχωρήσεις διεγράφησαν</string>
|
||||
<string name="info_data_exported">Εξήχθη σε</string>
|
||||
<string name="info_data_imported">Εισήχθη από</string>
|
||||
<string name="info_enter_value_cm">Τιμή σε εκ</string>
|
||||
<string name="info_enter_value_measurement_unit">Τιμή σε εκ</string>
|
||||
<string name="info_enter_comment">Προεραιτικό σχόλιο</string>
|
||||
<string name="info_enter_value_scale_unit">Τιμή σε μονάδα ζύγησης</string>
|
||||
<string name="info_is_visible">είναι ορατό</string>
|
||||
|
@@ -78,7 +78,7 @@
|
||||
<string name="info_data_all_deleted">Todas las entradas borradas</string>
|
||||
<string name="info_data_exported">Exportado a</string>
|
||||
<string name="info_data_imported">Importado de</string>
|
||||
<string name="info_enter_value_cm">Valor en cm</string>
|
||||
<string name="info_enter_value_measurement_unit">Valor en cm</string>
|
||||
<string name="info_enter_comment">Comentario opcional</string>
|
||||
<string name="info_is_visible">está visible</string>
|
||||
<string name="info_is_not_visible">no está visible</string>
|
||||
|
@@ -72,7 +72,7 @@
|
||||
<string name="info_data_all_deleted">Toutes les entrées ont été supprimées</string>
|
||||
<string name="info_data_exported">Données exportées vers</string>
|
||||
<string name="info_data_imported">Donnéees importées depuis</string>
|
||||
<string name="info_enter_value_cm">Valeur en cm</string>
|
||||
<string name="info_enter_value_measurement_unit">Valeur en cm</string>
|
||||
<string name="info_enter_comment">Commentaire optionnel</string>
|
||||
<string name="info_is_visible">est visible</string>
|
||||
<string name="info_is_not_visible">n\'est pas visible</string>
|
||||
|
@@ -77,7 +77,7 @@
|
||||
<string name="info_data_all_deleted">Todas as entradas borradas</string>
|
||||
<string name="info_data_exported">Exportado a</string>
|
||||
<string name="info_data_imported">Importado de</string>
|
||||
<string name="info_enter_value_cm">Valor en cm</string>
|
||||
<string name="info_enter_value_measurement_unit">Valor en cm</string>
|
||||
<string name="info_enter_comment">Comentario opcional</string>
|
||||
<string name="info_is_visible">está visible</string>
|
||||
<string name="info_is_not_visible">non está visible</string>
|
||||
|
@@ -84,7 +84,7 @@
|
||||
<string name="info_data_all_deleted">Tutti le misurazioni sono state cancellate</string>
|
||||
<string name="info_data_exported">Esportato su</string>
|
||||
<string name="info_data_imported">Importato da</string>
|
||||
<string name="info_enter_value_cm">Valore in cm</string>
|
||||
<string name="info_enter_value_measurement_unit">Valore in cm</string>
|
||||
<string name="info_enter_comment">Commento opzionale</string>
|
||||
<string name="info_enter_value_scale_unit">Valore in unità di misura</string>
|
||||
<string name="info_is_visible">è visibile</string>
|
||||
|
@@ -60,7 +60,7 @@
|
||||
<string name="info_is_not_available">利用不可</string>
|
||||
<string name="info_enter_user_name">あなたの名前</string>
|
||||
<string name="info_enter_comment">コメント(任意)</string>
|
||||
<string name="info_enter_value_cm">値 (cm)</string>
|
||||
<string name="info_enter_value_measurement_unit">値 (cm)</string>
|
||||
<string name="question_really_delete_all">全ユーザーの全記録を削除しますか?</string>
|
||||
<string name="question_really_delete_user">ユーザーを削除しますか?</string>
|
||||
<string name="error_goal_weight_required">エラー:目標体重が必要です</string>
|
||||
|
@@ -82,7 +82,7 @@
|
||||
<string name="info_data_all_deleted">Alle oppføringer slettet</string>
|
||||
<string name="info_data_exported">Eksportert til</string>
|
||||
<string name="info_data_imported">Importert fra</string>
|
||||
<string name="info_enter_value_cm">Verdi i cm</string>
|
||||
<string name="info_enter_value_measurement_unit">Verdi i cm</string>
|
||||
<string name="info_enter_comment">Valgfri kommentar</string>
|
||||
<string name="info_enter_value_scale_unit">Verdi i vektenhet</string>
|
||||
<string name="info_is_visible">er synlig</string>
|
||||
|
@@ -80,7 +80,7 @@
|
||||
<string name="info_data_all_deleted">Alle database vermeldingen verwijderd</string>
|
||||
<string name="info_data_exported">Data geëxporteerd naar</string>
|
||||
<string name="info_data_imported">Data geïmporteerd van</string>
|
||||
<string name="info_enter_value_cm">Geef waarde in cm</string>
|
||||
<string name="info_enter_value_measurement_unit">Geef waarde in cm</string>
|
||||
<string name="info_enter_comment">Voeg een optionele opmerking toe</string>
|
||||
<string name="info_is_visible">is zichtbaar</string>
|
||||
<string name="info_is_not_visible">is niet zichtbaar</string>
|
||||
|
@@ -85,7 +85,7 @@
|
||||
<string name="info_data_all_deleted">Wszystkie wpisy usunięte</string>
|
||||
<string name="info_data_exported">Wyeksportowano do</string>
|
||||
<string name="info_data_imported">Zaimportowano z</string>
|
||||
<string name="info_enter_value_cm">Wartość w cm</string>
|
||||
<string name="info_enter_value_measurement_unit">Wartość w cm</string>
|
||||
<string name="info_enter_comment">Wprowadź opcjonalny komentarz</string>
|
||||
<string name="info_is_visible">jest widoczne</string>
|
||||
<string name="info_is_not_visible">nie jest widoczne</string>
|
||||
|
@@ -31,7 +31,7 @@
|
||||
<string name="info_data_imported">Dados importados de</string>
|
||||
<string name="info_enter_comment">Digite um comentário opcional</string>
|
||||
<string name="info_enter_user_name">Digite seu nome</string>
|
||||
<string name="info_enter_value_cm">Digite o valor em centímetros</string>
|
||||
<string name="info_enter_value_measurement_unit">Digite o valor em centímetros</string>
|
||||
<string name="info_is_enable">está ativado</string>
|
||||
<string name="info_is_not_available">não está disponível</string>
|
||||
<string name="info_is_not_enable">está desativado</string>
|
||||
|
@@ -82,7 +82,7 @@
|
||||
<string name="info_data_all_deleted">Toate înregistrările au fost șterse</string>
|
||||
<string name="info_data_exported">Exportat spre</string>
|
||||
<string name="info_data_imported">Importat din</string>
|
||||
<string name="info_enter_value_cm">Valoare în cm</string>
|
||||
<string name="info_enter_value_measurement_unit">Valoare în cm</string>
|
||||
<string name="info_enter_comment">Comentariu opțional</string>
|
||||
<string name="info_enter_value_scale_unit">Valoare în unitățile axei</string>
|
||||
<string name="info_is_visible">e vizibilă</string>
|
||||
|
@@ -64,7 +64,7 @@
|
||||
<string name="info_data_all_deleted">Všetkých položky boli vymazané z databázy</string>
|
||||
<string name="info_data_exported">Údaje boli exportované do</string>
|
||||
<string name="info_data_imported">Údaje boli importované z</string>
|
||||
<string name="info_enter_value_cm">Zadajte hodnotu v cm</string>
|
||||
<string name="info_enter_value_measurement_unit">Zadajte hodnotu v cm</string>
|
||||
<string name="info_enter_comment">Zadajte voliteľný komentár</string>
|
||||
<string name="info_is_visible">je viditeľná</string>
|
||||
<string name="info_is_not_visible">nie je viditeľná</string>
|
||||
|
@@ -80,7 +80,7 @@
|
||||
<string name="info_data_all_deleted">Alla poster borttagna</string>
|
||||
<string name="info_data_exported">Exporterad till</string>
|
||||
<string name="info_data_imported">Importerad från</string>
|
||||
<string name="info_enter_value_cm">Värde i cm</string>
|
||||
<string name="info_enter_value_measurement_unit">Värde i cm</string>
|
||||
<string name="info_enter_comment">Frivillig kommentar</string>
|
||||
<string name="info_enter_value_scale_unit">Värde i viktenhet</string>
|
||||
<string name="info_is_visible">är synlig</string>
|
||||
|
@@ -76,7 +76,7 @@
|
||||
<string name="info_data_all_deleted">Veri tabaný giriþi silindi</string>
|
||||
<string name="info_data_exported">Veri dýþarý aktarma</string>
|
||||
<string name="info_data_imported">Veri içeri aktarma</string>
|
||||
<string name="info_enter_value_cm">Deðeri cm olarak girin</string>
|
||||
<string name="info_enter_value_measurement_unit">Deðeri cm olarak girin</string>
|
||||
<string name="info_enter_comment">Ýsteðebaðlý açýklama girin</string>
|
||||
<string name="info_is_visible">görünür</string>
|
||||
<string name="info_is_not_visible">görünmez</string>
|
||||
|
@@ -80,7 +80,7 @@
|
||||
<string name="info_data_all_deleted">所有數據已被刪除</string>
|
||||
<string name="info_data_exported">滙出去處</string>
|
||||
<string name="info_data_imported">滙入來源</string>
|
||||
<string name="info_enter_value_cm">數值單位為 cm</string>
|
||||
<string name="info_enter_value_measurement_unit">數值單位為 cm</string>
|
||||
<string name="info_enter_comment">可加備註</string>
|
||||
<string name="info_enter_value_scale_unit">採用量重器上單位</string>
|
||||
<string name="info_is_visible">可表示</string>
|
||||
|
@@ -84,7 +84,7 @@
|
||||
<string name="info_data_all_deleted">All entries deleted</string>
|
||||
<string name="info_data_exported">Exported to</string>
|
||||
<string name="info_data_imported">Imported from</string>
|
||||
<string name="info_enter_value_cm">Value in cm</string>
|
||||
<string name="info_enter_value_measurement_unit">Value in measurement unit</string>
|
||||
<string name="info_enter_comment">Optional comment</string>
|
||||
<string name="info_enter_value_scale_unit">Value in scale unit</string>
|
||||
<string name="info_is_visible">is visible</string>
|
||||
@@ -235,4 +235,5 @@
|
||||
<string name="label_caliper1_female">Triceps skinfold</string>
|
||||
<string name="label_caliper2_female">Abdominal skinfold</string>
|
||||
<string name="label_caliper3_female">Hip skinfold</string>
|
||||
<string name="label_measure_unit">Measurement unit</string>
|
||||
</resources>
|
||||
|
Reference in New Issue
Block a user