mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-19 23:12:12 +02:00
redesign the overview fragment
weight goal can be set data entries are now editable calculates the current BMI of a person
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
</activity>
|
</activity>
|
||||||
<activity android:name="com.health.openscale.gui.SettingsActivity"></activity>
|
<activity android:name="com.health.openscale.gui.SettingsActivity"></activity>
|
||||||
<activity android:name="com.health.openscale.gui.NewEntryActivity" android:theme="@android:style/Theme.Holo.Dialog" android:label="@string/title_new_data_entry"></activity>
|
<activity android:name="com.health.openscale.gui.NewEntryActivity" android:theme="@android:style/Theme.Holo.Dialog" android:label="@string/title_new_data_entry"></activity>
|
||||||
|
<activity android:name="com.health.openscale.gui.EditDataActivity" android:theme="@android:style/Theme.Holo.Dialog" android:label="@string/title_edit_data_entry"></activity>
|
||||||
<activity android:name=".gui.UserSettingsActivity" android:theme="@android:style/Theme.Holo.Dialog" android:label="@string/title_user"></activity>
|
<activity android:name=".gui.UserSettingsActivity" android:theme="@android:style/Theme.Holo.Dialog" android:label="@string/title_user"></activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
@@ -66,7 +66,7 @@ public class OpenScale {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addScaleUser(String name, String birthday, int body_height, int scale_unit)
|
public void addScaleUser(String name, String birthday, int body_height, int scale_unit, int gender, double goal_weight, String goal_date)
|
||||||
{
|
{
|
||||||
ScaleUser scaleUser = new ScaleUser();
|
ScaleUser scaleUser = new ScaleUser();
|
||||||
|
|
||||||
@@ -75,6 +75,9 @@ public class OpenScale {
|
|||||||
scaleUser.birthday = new SimpleDateFormat("dd.MM.yyyy").parse(birthday);
|
scaleUser.birthday = new SimpleDateFormat("dd.MM.yyyy").parse(birthday);
|
||||||
scaleUser.body_height = body_height;
|
scaleUser.body_height = body_height;
|
||||||
scaleUser.scale_unit = scale_unit;
|
scaleUser.scale_unit = scale_unit;
|
||||||
|
scaleUser.gender = gender;
|
||||||
|
scaleUser.goal_weight = goal_weight;
|
||||||
|
scaleUser.goal_date = new SimpleDateFormat("dd.MM.yyyy").parse(goal_date);
|
||||||
|
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
Log.e("OpenScale", "Can't parse date time string while adding to the database");
|
Log.e("OpenScale", "Can't parse date time string while adding to the database");
|
||||||
@@ -120,7 +123,7 @@ public class OpenScale {
|
|||||||
scaleUserDB.deleteEntry(id);
|
scaleUserDB.deleteEntry(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateScaleUser(int id, String name, String birthday, int body_height, int scale_unit)
|
public void updateScaleUser(int id, String name, String birthday, int body_height, int scale_unit, int gender, double goal_weight, String goal_date)
|
||||||
{
|
{
|
||||||
ScaleUser scaleUser = new ScaleUser();
|
ScaleUser scaleUser = new ScaleUser();
|
||||||
|
|
||||||
@@ -130,6 +133,9 @@ public class OpenScale {
|
|||||||
scaleUser.birthday = new SimpleDateFormat("dd.MM.yyyy").parse(birthday);
|
scaleUser.birthday = new SimpleDateFormat("dd.MM.yyyy").parse(birthday);
|
||||||
scaleUser.body_height = body_height;
|
scaleUser.body_height = body_height;
|
||||||
scaleUser.scale_unit = scale_unit;
|
scaleUser.scale_unit = scale_unit;
|
||||||
|
scaleUser.gender = gender;
|
||||||
|
scaleUser.goal_weight = goal_weight;
|
||||||
|
scaleUser.goal_date = new SimpleDateFormat("dd.MM.yyyy").parse(goal_date);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
Log.e("OpenScale", "Can't parse date time string while adding to the database");
|
Log.e("OpenScale", "Can't parse date time string while adding to the database");
|
||||||
}
|
}
|
||||||
@@ -137,10 +143,17 @@ public class OpenScale {
|
|||||||
scaleUserDB.updateScaleUser(scaleUser);
|
scaleUserDB.updateScaleUser(scaleUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ArrayList<ScaleData> getScaleDataList() {
|
public ArrayList<ScaleData> getScaleDataList() {
|
||||||
return scaleDataList;
|
return scaleDataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ScaleData getScaleData(long id)
|
||||||
|
{
|
||||||
|
return scaleDB.getDataEntry(id);
|
||||||
|
}
|
||||||
|
|
||||||
public void addScaleData(int user_id, String date_time, float weight, float fat,
|
public void addScaleData(int user_id, String date_time, float weight, float fat,
|
||||||
float water, float muscle) {
|
float water, float muscle) {
|
||||||
ScaleData scaleData = new ScaleData();
|
ScaleData scaleData = new ScaleData();
|
||||||
@@ -161,6 +174,19 @@ public class OpenScale {
|
|||||||
updateScaleData();
|
updateScaleData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateScaleData(long id, float weight, float fat, float water, float muscle) {
|
||||||
|
ScaleData scaleData = new ScaleData();
|
||||||
|
|
||||||
|
scaleData.weight = weight;
|
||||||
|
scaleData.fat = fat;
|
||||||
|
scaleData.water = water;
|
||||||
|
scaleData.muscle = muscle;
|
||||||
|
|
||||||
|
scaleDB.updateEntry(id, scaleData);
|
||||||
|
|
||||||
|
updateScaleData();
|
||||||
|
}
|
||||||
|
|
||||||
public void deleteScaleData(long id)
|
public void deleteScaleData(long id)
|
||||||
{
|
{
|
||||||
scaleDB.deleteEntry(id);
|
scaleDB.deleteEntry(id);
|
||||||
|
@@ -112,6 +112,68 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateEntry(long id, ScaleData scaleData) {
|
||||||
|
SQLiteDatabase db = getWritableDatabase();
|
||||||
|
|
||||||
|
ContentValues values = new ContentValues();
|
||||||
|
values.put(COLUMN_NAME_WEIGHT, scaleData.weight);
|
||||||
|
values.put(COLUMN_NAME_FAT, scaleData.fat);
|
||||||
|
values.put(COLUMN_NAME_WATER, scaleData.water);
|
||||||
|
values.put(COLUMN_NAME_MUSCLE, scaleData.muscle);
|
||||||
|
|
||||||
|
db.update(TABLE_NAME, values, COLUMN_NAME_ID + "=" + id, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScaleData getDataEntry(long id)
|
||||||
|
{
|
||||||
|
SQLiteDatabase db = getReadableDatabase();
|
||||||
|
ScaleData scaleData = new ScaleData();
|
||||||
|
|
||||||
|
String[] projection = {
|
||||||
|
COLUMN_NAME_ID,
|
||||||
|
COLUMN_NAME_USER_ID,
|
||||||
|
COLUMN_NAME_DATE_TIME,
|
||||||
|
COLUMN_NAME_WEIGHT,
|
||||||
|
COLUMN_NAME_FAT,
|
||||||
|
COLUMN_NAME_WATER,
|
||||||
|
COLUMN_NAME_MUSCLE
|
||||||
|
};
|
||||||
|
|
||||||
|
Cursor cursorScaleDB = db.query(
|
||||||
|
TABLE_NAME, // The table to query
|
||||||
|
projection, // The columns to return
|
||||||
|
COLUMN_NAME_ID + "=?", // The columns for the WHERE clause
|
||||||
|
new String[] {Long.toString(id)}, // The values for the WHERE clause
|
||||||
|
null, // don't group the rows
|
||||||
|
null, // don't filter by row groups
|
||||||
|
null // The sort order
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
cursorScaleDB.moveToFirst();
|
||||||
|
|
||||||
|
scaleData.id = cursorScaleDB.getLong(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_ID));
|
||||||
|
scaleData.user_id = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_USER_ID));
|
||||||
|
String date_time = cursorScaleDB.getString(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_DATE_TIME));
|
||||||
|
scaleData.weight = cursorScaleDB.getFloat(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_WEIGHT));
|
||||||
|
scaleData.fat = cursorScaleDB.getFloat(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_FAT));
|
||||||
|
scaleData.water = cursorScaleDB.getFloat(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_WATER));
|
||||||
|
scaleData.muscle = cursorScaleDB.getFloat(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_MUSCLE));
|
||||||
|
|
||||||
|
scaleData.date_time = formatDateTime.parse(date_time);
|
||||||
|
|
||||||
|
cursorScaleDB.moveToNext();
|
||||||
|
|
||||||
|
} catch (ParseException ex) {
|
||||||
|
Log.e("ScaleDatabase", "Can't parse the date time string: " + ex.getMessage());
|
||||||
|
}
|
||||||
|
catch ( IllegalArgumentException ex) {
|
||||||
|
Log.e("ScaleDatabase", "Illegal argument while reading from scale database: " + ex.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return scaleData;
|
||||||
|
}
|
||||||
|
|
||||||
public void deleteEntry(long id) {
|
public void deleteEntry(long id) {
|
||||||
SQLiteDatabase db = getWritableDatabase();
|
SQLiteDatabase db = getWritableDatabase();
|
||||||
|
|
||||||
|
@@ -26,10 +26,25 @@ public class ScaleUser {
|
|||||||
public Date birthday;
|
public Date birthday;
|
||||||
public int body_height;
|
public int body_height;
|
||||||
public int scale_unit;
|
public int scale_unit;
|
||||||
|
public int gender;
|
||||||
|
public double goal_weight;
|
||||||
|
public Date goal_date;
|
||||||
|
|
||||||
|
public boolean isMale()
|
||||||
|
{
|
||||||
|
if (gender == 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getBMI(double weight) {
|
||||||
|
return weight / ((body_height / 100.0)*(body_height / 100.0));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return "ID : " + id + " NAME: " + user_name + " BIRTHDAY: " + birthday.toString() + " BODY_HEIGHT: " + body_height + " SCALE_UNIT: " + UNIT_STRING[scale_unit];
|
return "ID : " + id + " NAME: " + user_name + " BIRTHDAY: " + birthday.toString() + " BODY_HEIGHT: " + body_height + " SCALE_UNIT: " + UNIT_STRING[scale_unit] + " GENDER " + gender + " GOAL WEIGHT " + goal_weight + " GOAL DATE " + goal_date.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class ScaleUserDatabase extends SQLiteOpenHelper {
|
public class ScaleUserDatabase extends SQLiteOpenHelper {
|
||||||
private static final int DATABASE_VERSION = 1;
|
private static final int DATABASE_VERSION = 2;
|
||||||
private static final String DATABASE_NAME = "openScaleUserDatabase.db";
|
private static final String DATABASE_NAME = "openScaleUserDatabase.db";
|
||||||
|
|
||||||
private static final String TABLE_NAME = "scaleuserdata";
|
private static final String TABLE_NAME = "scaleuserdata";
|
||||||
@@ -39,6 +39,9 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
|||||||
private static final String COLUMN_NAME_BIRTHDAY = "birthday";
|
private static final String COLUMN_NAME_BIRTHDAY = "birthday";
|
||||||
private static final String COLUMN_NAME_BODY_HEIGHT = "body_height";
|
private static final String COLUMN_NAME_BODY_HEIGHT = "body_height";
|
||||||
private static final String COLUMN_NAME_SCALE_UNIT = "scale_unit";
|
private static final String COLUMN_NAME_SCALE_UNIT = "scale_unit";
|
||||||
|
private static final String COLUMN_NAME_GENDER = "gender";
|
||||||
|
private static final String COLUMN_NAME_GOAL_WEIGHT = "goal_weight";
|
||||||
|
private static final String COLUMN_NAME_GOAL_DATE = "goal_date";
|
||||||
|
|
||||||
private static final String SQL_CREATE_ENTRIES =
|
private static final String SQL_CREATE_ENTRIES =
|
||||||
"CREATE TABLE " + TABLE_NAME + " (" +
|
"CREATE TABLE " + TABLE_NAME + " (" +
|
||||||
@@ -46,7 +49,10 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
|||||||
COLUMN_NAME_USER_NAME + " TEXT," +
|
COLUMN_NAME_USER_NAME + " TEXT," +
|
||||||
COLUMN_NAME_BIRTHDAY + " TEXT," +
|
COLUMN_NAME_BIRTHDAY + " TEXT," +
|
||||||
COLUMN_NAME_BODY_HEIGHT + " INTEGER," +
|
COLUMN_NAME_BODY_HEIGHT + " INTEGER," +
|
||||||
COLUMN_NAME_SCALE_UNIT + " INTEGER" +
|
COLUMN_NAME_SCALE_UNIT + " INTEGER," +
|
||||||
|
COLUMN_NAME_GENDER + " INTEGER," +
|
||||||
|
COLUMN_NAME_GOAL_WEIGHT + " REAL," +
|
||||||
|
COLUMN_NAME_GOAL_DATE + " TEXT" +
|
||||||
")";
|
")";
|
||||||
|
|
||||||
private static final String SQL_DELETE_ENTRIES =
|
private static final String SQL_DELETE_ENTRIES =
|
||||||
@@ -65,8 +71,11 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||||
db.execSQL(SQL_DELETE_ENTRIES);
|
if (oldVersion == 1 && newVersion == 2) {
|
||||||
onCreate(db);
|
db.execSQL("ALTER TABLE " + TABLE_NAME + " ADD COLUMN " + COLUMN_NAME_GENDER + " INTEGER DEFAULT 0");
|
||||||
|
db.execSQL("ALTER TABLE " + TABLE_NAME + " ADD COLUMN " + COLUMN_NAME_GOAL_WEIGHT + " REAL DEFAULT 0");
|
||||||
|
db.execSQL("ALTER TABLE " + TABLE_NAME + " ADD COLUMN " + COLUMN_NAME_GOAL_DATE + " TEXT DEFAULT '2014-01-01 00:00'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearDatabase() {
|
public void clearDatabase() {
|
||||||
@@ -83,6 +92,9 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
|||||||
values.put(COLUMN_NAME_BIRTHDAY, formatDateTime.format(scaleUser.birthday));
|
values.put(COLUMN_NAME_BIRTHDAY, formatDateTime.format(scaleUser.birthday));
|
||||||
values.put(COLUMN_NAME_BODY_HEIGHT, scaleUser.body_height);
|
values.put(COLUMN_NAME_BODY_HEIGHT, scaleUser.body_height);
|
||||||
values.put(COLUMN_NAME_SCALE_UNIT, scaleUser.scale_unit);
|
values.put(COLUMN_NAME_SCALE_UNIT, scaleUser.scale_unit);
|
||||||
|
values.put(COLUMN_NAME_GENDER, scaleUser.gender);
|
||||||
|
values.put(COLUMN_NAME_GOAL_WEIGHT, scaleUser.goal_weight);
|
||||||
|
values.put(COLUMN_NAME_GOAL_DATE, formatDateTime.format(scaleUser.goal_date));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -112,6 +124,9 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
|||||||
values.put(COLUMN_NAME_BIRTHDAY, formatDateTime.format(scaleUser.birthday));
|
values.put(COLUMN_NAME_BIRTHDAY, formatDateTime.format(scaleUser.birthday));
|
||||||
values.put(COLUMN_NAME_BODY_HEIGHT, scaleUser.body_height);
|
values.put(COLUMN_NAME_BODY_HEIGHT, scaleUser.body_height);
|
||||||
values.put(COLUMN_NAME_SCALE_UNIT, scaleUser.scale_unit);
|
values.put(COLUMN_NAME_SCALE_UNIT, scaleUser.scale_unit);
|
||||||
|
values.put(COLUMN_NAME_GENDER, scaleUser.gender);
|
||||||
|
values.put(COLUMN_NAME_GOAL_WEIGHT, scaleUser.goal_weight);
|
||||||
|
values.put(COLUMN_NAME_GOAL_DATE, formatDateTime.format(scaleUser.goal_date));
|
||||||
|
|
||||||
db.update(TABLE_NAME, values, COLUMN_NAME_ID + "=" + scaleUser.id, null);
|
db.update(TABLE_NAME, values, COLUMN_NAME_ID + "=" + scaleUser.id, null);
|
||||||
}
|
}
|
||||||
@@ -126,7 +141,10 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
|||||||
COLUMN_NAME_USER_NAME,
|
COLUMN_NAME_USER_NAME,
|
||||||
COLUMN_NAME_BIRTHDAY,
|
COLUMN_NAME_BIRTHDAY,
|
||||||
COLUMN_NAME_BODY_HEIGHT,
|
COLUMN_NAME_BODY_HEIGHT,
|
||||||
COLUMN_NAME_SCALE_UNIT
|
COLUMN_NAME_SCALE_UNIT,
|
||||||
|
COLUMN_NAME_GENDER,
|
||||||
|
COLUMN_NAME_GOAL_WEIGHT,
|
||||||
|
COLUMN_NAME_GOAL_DATE
|
||||||
};
|
};
|
||||||
|
|
||||||
Cursor cursorScaleDB = db.query(
|
Cursor cursorScaleDB = db.query(
|
||||||
@@ -147,8 +165,12 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
|||||||
String birthday = cursorScaleDB.getString(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_BIRTHDAY));
|
String birthday = cursorScaleDB.getString(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_BIRTHDAY));
|
||||||
scaleUser.body_height = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_BODY_HEIGHT));
|
scaleUser.body_height = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_BODY_HEIGHT));
|
||||||
scaleUser.scale_unit = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_SCALE_UNIT));
|
scaleUser.scale_unit = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_SCALE_UNIT));
|
||||||
|
scaleUser.gender = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_GENDER));
|
||||||
|
scaleUser.goal_weight = cursorScaleDB.getFloat(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_GOAL_WEIGHT));
|
||||||
|
String goal_date = cursorScaleDB.getString(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_GOAL_DATE));
|
||||||
|
|
||||||
scaleUser.birthday = formatDateTime.parse(birthday);
|
scaleUser.birthday = formatDateTime.parse(birthday);
|
||||||
|
scaleUser.goal_date = formatDateTime.parse(goal_date);
|
||||||
|
|
||||||
cursorScaleDB.moveToNext();
|
cursorScaleDB.moveToNext();
|
||||||
|
|
||||||
@@ -171,7 +193,10 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
|||||||
COLUMN_NAME_USER_NAME,
|
COLUMN_NAME_USER_NAME,
|
||||||
COLUMN_NAME_BIRTHDAY,
|
COLUMN_NAME_BIRTHDAY,
|
||||||
COLUMN_NAME_BODY_HEIGHT,
|
COLUMN_NAME_BODY_HEIGHT,
|
||||||
COLUMN_NAME_SCALE_UNIT
|
COLUMN_NAME_SCALE_UNIT,
|
||||||
|
COLUMN_NAME_GENDER,
|
||||||
|
COLUMN_NAME_GOAL_WEIGHT,
|
||||||
|
COLUMN_NAME_GOAL_DATE
|
||||||
};
|
};
|
||||||
|
|
||||||
String sortOrder = COLUMN_NAME_ID + " DESC";
|
String sortOrder = COLUMN_NAME_ID + " DESC";
|
||||||
@@ -197,8 +222,12 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
|||||||
String birthday = cursorScaleDB.getString(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_BIRTHDAY));
|
String birthday = cursorScaleDB.getString(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_BIRTHDAY));
|
||||||
scaleUser.body_height = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_BODY_HEIGHT));
|
scaleUser.body_height = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_BODY_HEIGHT));
|
||||||
scaleUser.scale_unit = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_SCALE_UNIT));
|
scaleUser.scale_unit = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_SCALE_UNIT));
|
||||||
|
scaleUser.gender = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_GENDER));
|
||||||
scaleUser.birthday = formatDateTime.parse(birthday);
|
scaleUser.goal_weight = cursorScaleDB.getFloat(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_GOAL_WEIGHT));
|
||||||
|
String goal_date = cursorScaleDB.getString(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_GOAL_DATE));
|
||||||
|
|
||||||
|
scaleUser.birthday = formatDateTime.parse(birthday);
|
||||||
|
scaleUser.goal_date = formatDateTime.parse(goal_date);
|
||||||
|
|
||||||
scaleUserDBEntries.add(scaleUser);
|
scaleUserDBEntries.add(scaleUser);
|
||||||
|
|
||||||
|
@@ -0,0 +1,101 @@
|
|||||||
|
/* Copyright (C) 2014 olie.xdev <olie.xdev@googlemail.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
package com.health.openscale.gui;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
|
||||||
|
import com.health.openscale.R;
|
||||||
|
import com.health.openscale.core.OpenScale;
|
||||||
|
import com.health.openscale.core.ScaleData;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
|
public class EditDataActivity extends Activity {
|
||||||
|
|
||||||
|
private EditText txtWeight;
|
||||||
|
private EditText txtFat;
|
||||||
|
private EditText txtWater;
|
||||||
|
private EditText txtMuscle;
|
||||||
|
|
||||||
|
private Button btnOk;
|
||||||
|
private Button btnCancel;
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_editdata);
|
||||||
|
|
||||||
|
context = this;
|
||||||
|
|
||||||
|
txtWeight = (EditText) findViewById(R.id.txtWeight);
|
||||||
|
txtFat = (EditText) findViewById(R.id.txtFat);
|
||||||
|
txtWater = (EditText) findViewById(R.id.txtWater);
|
||||||
|
txtMuscle = (EditText) findViewById(R.id.txtMuscle);
|
||||||
|
|
||||||
|
btnOk = (Button)findViewById(R.id.btnOk);
|
||||||
|
btnCancel = (Button)findViewById(R.id.btnCancel);
|
||||||
|
|
||||||
|
btnOk.setOnClickListener(new onClickListenerOk());
|
||||||
|
btnCancel.setOnClickListener(new onClickListenerCancel());
|
||||||
|
|
||||||
|
id = getIntent().getExtras().getLong("id");
|
||||||
|
|
||||||
|
OpenScale openScale = OpenScale.getInstance(context);
|
||||||
|
|
||||||
|
ScaleData editScaleData = openScale.getScaleData(id);
|
||||||
|
|
||||||
|
txtWeight.setText(editScaleData.weight+"");
|
||||||
|
txtFat.setText(editScaleData.fat+"");
|
||||||
|
txtWater.setText(editScaleData.water+"");
|
||||||
|
txtMuscle.setText(editScaleData.muscle+"");
|
||||||
|
|
||||||
|
setTitle(getResources().getString(R.string.title_edit_data_entry) + ": " + new SimpleDateFormat("dd. MMM yyyy (EE) HH:mm").format(editScaleData.date_time));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private class onClickListenerOk implements View.OnClickListener {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
float weight = Float.valueOf(txtWeight.getText().toString());
|
||||||
|
float fat = Float.valueOf(txtFat.getText().toString());
|
||||||
|
float water = Float.valueOf(txtWater.getText().toString());
|
||||||
|
float muscle = Float.valueOf(txtMuscle.getText().toString());
|
||||||
|
|
||||||
|
OpenScale openScale = OpenScale.getInstance(context);
|
||||||
|
|
||||||
|
openScale.updateScaleData(id, weight, fat, water, muscle);
|
||||||
|
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class onClickListenerCancel implements View.OnClickListener {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -17,10 +17,14 @@ package com.health.openscale.gui;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.text.Html;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -34,47 +38,114 @@ import com.health.openscale.core.ScaleUser;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import lecho.lib.hellocharts.model.ArcValue;
|
import lecho.lib.hellocharts.model.ArcValue;
|
||||||
|
import lecho.lib.hellocharts.model.Axis;
|
||||||
|
import lecho.lib.hellocharts.model.AxisValue;
|
||||||
|
import lecho.lib.hellocharts.model.Line;
|
||||||
|
import lecho.lib.hellocharts.model.LineChartData;
|
||||||
import lecho.lib.hellocharts.model.PieChartData;
|
import lecho.lib.hellocharts.model.PieChartData;
|
||||||
|
import lecho.lib.hellocharts.model.PointValue;
|
||||||
import lecho.lib.hellocharts.model.SimpleValueFormatter;
|
import lecho.lib.hellocharts.model.SimpleValueFormatter;
|
||||||
import lecho.lib.hellocharts.util.Utils;
|
import lecho.lib.hellocharts.util.Utils;
|
||||||
|
import lecho.lib.hellocharts.view.LineChartView;
|
||||||
import lecho.lib.hellocharts.view.PieChartView;
|
import lecho.lib.hellocharts.view.PieChartView;
|
||||||
|
|
||||||
public class OverviewFragment extends Fragment implements FragmentUpdateListener {
|
public class OverviewFragment extends Fragment implements FragmentUpdateListener {
|
||||||
private View overviewView;
|
private View overviewView;
|
||||||
|
|
||||||
private TextView txtOverviewTitle;
|
private TextView txtTitleUser;
|
||||||
private PieChartView pieChart;
|
private TextView txtTitleLastMeasurement;
|
||||||
private TextView txtAvgWeight;
|
private TextView txtTitleGoal;
|
||||||
private TextView txtAvgFat;
|
private TextView txtTitleStatistics;
|
||||||
private TextView txtAvgWater;
|
|
||||||
private TextView txtAvgMuscle;
|
private TextView txtWeightLast;
|
||||||
|
private TextView txtBMILast;
|
||||||
|
private TextView txtWaterLast;
|
||||||
|
private TextView txtMuscleLast;
|
||||||
|
private TextView txtFatLast;
|
||||||
|
|
||||||
|
private TextView txtGoalWeight;
|
||||||
|
private TextView txtGoalDiff;
|
||||||
|
private TextView txtGoalDayLeft;
|
||||||
|
|
||||||
|
private TextView txtAvgWeek;
|
||||||
|
private TextView txtAvgMonth;
|
||||||
|
|
||||||
|
private TextView txtLabelWeight;
|
||||||
|
private TextView txtLabelBMI;
|
||||||
|
private TextView txtLabelFat;
|
||||||
|
private TextView txtLabelMuscle;
|
||||||
|
private TextView txtLabelWater;
|
||||||
|
|
||||||
|
private TextView txtLabelGoalWeight;
|
||||||
|
private TextView txtLabelGoalDiff;
|
||||||
|
private TextView txtLabelDayLeft;
|
||||||
|
|
||||||
|
private TextView txtLabelAvgWeek;
|
||||||
|
private TextView txtLabelAvgMonth;
|
||||||
|
|
||||||
|
private PieChartView pieChartLast;
|
||||||
|
private LineChartView lineChartLast;
|
||||||
|
|
||||||
|
private SharedPreferences prefs;
|
||||||
|
|
||||||
private ScaleData lastScaleData;
|
private ScaleData lastScaleData;
|
||||||
|
private ScaleUser currentScaleUser;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
overviewView = inflater.inflate(R.layout.fragment_overview, container, false);
|
overviewView = inflater.inflate(R.layout.fragment_overview, container, false);
|
||||||
|
|
||||||
txtOverviewTitle = (TextView) overviewView.findViewById(R.id.txtOverviewTitle);
|
txtTitleUser = (TextView) overviewView.findViewById(R.id.txtTitleUser);
|
||||||
pieChart = (PieChartView) overviewView.findViewById(R.id.pieChart);
|
txtTitleLastMeasurement = (TextView) overviewView.findViewById(R.id.txtTitleLastMeasurment);
|
||||||
txtAvgWeight = (TextView) overviewView.findViewById(R.id.txtAvgWeight);
|
txtTitleGoal = (TextView) overviewView.findViewById(R.id.txtTitleGoal);
|
||||||
txtAvgFat = (TextView) overviewView.findViewById(R.id.txtAvgFat);
|
txtTitleStatistics = (TextView) overviewView.findViewById(R.id.txtTitleStatistics);
|
||||||
txtAvgWater = (TextView) overviewView.findViewById(R.id.txtAvgWater);
|
|
||||||
txtAvgMuscle = (TextView) overviewView.findViewById(R.id.txtAvgMuscle);
|
|
||||||
|
|
||||||
pieChart.setOnValueTouchListener(new PieChartTouchListener());
|
txtWeightLast = (TextView) overviewView.findViewById(R.id.txtWeightLast);
|
||||||
pieChart.setChartRotationEnabled(false);
|
txtBMILast = (TextView) overviewView.findViewById(R.id.txtBMILast);
|
||||||
|
txtWaterLast = (TextView) overviewView.findViewById(R.id.txtWaterLast);
|
||||||
|
txtMuscleLast = (TextView) overviewView.findViewById(R.id.txtMuscleLast);
|
||||||
|
txtFatLast = (TextView) overviewView.findViewById(R.id.txtFatLast);
|
||||||
|
|
||||||
|
txtGoalWeight = (TextView) overviewView.findViewById(R.id.txtGoalWeight);
|
||||||
|
txtGoalDiff = (TextView) overviewView.findViewById(R.id.txtGoalDiff);
|
||||||
|
txtGoalDayLeft = (TextView) overviewView.findViewById(R.id.txtGoalDayLeft);
|
||||||
|
|
||||||
|
txtAvgWeek = (TextView) overviewView.findViewById(R.id.txtAvgWeek);
|
||||||
|
txtAvgMonth = (TextView) overviewView.findViewById(R.id.txtAvgMonth);
|
||||||
|
|
||||||
|
txtLabelWeight = (TextView) overviewView.findViewById(R.id.txtLabelWeight);
|
||||||
|
txtLabelBMI = (TextView) overviewView.findViewById(R.id.txtLabelBMI);
|
||||||
|
txtLabelFat = (TextView) overviewView.findViewById(R.id.txtLabelFat);
|
||||||
|
txtLabelMuscle = (TextView) overviewView.findViewById(R.id.txtLabelMuscle);
|
||||||
|
txtLabelWater = (TextView) overviewView.findViewById(R.id.txtLabelWater);
|
||||||
|
|
||||||
|
txtLabelGoalWeight = (TextView) overviewView.findViewById(R.id.txtLabelGoalWeight);
|
||||||
|
txtLabelGoalDiff = (TextView) overviewView.findViewById(R.id.txtLabelGoalDiff);
|
||||||
|
txtLabelDayLeft = (TextView) overviewView.findViewById(R.id.txtLabelDayLeft);
|
||||||
|
|
||||||
|
txtLabelAvgWeek = (TextView) overviewView.findViewById(R.id.txtLabelAvgWeek);
|
||||||
|
txtLabelAvgMonth = (TextView) overviewView.findViewById(R.id.txtLabelAvgMonth);
|
||||||
|
|
||||||
|
pieChartLast = (PieChartView) overviewView.findViewById(R.id.pieChartLast);
|
||||||
|
lineChartLast = (LineChartView) overviewView.findViewById(R.id.lineChartLast);
|
||||||
|
|
||||||
|
pieChartLast.setOnValueTouchListener(new PieChartLastTouchListener());
|
||||||
|
pieChartLast.setChartRotationEnabled(false);
|
||||||
|
|
||||||
overviewView.findViewById(R.id.btnInsertData).setOnClickListener(new View.OnClickListener() {
|
overviewView.findViewById(R.id.btnInsertData).setOnClickListener(new View.OnClickListener() {
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
btnOnClickInsertData();
|
btnOnClickInsertData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
prefs = PreferenceManager.getDefaultSharedPreferences(overviewView.getContext());
|
||||||
|
|
||||||
updateOnView(OpenScale.getInstance(overviewView.getContext()).getScaleDataList());
|
updateOnView(OpenScale.getInstance(overviewView.getContext()).getScaleDataList());
|
||||||
|
|
||||||
return overviewView;
|
return overviewView;
|
||||||
@@ -83,66 +154,287 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
|||||||
@Override
|
@Override
|
||||||
public void updateOnView(ArrayList<ScaleData> scaleDataList)
|
public void updateOnView(ArrayList<ScaleData> scaleDataList)
|
||||||
{
|
{
|
||||||
ScaleUser scaleUser = OpenScale.getInstance(overviewView.getContext()).getSelectedScaleUser();
|
currentScaleUser = OpenScale.getInstance(overviewView.getContext()).getSelectedScaleUser();
|
||||||
|
|
||||||
txtOverviewTitle.setText(getResources().getString(R.string.label_overview_title_start) + " " + scaleUser.user_name + " " + getResources().getString(R.string.label_overview_title_end));
|
if (scaleDataList.isEmpty()) {
|
||||||
|
|
||||||
List<ArcValue> arcValues = new ArrayList<ArcValue>();
|
|
||||||
|
|
||||||
if (scaleDataList.isEmpty()) {
|
|
||||||
lastScaleData = null;
|
lastScaleData = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastScaleData = scaleDataList.get(0);
|
lastScaleData = scaleDataList.get(0);
|
||||||
|
|
||||||
arcValues.add(new ArcValue(lastScaleData.fat, Utils.COLOR_ORANGE));
|
txtTitleUser.setText(getResources().getString(R.string.label_title_user).toUpperCase() + " " + currentScaleUser.user_name);
|
||||||
arcValues.add(new ArcValue(lastScaleData.water, Utils.COLOR_BLUE));
|
txtTitleLastMeasurement.setText(getResources().getString(R.string.label_title_last_measurement).toUpperCase());
|
||||||
arcValues.add(new ArcValue(lastScaleData.muscle, Utils.COLOR_GREEN));
|
txtTitleGoal.setText(getResources().getString(R.string.label_title_goal).toUpperCase());
|
||||||
|
txtTitleStatistics.setText(getResources().getString(R.string.label_title_statistics).toUpperCase());
|
||||||
PieChartData pieChartData = new PieChartData(arcValues);
|
|
||||||
pieChartData.setHasLabels(true);
|
updateLastPieChart();
|
||||||
|
updateLastLineChart(scaleDataList);
|
||||||
|
updateLastMeasurement();
|
||||||
|
updateGoal(scaleDataList);
|
||||||
|
updateStatistics(scaleDataList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateLastMeasurement() {
|
||||||
|
txtWeightLast.setText(lastScaleData.weight + " " + ScaleUser.UNIT_STRING[currentScaleUser.scale_unit]);
|
||||||
|
txtBMILast.setText(String.format("%.1f", currentScaleUser.getBMI(lastScaleData.weight)));
|
||||||
|
txtFatLast.setText(lastScaleData.fat + " %");
|
||||||
|
txtWaterLast.setText(lastScaleData.water + " %");
|
||||||
|
txtMuscleLast.setText(lastScaleData.muscle + " %");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateGoal(ArrayList<ScaleData> scaleDataList) {
|
||||||
|
txtGoalWeight.setText(currentScaleUser.goal_weight + " " + ScaleUser.UNIT_STRING[currentScaleUser.scale_unit]);
|
||||||
|
|
||||||
|
double weight_diff = currentScaleUser.goal_weight - lastScaleData.weight;
|
||||||
|
txtGoalDiff.setText(weight_diff + " " + ScaleUser.UNIT_STRING[currentScaleUser.scale_unit]);
|
||||||
|
|
||||||
|
Calendar goalDate = Calendar.getInstance();
|
||||||
|
Calendar curDate = Calendar.getInstance();
|
||||||
|
goalDate.setTime(currentScaleUser.goal_date);
|
||||||
|
|
||||||
|
long days = daysBetween(curDate, goalDate);
|
||||||
|
txtGoalDayLeft.setText(days + " " + getResources().getString(R.string.label_days));
|
||||||
|
|
||||||
|
txtLabelGoalWeight.setText(Html.fromHtml(getResources().getString(R.string.label_weight_goal) + " <br> <font color='grey'><small>BMI " + String.format("%.1f", currentScaleUser.getBMI(currentScaleUser.goal_weight)) + " </small></font>"));
|
||||||
|
txtLabelGoalDiff.setText(Html.fromHtml(getResources().getString(R.string.label_weight_difference) + " <br> <font color='grey'><small>BMI " + String.format("%.1f", currentScaleUser.getBMI(lastScaleData.weight) - currentScaleUser.getBMI(currentScaleUser.goal_weight)) + " </small></font>"));
|
||||||
|
txtLabelDayLeft.setText(Html.fromHtml(getResources().getString(R.string.label_days_left) + " <br> <font color='grey'><small>" + getResources().getString(R.string.label_goal_date_is) + " " + new SimpleDateFormat("dd. MMM yyyy (EE)").format(currentScaleUser.goal_date) + " </small></font>"));
|
||||||
|
|
||||||
|
if (scaleDataList.size() > 2) {
|
||||||
|
ScaleData diffScaleData = scaleDataList.get(1);
|
||||||
|
|
||||||
|
double diffWeight = lastScaleData.weight - diffScaleData.weight;
|
||||||
|
double diffBMI = currentScaleUser.getBMI(lastScaleData.weight) - currentScaleUser.getBMI(diffScaleData.weight);
|
||||||
|
double diffFat = lastScaleData.fat - diffScaleData.fat;
|
||||||
|
double diffMuscle = lastScaleData.muscle - diffScaleData.muscle;
|
||||||
|
double diffWater = lastScaleData.water - diffScaleData.water;
|
||||||
|
|
||||||
|
if (diffWeight > 0.0)
|
||||||
|
txtLabelWeight.setText(Html.fromHtml(getResources().getString(R.string.label_weight) + " <br> <font color='grey'>↗<small> " + String.format("%.1f ", diffWeight) + ScaleUser.UNIT_STRING[currentScaleUser.scale_unit] + "</small></font>"));
|
||||||
|
else
|
||||||
|
txtLabelWeight.setText(Html.fromHtml(getResources().getString(R.string.label_weight) + " <br> <font color='grey'>↘<small> " + String.format("%.1f ", diffWeight) + ScaleUser.UNIT_STRING[currentScaleUser.scale_unit] + "</small></font>"));
|
||||||
|
|
||||||
|
|
||||||
|
if (diffBMI > 0.0)
|
||||||
|
txtLabelBMI.setText(Html.fromHtml(getResources().getString(R.string.label_bmi) + " <br> <font color='grey'>↗<small> " + String.format("%.1f", diffBMI) + "</small></font>"));
|
||||||
|
else
|
||||||
|
txtLabelBMI.setText(Html.fromHtml(getResources().getString(R.string.label_bmi) + " <br> <font color='grey'>↘<small> " + String.format("%.1f", diffBMI) + "</small></font>"));
|
||||||
|
|
||||||
|
if (diffFat > 0.0)
|
||||||
|
txtLabelFat.setText(Html.fromHtml(getResources().getString(R.string.label_fat) + " <br> <font color='grey'>↗<small> " + String.format("%.1f", diffFat) + "%</small></font>"));
|
||||||
|
else
|
||||||
|
txtLabelFat.setText(Html.fromHtml(getResources().getString(R.string.label_fat) + " <br> <font color='grey'>↘<small> " + String.format("%.1f", diffFat) + "%</small></font>"));
|
||||||
|
|
||||||
|
if (diffMuscle > 0.0)
|
||||||
|
txtLabelMuscle.setText(Html.fromHtml(getResources().getString(R.string.label_muscle) + " <br> <font color='grey'>↗<small> " + String.format("%.1f", diffMuscle) + "%</small></font>"));
|
||||||
|
else
|
||||||
|
txtLabelMuscle.setText(Html.fromHtml(getResources().getString(R.string.label_muscle) + " <br> <font color='grey'>↘<small> " + String.format("%.1f", diffMuscle) + "%</small></font>"));
|
||||||
|
|
||||||
|
if (diffWater > 0.0)
|
||||||
|
txtLabelWater.setText(Html.fromHtml(getResources().getString(R.string.label_water) + " <br> <font color='grey'>↗<small> " + String.format("%.1f", diffWater) + "%</small></font>"));
|
||||||
|
else
|
||||||
|
txtLabelWater.setText(Html.fromHtml(getResources().getString(R.string.label_water) + " <br> <font color='grey'>↘<small> " + String.format("%.1f", diffWater) + "%</small></font>"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateStatistics(ArrayList<ScaleData> scaleDataList) {
|
||||||
|
Calendar histDate = Calendar.getInstance();
|
||||||
|
Calendar weekPastDate = Calendar.getInstance();
|
||||||
|
Calendar monthPastDate = Calendar.getInstance();
|
||||||
|
|
||||||
|
weekPastDate.setTime(lastScaleData.date_time);
|
||||||
|
weekPastDate.add(Calendar.DATE, -7);
|
||||||
|
|
||||||
|
monthPastDate.setTime(lastScaleData.date_time);
|
||||||
|
monthPastDate.add(Calendar.DATE, -30);
|
||||||
|
|
||||||
|
int weekSize = 0;
|
||||||
|
float weekAvgWeight = 0;
|
||||||
|
float weekAvgBMI = 0;
|
||||||
|
float weekAvgFat = 0;
|
||||||
|
float weekAvgWater = 0;
|
||||||
|
float weekAvgMuscle = 0;
|
||||||
|
|
||||||
|
int monthSize = 0;
|
||||||
|
float monthAvgWeight = 0;
|
||||||
|
float monthAvgBMI = 0;
|
||||||
|
float monthAvgFat = 0;
|
||||||
|
float monthAvgWater = 0;
|
||||||
|
float monthAvgMuscle = 0;
|
||||||
|
|
||||||
|
for (ScaleData scaleData : scaleDataList)
|
||||||
|
{
|
||||||
|
histDate.setTime(scaleData.date_time);
|
||||||
|
|
||||||
|
if (weekPastDate.before(histDate)) {
|
||||||
|
weekSize++;
|
||||||
|
|
||||||
|
weekAvgWeight += scaleData.weight;
|
||||||
|
weekAvgBMI += currentScaleUser.getBMI(scaleData.weight);
|
||||||
|
weekAvgFat += scaleData.fat;
|
||||||
|
weekAvgWater += scaleData.water;
|
||||||
|
weekAvgMuscle += scaleData.muscle;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (monthPastDate.before(histDate)) {
|
||||||
|
monthSize++;
|
||||||
|
|
||||||
|
monthAvgWeight += scaleData.weight;
|
||||||
|
monthAvgBMI += currentScaleUser.getBMI(scaleData.weight);
|
||||||
|
monthAvgFat += scaleData.fat;
|
||||||
|
monthAvgWater += scaleData.water;
|
||||||
|
monthAvgMuscle += scaleData.muscle;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
weekAvgWeight /= weekSize;
|
||||||
|
weekAvgBMI /= weekSize;
|
||||||
|
weekAvgFat /= weekSize;
|
||||||
|
weekAvgWater /= weekSize;
|
||||||
|
weekAvgMuscle /= weekSize;
|
||||||
|
|
||||||
|
monthAvgWeight /= monthSize;
|
||||||
|
monthAvgBMI /= monthSize;
|
||||||
|
monthAvgFat /= monthSize;
|
||||||
|
monthAvgWater /= monthSize;
|
||||||
|
monthAvgMuscle /= monthSize;
|
||||||
|
|
||||||
|
txtLabelAvgWeek.setText(Html.fromHtml(getResources().getString(R.string.label_last_week) + " <br> <font color='grey'><small> " + String.format("[Ø-"+getResources().getString(R.string.label_weight)+": %.1f" + ScaleUser.UNIT_STRING[currentScaleUser.scale_unit] + "] [Ø-"+getResources().getString(R.string.label_bmi)+": %.1f] [Ø-"+getResources().getString(R.string.label_fat)+": %.1f%%] [Ø-"+getResources().getString(R.string.label_muscle)+": %.1f%%] [Ø-"+getResources().getString(R.string.label_water)+": %.1f%%]", weekAvgWeight, weekAvgBMI, weekAvgFat, weekAvgMuscle, weekAvgWater) + "</small></font>"));
|
||||||
|
txtLabelAvgMonth.setText(Html.fromHtml(getResources().getString(R.string.label_last_month) + " <br> <font color='grey'><small> " + String.format("[Ø-"+getResources().getString(R.string.label_weight)+": %.1f" + ScaleUser.UNIT_STRING[currentScaleUser.scale_unit] + "] [Ø-"+getResources().getString(R.string.label_bmi)+": %.1f] [Ø-"+getResources().getString(R.string.label_fat)+": %.1f%%] [Ø-"+getResources().getString(R.string.label_muscle)+": %.1f%%] [Ø-"+getResources().getString(R.string.label_water)+": %.1f%%]", monthAvgWeight, monthAvgBMI, monthAvgFat, monthAvgMuscle, monthAvgWater) + "</small></font>"));
|
||||||
|
|
||||||
|
txtAvgWeek.setText(weekSize + " " + getResources().getString(R.string.label_measures));
|
||||||
|
txtAvgMonth.setText(monthSize + " " + getResources().getString(R.string.label_measures));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateLastLineChart(ArrayList<ScaleData> scaleDataList) {
|
||||||
|
List<AxisValue> axisValues = new ArrayList<AxisValue>();
|
||||||
|
|
||||||
|
List<PointValue> valuesWeight = new ArrayList<PointValue>();
|
||||||
|
List<PointValue> valuesFat = new ArrayList<PointValue>();
|
||||||
|
List<PointValue> valuesWater = new ArrayList<PointValue>();
|
||||||
|
List<PointValue> valuesMuscle = new ArrayList<PointValue>();
|
||||||
|
List<Line> lines = new ArrayList<Line>();
|
||||||
|
|
||||||
|
int max_i = 7;
|
||||||
|
|
||||||
|
if (scaleDataList.size() < 7) {
|
||||||
|
max_i = scaleDataList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
Calendar histDate = Calendar.getInstance();
|
||||||
|
Calendar lastDate = Calendar.getInstance();
|
||||||
|
|
||||||
|
lastDate.setTime(scaleDataList.get(0).date_time);
|
||||||
|
|
||||||
|
for (int i=0; i<max_i; i++) {
|
||||||
|
ScaleData histData = scaleDataList.get(max_i - i - 1);
|
||||||
|
|
||||||
|
valuesWeight.add(new PointValue(i, histData.weight));
|
||||||
|
valuesFat.add(new PointValue(i, histData.fat));
|
||||||
|
valuesWater.add(new PointValue(i, histData.water));
|
||||||
|
valuesMuscle.add(new PointValue(i, histData.muscle));
|
||||||
|
|
||||||
|
histDate.setTime(histData.date_time);
|
||||||
|
|
||||||
|
long days = 0 - daysBetween(lastDate, histDate);
|
||||||
|
|
||||||
|
if (days == 0) {
|
||||||
|
axisValues.add(new AxisValue(i, new SimpleDateFormat("dd/MM/yy").format(lastScaleData.date_time).toCharArray()));
|
||||||
|
} else {
|
||||||
|
axisValues.add(new AxisValue(i, String.format("%d days", days).toCharArray()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Line lineWeight = new Line(valuesWeight).
|
||||||
|
setColor(Utils.COLOR_VIOLET).
|
||||||
|
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
||||||
|
setFormatter(new SimpleValueFormatter(1, false, null, null));
|
||||||
|
Line lineFat = new Line(valuesFat).
|
||||||
|
setColor(Utils.COLOR_ORANGE).
|
||||||
|
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
||||||
|
setFormatter(new SimpleValueFormatter(1, false, null, null));
|
||||||
|
Line lineWater = new Line(valuesWater).
|
||||||
|
setColor(Utils.COLOR_BLUE).
|
||||||
|
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
||||||
|
setFormatter(new SimpleValueFormatter(1, false, null, null));
|
||||||
|
Line lineMuscle = new Line(valuesMuscle).
|
||||||
|
setColor(Utils.COLOR_GREEN).
|
||||||
|
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
||||||
|
setFormatter(new SimpleValueFormatter(1, false, null, null));
|
||||||
|
|
||||||
|
if(prefs.getBoolean("weightEnable", true)) {
|
||||||
|
lines.add(lineWeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(prefs.getBoolean("fatEnable", true)) {
|
||||||
|
lines.add(lineFat);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(prefs.getBoolean("waterEnable", true)) {
|
||||||
|
lines.add(lineWater);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(prefs.getBoolean("muscleEnable", true)) {
|
||||||
|
lines.add(lineMuscle);
|
||||||
|
}
|
||||||
|
|
||||||
|
LineChartData lineData = new LineChartData(lines);
|
||||||
|
lineData.setAxisXBottom(new Axis(axisValues).
|
||||||
|
setHasLines(true).
|
||||||
|
setTextColor(Color.BLACK)
|
||||||
|
);
|
||||||
|
|
||||||
|
lineData.setAxisYLeft(new Axis().
|
||||||
|
setHasLines(true).
|
||||||
|
setMaxLabelChars(3).
|
||||||
|
setTextColor(Color.BLACK)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
lineChartLast.setLineChartData(lineData);
|
||||||
|
lineChartLast.setViewportCalculationEnabled(true);
|
||||||
|
|
||||||
|
lineChartLast.setZoomEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateLastPieChart() {
|
||||||
|
|
||||||
|
List<ArcValue> arcValuesLast = new ArrayList<ArcValue>();
|
||||||
|
|
||||||
|
arcValuesLast.add(new ArcValue(lastScaleData.fat, Utils.COLOR_ORANGE));
|
||||||
|
arcValuesLast.add(new ArcValue(lastScaleData.water, Utils.COLOR_BLUE));
|
||||||
|
arcValuesLast.add(new ArcValue(lastScaleData.muscle, Utils.COLOR_GREEN));
|
||||||
|
|
||||||
|
PieChartData pieChartData = new PieChartData(arcValuesLast);
|
||||||
|
pieChartData.setHasLabels(false);
|
||||||
pieChartData.setFormatter(new SimpleValueFormatter(1, false, null, " %".toCharArray()));
|
pieChartData.setFormatter(new SimpleValueFormatter(1, false, null, " %".toCharArray()));
|
||||||
pieChartData.setHasCenterCircle(true);
|
pieChartData.setHasCenterCircle(true);
|
||||||
pieChartData.setCenterText1(Float.toString(lastScaleData.weight) + " " + ScaleUser.UNIT_STRING[scaleUser.scale_unit]);
|
pieChartData.setCenterText1(Float.toString(lastScaleData.weight) + " " + ScaleUser.UNIT_STRING[currentScaleUser.scale_unit]);
|
||||||
pieChartData.setCenterText2(new SimpleDateFormat("dd. MMM yyyy (EE)").format(lastScaleData.date_time));
|
pieChartData.setCenterText2(new SimpleDateFormat("dd. MMM yyyy").format(lastScaleData.date_time));
|
||||||
|
|
||||||
|
|
||||||
if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE ||
|
if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE ||
|
||||||
(getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
|
(getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
|
||||||
pieChartData.setCenterText1FontSize(33);
|
pieChartData.setCenterText1FontSize(25);
|
||||||
pieChartData.setCenterText2FontSize(14);
|
pieChartData.setCenterText2FontSize(14);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
pieChartData.setCenterText1FontSize(12);
|
pieChartData.setCenterText1FontSize(10);
|
||||||
pieChartData.setCenterText2FontSize(8);
|
pieChartData.setCenterText2FontSize(8);
|
||||||
pieChartData.setValueLabelTextSize(8);
|
pieChartData.setValueLabelTextSize(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
pieChart.setPieChartData(pieChartData);
|
pieChartLast.setPieChartData(pieChartData);
|
||||||
|
}
|
||||||
double avgWeight = 0;
|
|
||||||
double avgFat = 0;
|
private long daysBetween(Calendar startDate, Calendar endDate) {
|
||||||
double avgWater = 0;
|
long end = endDate.getTimeInMillis();
|
||||||
double avgMuscle = 0;
|
long start = startDate.getTimeInMillis();
|
||||||
|
return TimeUnit.MILLISECONDS.toDays(Math.abs(end - start));
|
||||||
for (ScaleData scaleData : scaleDataList)
|
}
|
||||||
{
|
|
||||||
avgWeight += scaleData.weight;
|
|
||||||
avgFat += scaleData.fat;
|
|
||||||
avgWater += scaleData.water;
|
|
||||||
avgMuscle += scaleData.muscle;
|
|
||||||
}
|
|
||||||
|
|
||||||
avgWeight = avgWeight / scaleDataList.size();
|
|
||||||
avgFat = avgFat / scaleDataList.size();
|
|
||||||
avgWater = avgWater / scaleDataList.size();
|
|
||||||
avgMuscle = avgMuscle / scaleDataList.size();
|
|
||||||
|
|
||||||
txtAvgWeight.setText(String.format( "%.1f " + ScaleUser.UNIT_STRING[scaleUser.scale_unit], avgWeight));
|
|
||||||
txtAvgFat.setText(String.format( "%.1f %%", avgFat));
|
|
||||||
txtAvgWater.setText(String.format( "%.1f %%", avgWater));
|
|
||||||
txtAvgMuscle.setText(String.format( "%.1f %%", avgMuscle));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void btnOnClickInsertData()
|
public void btnOnClickInsertData()
|
||||||
{
|
{
|
||||||
@@ -150,7 +442,7 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
|||||||
startActivityForResult(intent, 1);
|
startActivityForResult(intent, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PieChartTouchListener implements PieChartView.PieChartOnValueTouchListener
|
private class PieChartLastTouchListener implements PieChartView.PieChartOnValueTouchListener
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onValueTouched(int i, ArcValue arcValue)
|
public void onValueTouched(int i, ArcValue arcValue)
|
||||||
|
@@ -18,6 +18,7 @@ package com.health.openscale.gui;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
@@ -154,6 +155,7 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
deleteButton.setOnClickListener(new onClickListenerDelete());
|
deleteButton.setOnClickListener(new onClickListenerDelete());
|
||||||
dataRow.addView(deleteButton);
|
dataRow.addView(deleteButton);
|
||||||
|
|
||||||
|
dataRow.setOnClickListener(new onClickListenerRow());
|
||||||
|
|
||||||
if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_XLARGE &&
|
if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_XLARGE &&
|
||||||
(getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_LARGE)
|
(getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_LARGE)
|
||||||
@@ -170,6 +172,20 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class onClickListenerRow implements View.OnClickListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
TableRow dataRow = (TableRow)v;
|
||||||
|
TextView idTextView = (TextView) dataRow.getChildAt(0);
|
||||||
|
long id = Long.parseLong(idTextView.getText().toString());
|
||||||
|
|
||||||
|
Intent intent = new Intent(tableView.getContext(), EditDataActivity.class);
|
||||||
|
intent.putExtra("id", id);
|
||||||
|
startActivityForResult(intent, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class onClickListenerImport implements View.OnClickListener {
|
private class onClickListenerImport implements View.OnClickListener {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@@ -47,14 +47,18 @@ public class UserSettingsActivity extends Activity {
|
|||||||
private EditText txtUserName;
|
private EditText txtUserName;
|
||||||
private EditText txtBodyHeight;
|
private EditText txtBodyHeight;
|
||||||
private EditText txtBirthday;
|
private EditText txtBirthday;
|
||||||
|
private EditText txtGoalWeight;
|
||||||
|
private EditText txtGoalDate;
|
||||||
private RadioGroup radioScaleUnit;
|
private RadioGroup radioScaleUnit;
|
||||||
|
private RadioGroup radioGender;
|
||||||
|
|
||||||
private Button btnBirthdaySet;
|
private Button btnBirthdaySet;
|
||||||
|
private Button btnGoalDateSet;
|
||||||
private Button btnOk;
|
private Button btnOk;
|
||||||
private Button btnCancel;
|
private Button btnCancel;
|
||||||
private Button btnDelete;
|
private Button btnDelete;
|
||||||
|
|
||||||
private SimpleDateFormat birthdayFormat = new SimpleDateFormat("dd.MM.yyyy");
|
private SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
||||||
|
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
@@ -67,10 +71,14 @@ public class UserSettingsActivity extends Activity {
|
|||||||
txtUserName = (EditText) findViewById(R.id.txtUserName);
|
txtUserName = (EditText) findViewById(R.id.txtUserName);
|
||||||
txtBodyHeight = (EditText) findViewById(R.id.txtBodyHeight);
|
txtBodyHeight = (EditText) findViewById(R.id.txtBodyHeight);
|
||||||
radioScaleUnit = (RadioGroup) findViewById(R.id.groupScaleUnit);
|
radioScaleUnit = (RadioGroup) findViewById(R.id.groupScaleUnit);
|
||||||
|
radioGender = (RadioGroup) findViewById(R.id.groupGender);
|
||||||
|
txtGoalWeight = (EditText) findViewById(R.id.txtGoalWeight);
|
||||||
|
|
||||||
txtBirthday = (EditText) findViewById(R.id.txtBirthday);
|
txtBirthday = (EditText) findViewById(R.id.txtBirthday);
|
||||||
|
txtGoalDate = (EditText) findViewById(R.id.txtGoalDate);
|
||||||
|
|
||||||
btnBirthdaySet = (Button) findViewById(R.id.btnDateSet);
|
btnBirthdaySet = (Button) findViewById(R.id.btnDateSet);
|
||||||
|
btnGoalDateSet = (Button) findViewById(R.id.btnGoalDateSet);
|
||||||
btnDelete = (Button) findViewById(R.id.btnDelete);
|
btnDelete = (Button) findViewById(R.id.btnDelete);
|
||||||
btnOk = (Button)findViewById(R.id.btnOk);
|
btnOk = (Button)findViewById(R.id.btnOk);
|
||||||
btnCancel = (Button)findViewById(R.id.btnCancel);
|
btnCancel = (Button)findViewById(R.id.btnCancel);
|
||||||
@@ -79,8 +87,11 @@ public class UserSettingsActivity extends Activity {
|
|||||||
btnCancel.setOnClickListener(new onClickListenerCancel());
|
btnCancel.setOnClickListener(new onClickListenerCancel());
|
||||||
btnDelete.setOnClickListener(new onClickListenerDelete());
|
btnDelete.setOnClickListener(new onClickListenerDelete());
|
||||||
btnBirthdaySet.setOnClickListener(new onClickListenerBirthdaySet());
|
btnBirthdaySet.setOnClickListener(new onClickListenerBirthdaySet());
|
||||||
|
btnGoalDateSet.setOnClickListener(new onClickListenerGoalDateSet());
|
||||||
|
|
||||||
txtBirthday.setText(birthdayFormat.format(new Date()));
|
txtBirthday.setText(dateFormat.format(new Date()));
|
||||||
|
|
||||||
|
txtGoalDate.setText(dateFormat.format(new Date()));
|
||||||
|
|
||||||
if (getIntent().getExtras().getInt("mode") == EDIT_USER_REQUEST)
|
if (getIntent().getExtras().getInt("mode") == EDIT_USER_REQUEST)
|
||||||
{
|
{
|
||||||
@@ -102,9 +113,11 @@ public class UserSettingsActivity extends Activity {
|
|||||||
|
|
||||||
txtUserName.setText(scaleUser.user_name);
|
txtUserName.setText(scaleUser.user_name);
|
||||||
txtBodyHeight.setText(Integer.toString(scaleUser.body_height));
|
txtBodyHeight.setText(Integer.toString(scaleUser.body_height));
|
||||||
txtBirthday.setText(birthdayFormat.format(scaleUser.birthday));
|
txtBirthday.setText(dateFormat.format(scaleUser.birthday));
|
||||||
|
txtGoalDate.setText(dateFormat.format(scaleUser.goal_date));
|
||||||
|
txtGoalWeight.setText(scaleUser.goal_weight+"");
|
||||||
|
|
||||||
switch (scaleUser.scale_unit)
|
switch (scaleUser.scale_unit)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
radioScaleUnit.check(R.id.btnRadioKG);
|
radioScaleUnit.check(R.id.btnRadioKG);
|
||||||
@@ -116,6 +129,16 @@ public class UserSettingsActivity extends Activity {
|
|||||||
radioScaleUnit.check(R.id.btnRadioST);
|
radioScaleUnit.check(R.id.btnRadioST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (scaleUser.gender)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
radioGender.check(R.id.btnRadioMale);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
radioGender.check(R.id.btnRadioWoman);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean validateInput()
|
private boolean validateInput()
|
||||||
@@ -144,6 +167,13 @@ public class UserSettingsActivity extends Activity {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private DatePickerDialog.OnDateSetListener goalDatePickerListener = new DatePickerDialog.OnDateSetListener() {
|
||||||
|
@Override
|
||||||
|
public void onDateSet(DatePicker view, int selectedYear, int selectedMonth, int selectedDay) {
|
||||||
|
txtGoalDate.setText(String.format("%02d.%02d.%04d", selectedDay, selectedMonth + 1, selectedYear));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private class onClickListenerDelete implements View.OnClickListener {
|
private class onClickListenerDelete implements View.OnClickListener {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@@ -197,6 +227,8 @@ public class UserSettingsActivity extends Activity {
|
|||||||
String name = txtUserName.getText().toString();
|
String name = txtUserName.getText().toString();
|
||||||
int body_height = Integer.valueOf(txtBodyHeight.getText().toString());
|
int body_height = Integer.valueOf(txtBodyHeight.getText().toString());
|
||||||
int checkedRadioButtonId = radioScaleUnit.getCheckedRadioButtonId();
|
int checkedRadioButtonId = radioScaleUnit.getCheckedRadioButtonId();
|
||||||
|
int checkedGenderId = radioGender.getCheckedRadioButtonId();
|
||||||
|
double goal_weight = Double.valueOf(txtGoalWeight.getText().toString());
|
||||||
|
|
||||||
int scale_unit = -1;
|
int scale_unit = -1;
|
||||||
|
|
||||||
@@ -212,17 +244,29 @@ public class UserSettingsActivity extends Activity {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int gender = -1;
|
||||||
|
|
||||||
|
switch (checkedGenderId) {
|
||||||
|
case R.id.btnRadioMale:
|
||||||
|
gender = 0;
|
||||||
|
break;
|
||||||
|
case R.id.btnRadioWoman:
|
||||||
|
gender = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
String date = txtBirthday.getText().toString();
|
String date = txtBirthday.getText().toString();
|
||||||
|
String goal_date = txtGoalDate.getText().toString();
|
||||||
|
|
||||||
int id = -1;
|
int id = -1;
|
||||||
|
|
||||||
if (getIntent().getExtras().getInt("mode") == EDIT_USER_REQUEST)
|
if (getIntent().getExtras().getInt("mode") == EDIT_USER_REQUEST)
|
||||||
{
|
{
|
||||||
id = getIntent().getExtras().getInt("id");
|
id = getIntent().getExtras().getInt("id");
|
||||||
openScale.updateScaleUser(id, name, date, body_height, scale_unit);
|
openScale.updateScaleUser(id, name, date, body_height, scale_unit, gender, goal_weight, goal_date);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
openScale.addScaleUser(name, date, body_height, scale_unit);
|
openScale.addScaleUser(name, date, body_height, scale_unit, gender, goal_weight, goal_date);
|
||||||
|
|
||||||
id = openScale.getScaleUserList().get(0).id;
|
id = openScale.getScaleUserList().get(0).id;
|
||||||
}
|
}
|
||||||
@@ -247,6 +291,16 @@ public class UserSettingsActivity extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private class onClickListenerGoalDateSet implements View.OnClickListener {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
DatePickerDialog datePicker = new DatePickerDialog(context, goalDatePickerListener, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
|
||||||
|
datePicker.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class onClickListenerCancel implements View.OnClickListener {
|
private class onClickListenerCancel implements View.OnClickListener {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
BIN
android_app/app/src/main/res/drawable/bmi.png
Normal file
BIN
android_app/app/src/main/res/drawable/bmi.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
android_app/app/src/main/res/drawable/lastmonth.png
Normal file
BIN
android_app/app/src/main/res/drawable/lastmonth.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
android_app/app/src/main/res/drawable/lastweek.png
Normal file
BIN
android_app/app/src/main/res/drawable/lastweek.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
BIN
android_app/app/src/main/res/drawable/muscle.png
Normal file
BIN
android_app/app/src/main/res/drawable/muscle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
android_app/app/src/main/res/drawable/water.png
Normal file
BIN
android_app/app/src/main/res/drawable/water.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
@@ -64,6 +64,41 @@
|
|||||||
android:id="@+id/textView3"
|
android:id="@+id/textView3"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_gender" />
|
||||||
|
|
||||||
|
<RadioGroup
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_column="1"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:id="@+id/groupGender">
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_male"
|
||||||
|
android:id="@+id/btnRadioMale"
|
||||||
|
android:checked="true" />
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_woman"
|
||||||
|
android:id="@+id/btnRadioWoman" />
|
||||||
|
|
||||||
|
</RadioGroup>
|
||||||
|
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:id="@+id/tableRow4"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView4"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/label_scale_unit" />
|
android:text="@string/label_scale_unit" />
|
||||||
|
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
@@ -124,9 +159,58 @@
|
|||||||
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:id="@+id/tableRow6"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_goal_weight" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txtGoalWeight"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="10"
|
||||||
|
android:hint="@string/info_enter_goal_weight"
|
||||||
|
android:inputType="numberDecimal|numberSigned" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:id="@+id/tableRow7"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView7"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_goal_date" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txtGoalDate"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="5"
|
||||||
|
android:ems="10"
|
||||||
|
android:enabled="false"
|
||||||
|
android:inputType="date" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnGoalDateSet"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/label_set"
|
||||||
|
android:textSize="15sp" />
|
||||||
|
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content" >
|
||||||
<Button
|
<Button
|
||||||
|
@@ -1,131 +1,535 @@
|
|||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:orientation="vertical"
|
||||||
android:layout_height="match_parent"
|
android:layout_width="fill_parent"
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
android:layout_height="fill_parent"
|
||||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
android:layout_alignParentBottom="true"
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
android:layout_alignParentLeft="true"
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:layout_alignParentStart="true"
|
||||||
tools:context="com.health.openscale.MainActivity$PlaceholderFragment" >
|
tools:context="com.health.openscale.MainActivity$PlaceholderFragment"
|
||||||
|
android:weightSum="100"
|
||||||
|
android:padding="10dp">
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:weightSum="100">
|
|
||||||
|
|
||||||
<TextView
|
<ScrollView
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="fill_parent"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:id="@+id/scrollView"
|
||||||
android:id="@+id/txtOverviewTitle"
|
android:layout_weight="100">
|
||||||
android:gravity="center" />
|
|
||||||
|
|
||||||
<lecho.lib.hellocharts.view.PieChartView
|
<LinearLayout
|
||||||
android:id="@+id/pieChart"
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="USER"
|
||||||
|
android:id="@+id/txtTitleUser"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:textSize="20dp" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@android:color/darker_gray"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:weightSum="100">
|
||||||
|
|
||||||
|
<lecho.lib.hellocharts.view.PieChartView
|
||||||
|
android:id="@+id/pieChartLast"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_height="200dp"
|
||||||
|
android:measureWithLargestChild="false"
|
||||||
|
android:layout_weight="30" />
|
||||||
|
|
||||||
|
<lecho.lib.hellocharts.view.LineChartView
|
||||||
|
android:id="@+id/lineChartLast"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="top|center"
|
android:layout_weight="70" />
|
||||||
android:layout_weight="50" />
|
|
||||||
|
|
||||||
<TableLayout
|
</LinearLayout>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:layout_weight="40">
|
|
||||||
|
|
||||||
<TableRow
|
<TextView
|
||||||
android:id="@+id/tableRow1"
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="LAST MEASUREMENT"
|
||||||
|
android:id="@+id/txtTitleLastMeasurment"
|
||||||
|
android:autoText="false"
|
||||||
|
android:textSize="20dp"
|
||||||
|
android:typeface="monospace" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@android:color/darker_gray"/>
|
||||||
|
|
||||||
|
<TableLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_weight="90"
|
||||||
|
android:stretchColumns="1">
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginBottom="10dp" >
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:id="@+id/imageView11"
|
||||||
|
android:src="@drawable/weight"
|
||||||
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="10dp"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:weightSum="100">
|
android:text="Weight"
|
||||||
|
android:id="@+id/txtLabelWeight"
|
||||||
|
android:layout_column="1"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:singleLine="false"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:password="false"
|
||||||
|
android:phoneNumber="false"
|
||||||
|
android:lines="2"
|
||||||
|
android:layout_marginRight="50dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="25"
|
|
||||||
android:text="@string/label_weight_average"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/txtAvgWeight"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="25"
|
|
||||||
android:text="0" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="25"
|
|
||||||
android:text="@string/label_fat_average"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/txtAvgFat"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="25"
|
|
||||||
android:text="0" />
|
|
||||||
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow
|
|
||||||
android:id="@+id/tableRow2"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="10dp"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:weightSum="100">
|
android:text="-1kg"
|
||||||
|
android:id="@+id/txtWeightLast"
|
||||||
|
android:layout_column="2"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginRight="20dp" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
<TextView
|
<TableRow
|
||||||
android:layout_width="0dp"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="fill_parent"
|
||||||
android:layout_weight="25"
|
android:orientation="horizontal"
|
||||||
android:text="@string/label_water_average"
|
android:layout_marginBottom="10dp">
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
<ImageView
|
||||||
android:id="@+id/txtAvgWater"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="0dp"
|
android:layout_height="40dp"
|
||||||
android:layout_height="wrap_content"
|
android:id="@+id/imageView"
|
||||||
android:layout_weight="25"
|
android:src="@drawable/bmi"
|
||||||
android:text="0" />
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="25"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:text="@string/label_muscle_average"
|
android:text="BMI"
|
||||||
android:textStyle="bold" />
|
android:id="@+id/txtLabelBMI"
|
||||||
|
android:layout_column="1"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:singleLine="false"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:password="false"
|
||||||
|
android:phoneNumber="false"
|
||||||
|
android:lines="2"
|
||||||
|
android:layout_marginRight="50dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/txtAvgMuscle"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="0dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:layout_weight="25"
|
android:text="-1"
|
||||||
android:text="0" />
|
android:id="@+id/txtBMILast"
|
||||||
|
android:layout_column="2"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginRight="20dp" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
</TableRow>
|
<TableRow
|
||||||
</TableLayout>
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:id="@+id/tableRow"
|
||||||
|
android:layout_marginBottom="10dp">
|
||||||
|
|
||||||
<LinearLayout
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dip"
|
android:layout_height="40dp"
|
||||||
android:layout_weight="10"
|
android:id="@+id/imageView2"
|
||||||
android:gravity="center|bottom"
|
android:src="@drawable/fat"
|
||||||
android:orientation="vertical" >
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnInsertData"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@drawable/flat_selector"
|
|
||||||
android:text="+"
|
|
||||||
android:textColor="@android:color/white" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:text="Fat"
|
||||||
|
android:id="@+id/txtLabelFat"
|
||||||
|
android:layout_column="1"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:singleLine="false"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:password="false"
|
||||||
|
android:phoneNumber="false"
|
||||||
|
android:lines="2"
|
||||||
|
android:layout_marginRight="50dp" />
|
||||||
|
|
||||||
</LinearLayout>
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:text="-1 %"
|
||||||
|
android:id="@+id/txtFatLast"
|
||||||
|
android:layout_column="2"
|
||||||
|
android:layout_gravity="center_vertical" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
</RelativeLayout>
|
<TableRow
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:id="@+id/tableRow7"
|
||||||
|
android:layout_marginBottom="10dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:id="@+id/imageView3"
|
||||||
|
android:src="@drawable/muscle"
|
||||||
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:text="Muscle"
|
||||||
|
android:id="@+id/txtLabelMuscle"
|
||||||
|
android:layout_column="1"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:singleLine="false"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:password="false"
|
||||||
|
android:phoneNumber="false"
|
||||||
|
android:lines="2"
|
||||||
|
android:layout_marginRight="50dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:text="-1 %"
|
||||||
|
android:id="@+id/txtMuscleLast"
|
||||||
|
android:layout_column="2"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginRight="20dp" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:id="@+id/tableRow8"
|
||||||
|
android:layout_marginBottom="10dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:id="@+id/imageView4"
|
||||||
|
android:src="@drawable/water"
|
||||||
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:text="Water"
|
||||||
|
android:id="@+id/txtLabelWater"
|
||||||
|
android:layout_column="1"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:singleLine="false"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:password="false"
|
||||||
|
android:phoneNumber="false"
|
||||||
|
android:lines="2"
|
||||||
|
android:layout_marginRight="50dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:text="-1 %"
|
||||||
|
android:id="@+id/txtWaterLast"
|
||||||
|
android:layout_column="2"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginRight="20dp" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
</TableLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="GOAL"
|
||||||
|
android:id="@+id/txtTitleGoal"
|
||||||
|
android:autoText="false"
|
||||||
|
android:textSize="20dp"
|
||||||
|
android:typeface="monospace"
|
||||||
|
android:layout_marginTop="20dp" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@android:color/darker_gray"/>
|
||||||
|
|
||||||
|
<TableLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_weight="90"
|
||||||
|
android:stretchColumns="1">
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginBottom="10dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:id="@+id/imageView5"
|
||||||
|
android:src="@drawable/target"
|
||||||
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:text="Target weight"
|
||||||
|
android:id="@+id/txtLabelGoalWeight"
|
||||||
|
android:layout_column="1"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:singleLine="false"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:password="false"
|
||||||
|
android:phoneNumber="false"
|
||||||
|
android:lines="2"
|
||||||
|
android:layout_marginRight="50dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:text="-1 kg"
|
||||||
|
android:id="@+id/txtGoalWeight"
|
||||||
|
android:layout_column="2"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginRight="20dp" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:id="@+id/tableRow9"
|
||||||
|
android:layout_marginBottom="10dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:id="@+id/imageView6"
|
||||||
|
android:src="@drawable/difference"
|
||||||
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:text="Weight difference"
|
||||||
|
android:id="@+id/txtLabelGoalDiff"
|
||||||
|
android:layout_column="1"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:singleLine="false"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:password="false"
|
||||||
|
android:phoneNumber="false"
|
||||||
|
android:lines="2"
|
||||||
|
android:layout_marginRight="50dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:text="-1 kg"
|
||||||
|
android:id="@+id/txtGoalDiff"
|
||||||
|
android:layout_column="2"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginRight="20dp" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:id="@+id/tableRow10"
|
||||||
|
android:layout_marginBottom="10dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:id="@+id/imageView7"
|
||||||
|
android:src="@drawable/daysleft"
|
||||||
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:text="Days left"
|
||||||
|
android:id="@+id/txtLabelDayLeft"
|
||||||
|
android:layout_column="1"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:singleLine="false"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:password="false"
|
||||||
|
android:phoneNumber="false"
|
||||||
|
android:lines="2"
|
||||||
|
android:layout_marginRight="50dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:text="-1 days"
|
||||||
|
android:id="@+id/txtGoalDayLeft"
|
||||||
|
android:layout_column="2"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginRight="20dp" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
</TableLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="STATISTICS"
|
||||||
|
android:id="@+id/txtTitleStatistics"
|
||||||
|
android:autoText="false"
|
||||||
|
android:textSize="20dp"
|
||||||
|
android:typeface="monospace"
|
||||||
|
android:layout_marginTop="20dp" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@android:color/darker_gray"/>
|
||||||
|
|
||||||
|
<TableLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_weight="90"
|
||||||
|
android:stretchColumns="1">
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginBottom="10dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:id="@+id/imageView8"
|
||||||
|
android:src="@drawable/lastweek"
|
||||||
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:text="Last 7 days"
|
||||||
|
android:id="@+id/txtLabelAvgWeek"
|
||||||
|
android:layout_column="1"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:singleLine="false"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:password="false"
|
||||||
|
android:phoneNumber="false"
|
||||||
|
android:lines="2"
|
||||||
|
android:layout_marginRight="50dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:text="-1"
|
||||||
|
android:id="@+id/txtAvgWeek"
|
||||||
|
android:layout_column="2"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginRight="20dp" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
<TableRow
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:id="@+id/tableRow11"
|
||||||
|
android:layout_marginBottom="10dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:id="@+id/imageView9"
|
||||||
|
android:src="@drawable/lastmonth"
|
||||||
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:text="Last 30 days"
|
||||||
|
android:id="@+id/txtLabelAvgMonth"
|
||||||
|
android:layout_column="1"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:singleLine="false"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:password="false"
|
||||||
|
android:phoneNumber="false"
|
||||||
|
android:lines="2"
|
||||||
|
android:layout_marginRight="50dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:text="-1"
|
||||||
|
android:id="@+id/txtAvgMonth"
|
||||||
|
android:layout_column="2"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:layout_marginRight="20dp" />
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
</TableLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnInsertData"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/flat_selector"
|
||||||
|
android:text="+"
|
||||||
|
android:textColor="@android:color/white" />
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
@@ -6,7 +6,8 @@
|
|||||||
<string name="title_graph">Chart</string>
|
<string name="title_graph">Chart</string>
|
||||||
<string name="title_frag">Table</string>
|
<string name="title_frag">Table</string>
|
||||||
<string name="title_user">User</string>
|
<string name="title_user">User</string>
|
||||||
<string name="title_new_data_entry">Data Entry</string>
|
<string name="title_new_data_entry">Data entry</string>
|
||||||
|
<string name="title_edit_data_entry">Edit data entry</string>
|
||||||
|
|
||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
|
|
||||||
@@ -19,10 +20,20 @@
|
|||||||
|
|
||||||
<string name="label_id">Id</string>
|
<string name="label_id">Id</string>
|
||||||
<string name="label_weight">Weight</string>
|
<string name="label_weight">Weight</string>
|
||||||
|
<string name="label_bmi">BMI</string>
|
||||||
<string name="label_fat">Fat</string>
|
<string name="label_fat">Fat</string>
|
||||||
<string name="label_water">Water</string>
|
<string name="label_water">Water</string>
|
||||||
<string name="label_muscle">Muscle</string>
|
<string name="label_muscle">Muscle</string>
|
||||||
|
|
||||||
|
<string name="label_days">days</string>
|
||||||
|
<string name="label_measures">measures</string>
|
||||||
|
<string name="label_last_week">Last 7 days</string>
|
||||||
|
<string name="label_last_month">Last 30 days</string>
|
||||||
|
<string name="label_weight_goal">Weight goal</string>
|
||||||
|
<string name="label_weight_difference">Weight difference</string>
|
||||||
|
<string name="label_goal_date_is">Goal date is</string>
|
||||||
|
<string name="label_days_left">Days left</string>
|
||||||
|
|
||||||
<string name="label_date">Date</string>
|
<string name="label_date">Date</string>
|
||||||
<string name="label_time">Time</string>
|
<string name="label_time">Time</string>
|
||||||
<string name="label_set">Set</string>
|
<string name="label_set">Set</string>
|
||||||
@@ -30,13 +41,17 @@
|
|||||||
<string name="label_user_name">Name</string>
|
<string name="label_user_name">Name</string>
|
||||||
<string name="label_body_height">Body height</string>
|
<string name="label_body_height">Body height</string>
|
||||||
<string name="label_scale_unit">Scale unit</string>
|
<string name="label_scale_unit">Scale unit</string>
|
||||||
|
<string name="label_gender">Gender</string>
|
||||||
|
<string name="label_male">Male</string>
|
||||||
|
<string name="label_woman">Woman</string>
|
||||||
|
<string name="label_goal_weight">Goal weight</string>
|
||||||
|
<string name="label_goal_date">Goal date</string>
|
||||||
|
|
||||||
<string name="label_weight_average">Weight Ø</string>
|
|
||||||
<string name="label_fat_average">Fat Ø</string>
|
<string name="label_title_user">user</string>
|
||||||
<string name="label_water_average">Water Ø</string>
|
<string name="label_title_last_measurement">last measurement</string>
|
||||||
<string name="label_muscle_average">Muscle Ø</string>
|
<string name="label_title_goal">goal</string>
|
||||||
<string name="label_overview_title_start">Hello</string>
|
<string name="label_title_statistics">statistics</string>
|
||||||
<string name="label_overview_title_end">your last measurement is:</string>
|
|
||||||
|
|
||||||
<string name="label_import">Import</string>
|
<string name="label_import">Import</string>
|
||||||
<string name="label_export">Export</string>
|
<string name="label_export">Export</string>
|
||||||
@@ -60,6 +75,7 @@
|
|||||||
<string name="info_set_filename">Set filename to</string>
|
<string name="info_set_filename">Set filename to</string>
|
||||||
<string name="info_enter_value_percent">Enter value in %</string>
|
<string name="info_enter_value_percent">Enter value in %</string>
|
||||||
<string name="info_enter_value_unit">Enter value in</string>
|
<string name="info_enter_value_unit">Enter value in</string>
|
||||||
|
<string name="info_enter_goal_weight">Enter your goal weight in your scale unit</string>
|
||||||
<string name="info_is_visible">Is visible</string>
|
<string name="info_is_visible">Is visible</string>
|
||||||
<string name="info_is_not_visible">Is not visible</string>
|
<string name="info_is_not_visible">Is not visible</string>
|
||||||
<string name="info_bluetooth_enable">Searching for Bluetooth bathroom scale is enabled</string>
|
<string name="info_bluetooth_enable">Searching for Bluetooth bathroom scale is enabled</string>
|
||||||
|
Reference in New Issue
Block a user