mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-22 16:23:09 +02:00
you can now move back and forward and delete while editing a data entry.
This commit is contained in:
@@ -23,8 +23,7 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="com.health.openscale.gui.SettingsActivity"></activity>
|
||||
<activity android:name="com.health.openscale.gui.NewEntryActivity" android:theme="@android:style/Theme.Holo.Light.Dialog" android:label="@string/title_new_data_entry"></activity>
|
||||
<activity android:name="com.health.openscale.gui.EditDataActivity" android:theme="@android:style/Theme.Holo.Light.Dialog" android:label="@string/title_edit_data_entry"></activity>
|
||||
<activity android:name=".gui.DataEntryActivity" android:theme="@android:style/Theme.Holo.Light.Dialog"></activity>
|
||||
<activity android:name=".gui.UserSettingsActivity" android:theme="@android:style/Theme.Holo.Dialog" android:label="@string/label_title_user"></activity>
|
||||
</application>
|
||||
|
||||
|
@@ -283,13 +283,6 @@ public class OpenScale {
|
||||
return scaleDB.getScaleDataOfMonth(selectedUserId, year, month);
|
||||
}
|
||||
|
||||
public float getMaxValueOfScaleData(int year, int month) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
int selectedUserId = prefs.getInt("selectedUserId", -1);
|
||||
|
||||
return scaleDB.getMaxValueOfScaleData(selectedUserId, year, month);
|
||||
}
|
||||
|
||||
public void startBluetoothServer(String deviceName) {
|
||||
Log.d("OpenScale", "Bluetooth Server started! I am searching for device ...");
|
||||
|
||||
|
@@ -55,10 +55,22 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
COLUMN_NAME_MUSCLE + " REAL," +
|
||||
COLUMN_NAME_COMMENT + " TEXT" +
|
||||
")";
|
||||
|
||||
|
||||
private static final String SQL_DELETE_ENTRIES =
|
||||
"DROP TABLE IF EXISTS " + TABLE_NAME;
|
||||
|
||||
|
||||
|
||||
private static 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,
|
||||
COLUMN_NAME_COMMENT
|
||||
};
|
||||
|
||||
private SimpleDateFormat formatDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);
|
||||
|
||||
public ScaleDatabase(Context context) {
|
||||
@@ -131,19 +143,7 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
|
||||
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,
|
||||
COLUMN_NAME_COMMENT
|
||||
};
|
||||
SQLiteDatabase db = getReadableDatabase();;
|
||||
|
||||
Cursor cursorScaleDB = db.query(
|
||||
TABLE_NAME, // The table to query
|
||||
@@ -155,30 +155,9 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
null // The sort order
|
||||
);
|
||||
|
||||
try {
|
||||
cursorScaleDB.moveToFirst();
|
||||
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.comment = cursorScaleDB.getString(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_COMMENT));
|
||||
|
||||
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;
|
||||
return readAtCursor(cursorScaleDB);
|
||||
}
|
||||
|
||||
public void deleteEntry(long id) {
|
||||
@@ -218,64 +197,10 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
return numOfMonth;
|
||||
}
|
||||
|
||||
public float getMaxValueOfScaleData(int userId, int year, int month) {
|
||||
SQLiteDatabase db = getReadableDatabase();
|
||||
|
||||
Calendar start_cal = Calendar.getInstance();
|
||||
Calendar end_cal = Calendar.getInstance();
|
||||
|
||||
start_cal.set(year, month, 1, 0, 0, 0);
|
||||
end_cal.set(year, month, 1, 0, 0, 0);
|
||||
end_cal.add(Calendar.MONTH, 1);
|
||||
|
||||
String[] projection = {
|
||||
"MAX(" + COLUMN_NAME_WEIGHT + ")",
|
||||
"MAX(" + COLUMN_NAME_FAT + ")",
|
||||
"MAX(" + COLUMN_NAME_WATER + ")",
|
||||
"MAX(" + COLUMN_NAME_MUSCLE + ")"
|
||||
};
|
||||
|
||||
Cursor cursorScaleDB = db.query(
|
||||
TABLE_NAME, // The table to query
|
||||
projection, // The columns to return
|
||||
COLUMN_NAME_DATE_TIME + " >= ? AND " + COLUMN_NAME_DATE_TIME + " < ? AND " + COLUMN_NAME_USER_ID + "=?", // The columns for the WHERE clause
|
||||
new String[]{formatDateTime.format(start_cal.getTime()), formatDateTime.format(end_cal.getTime()), Integer.toString(userId)}, // The values for the WHERE clause
|
||||
null, // don't group the rows
|
||||
null, // don't filter by row groups
|
||||
null // The sort order
|
||||
);
|
||||
|
||||
cursorScaleDB.moveToFirst();
|
||||
|
||||
float maxValue = -1;
|
||||
|
||||
for (int i=0; i<4; i++)
|
||||
{
|
||||
if (maxValue < cursorScaleDB.getFloat(i))
|
||||
{
|
||||
maxValue = cursorScaleDB.getFloat(i);
|
||||
}
|
||||
}
|
||||
|
||||
return maxValue;
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<ScaleData> getScaleDataOfMonth(int userId, int year, int month) {
|
||||
SQLiteDatabase db = getReadableDatabase();
|
||||
ArrayList<ScaleData> scaleDataList = new ArrayList<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,
|
||||
COLUMN_NAME_COMMENT
|
||||
};
|
||||
|
||||
String sortOrder = COLUMN_NAME_DATE_TIME + " DESC";
|
||||
|
||||
Calendar start_cal = Calendar.getInstance();
|
||||
@@ -295,32 +220,12 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
sortOrder // The sort order
|
||||
);
|
||||
|
||||
try {
|
||||
cursorScaleDB.moveToFirst();
|
||||
cursorScaleDB.moveToFirst();
|
||||
|
||||
while (!cursorScaleDB.isAfterLast()) {
|
||||
ScaleData scaleData = new ScaleData();
|
||||
while (!cursorScaleDB.isAfterLast()) {
|
||||
scaleDataList.add(readAtCursor(cursorScaleDB));
|
||||
|
||||
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.comment = cursorScaleDB.getString(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_COMMENT));
|
||||
|
||||
scaleData.date_time = formatDateTime.parse(date_time);
|
||||
|
||||
scaleDataList.add(scaleData);
|
||||
|
||||
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());
|
||||
cursorScaleDB.moveToNext();
|
||||
}
|
||||
|
||||
return scaleDataList;
|
||||
@@ -330,17 +235,6 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
SQLiteDatabase db = getReadableDatabase();
|
||||
ArrayList<ScaleData> scaleDataList = new ArrayList<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,
|
||||
COLUMN_NAME_COMMENT
|
||||
};
|
||||
|
||||
String sortOrder = COLUMN_NAME_DATE_TIME + " DESC";
|
||||
|
||||
Cursor cursorScaleDB = db.query(
|
||||
@@ -352,36 +246,40 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
null, // don't filter by row groups
|
||||
sortOrder // The sort order
|
||||
);
|
||||
|
||||
try {
|
||||
|
||||
cursorScaleDB.moveToFirst();
|
||||
|
||||
while (!cursorScaleDB.isAfterLast()) {
|
||||
ScaleData scaleData = new ScaleData();
|
||||
|
||||
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.comment = cursorScaleDB.getString(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_COMMENT));
|
||||
scaleDataList.add(readAtCursor(cursorScaleDB));
|
||||
|
||||
scaleData.date_time = formatDateTime.parse(date_time);
|
||||
|
||||
scaleDataList.add(scaleData);
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
cursorScaleDB.moveToNext();
|
||||
}
|
||||
|
||||
return scaleDataList;
|
||||
}
|
||||
|
||||
|
||||
private ScaleData readAtCursor (Cursor cur) {
|
||||
ScaleData scaleData = new ScaleData();
|
||||
|
||||
try {
|
||||
scaleData.id = cur.getLong(cur.getColumnIndexOrThrow(COLUMN_NAME_ID));
|
||||
scaleData.user_id = cur.getInt(cur.getColumnIndexOrThrow(COLUMN_NAME_USER_ID));
|
||||
String date_time = cur.getString(cur.getColumnIndexOrThrow(COLUMN_NAME_DATE_TIME));
|
||||
scaleData.weight = cur.getFloat(cur.getColumnIndexOrThrow(COLUMN_NAME_WEIGHT));
|
||||
scaleData.fat = cur.getFloat(cur.getColumnIndexOrThrow(COLUMN_NAME_FAT));
|
||||
scaleData.water = cur.getFloat(cur.getColumnIndexOrThrow(COLUMN_NAME_WATER));
|
||||
scaleData.muscle = cur.getFloat(cur.getColumnIndexOrThrow(COLUMN_NAME_MUSCLE));
|
||||
scaleData.comment = cur.getString(cur.getColumnIndexOrThrow(COLUMN_NAME_COMMENT));
|
||||
|
||||
scaleData.date_time = formatDateTime.parse(date_time);
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
@@ -58,6 +58,17 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
||||
private static final String SQL_DELETE_ENTRIES =
|
||||
"DROP TABLE IF EXISTS " + TABLE_NAME;
|
||||
|
||||
private static String[] projection = {
|
||||
COLUMN_NAME_ID,
|
||||
COLUMN_NAME_USER_NAME,
|
||||
COLUMN_NAME_BIRTHDAY,
|
||||
COLUMN_NAME_BODY_HEIGHT,
|
||||
COLUMN_NAME_SCALE_UNIT,
|
||||
COLUMN_NAME_GENDER,
|
||||
COLUMN_NAME_GOAL_WEIGHT,
|
||||
COLUMN_NAME_GOAL_DATE
|
||||
};
|
||||
|
||||
private SimpleDateFormat formatDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);
|
||||
|
||||
public ScaleUserDatabase(Context context) {
|
||||
@@ -134,18 +145,6 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
||||
public ScaleUser getScaleUser(int id)
|
||||
{
|
||||
SQLiteDatabase db = getReadableDatabase();
|
||||
ScaleUser scaleUser = new ScaleUser();
|
||||
|
||||
String[] projection = {
|
||||
COLUMN_NAME_ID,
|
||||
COLUMN_NAME_USER_NAME,
|
||||
COLUMN_NAME_BIRTHDAY,
|
||||
COLUMN_NAME_BODY_HEIGHT,
|
||||
COLUMN_NAME_SCALE_UNIT,
|
||||
COLUMN_NAME_GENDER,
|
||||
COLUMN_NAME_GOAL_WEIGHT,
|
||||
COLUMN_NAME_GOAL_DATE
|
||||
};
|
||||
|
||||
Cursor cursorScaleDB = db.query(
|
||||
TABLE_NAME, // The table to query
|
||||
@@ -157,50 +156,15 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
||||
null // The sort order
|
||||
);
|
||||
|
||||
try {
|
||||
cursorScaleDB.moveToFirst();
|
||||
cursorScaleDB.moveToFirst();
|
||||
|
||||
scaleUser.id = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_ID));
|
||||
scaleUser.user_name = cursorScaleDB.getString(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_USER_NAME));
|
||||
String birthday = cursorScaleDB.getString(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_BIRTHDAY));
|
||||
scaleUser.body_height = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_BODY_HEIGHT));
|
||||
scaleUser.scale_unit = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_SCALE_UNIT));
|
||||
scaleUser.gender = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_GENDER));
|
||||
double 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);
|
||||
|
||||
scaleUser.goal_weight = Math.round(goal_weight * 100.0) / 100.0;
|
||||
|
||||
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 scaleUser;
|
||||
return readAtCursor(cursorScaleDB);
|
||||
}
|
||||
|
||||
public ArrayList<ScaleUser> getScaleUserList() {
|
||||
SQLiteDatabase db = getReadableDatabase();
|
||||
ArrayList<ScaleUser> scaleUserDBEntries = new ArrayList<ScaleUser>();
|
||||
|
||||
String[] projection = {
|
||||
COLUMN_NAME_ID,
|
||||
COLUMN_NAME_USER_NAME,
|
||||
COLUMN_NAME_BIRTHDAY,
|
||||
COLUMN_NAME_BODY_HEIGHT,
|
||||
COLUMN_NAME_SCALE_UNIT,
|
||||
COLUMN_NAME_GENDER,
|
||||
COLUMN_NAME_GOAL_WEIGHT,
|
||||
COLUMN_NAME_GOAL_DATE
|
||||
};
|
||||
|
||||
String sortOrder = COLUMN_NAME_ID + " DESC";
|
||||
|
||||
Cursor cursorScaleDB = db.query(
|
||||
@@ -212,39 +176,42 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
||||
null, // don't filter by row groups
|
||||
sortOrder // The sort order
|
||||
);
|
||||
|
||||
try {
|
||||
|
||||
cursorScaleDB.moveToFirst();
|
||||
|
||||
while (!cursorScaleDB.isAfterLast()) {
|
||||
ScaleUser scaleUser = new ScaleUser();
|
||||
|
||||
scaleUser.id = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_ID));
|
||||
scaleUser.user_name = cursorScaleDB.getString(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_USER_NAME));
|
||||
String birthday = cursorScaleDB.getString(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_BIRTHDAY));
|
||||
scaleUser.body_height = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_BODY_HEIGHT));
|
||||
scaleUser.scale_unit = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_SCALE_UNIT));
|
||||
scaleUser.gender = cursorScaleDB.getInt(cursorScaleDB.getColumnIndexOrThrow(COLUMN_NAME_GENDER));
|
||||
double 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);
|
||||
|
||||
scaleUser.goal_weight = Math.round(goal_weight * 100.0) / 100.0;
|
||||
|
||||
scaleUserDBEntries.add(scaleUser);
|
||||
scaleUserDBEntries.add(readAtCursor(cursorScaleDB));
|
||||
|
||||
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 scaleUserDBEntries;
|
||||
}
|
||||
|
||||
private ScaleUser readAtCursor (Cursor cur) {
|
||||
ScaleUser scaleUser = new ScaleUser();
|
||||
|
||||
try {
|
||||
scaleUser.id = cur.getInt(cur.getColumnIndexOrThrow(COLUMN_NAME_ID));
|
||||
scaleUser.user_name = cur.getString(cur.getColumnIndexOrThrow(COLUMN_NAME_USER_NAME));
|
||||
String birthday = cur.getString(cur.getColumnIndexOrThrow(COLUMN_NAME_BIRTHDAY));
|
||||
scaleUser.body_height = cur.getInt(cur.getColumnIndexOrThrow(COLUMN_NAME_BODY_HEIGHT));
|
||||
scaleUser.scale_unit = cur.getInt(cur.getColumnIndexOrThrow(COLUMN_NAME_SCALE_UNIT));
|
||||
scaleUser.gender = cur.getInt(cur.getColumnIndexOrThrow(COLUMN_NAME_GENDER));
|
||||
double goal_weight = cur.getFloat(cur.getColumnIndexOrThrow(COLUMN_NAME_GOAL_WEIGHT));
|
||||
String goal_date = cur.getString(cur.getColumnIndexOrThrow(COLUMN_NAME_GOAL_DATE));
|
||||
|
||||
scaleUser.birthday = formatDateTime.parse(birthday);
|
||||
scaleUser.goal_date = formatDateTime.parse(goal_date);
|
||||
|
||||
scaleUser.goal_weight = Math.round(goal_weight * 100.0) / 100.0;
|
||||
} 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 scaleUser;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,448 @@
|
||||
/* 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.app.AlertDialog;
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.TimePickerDialog;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TableRow;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TimePicker;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.OpenScale;
|
||||
import com.health.openscale.core.ScaleData;
|
||||
import com.health.openscale.core.ScaleUser;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.ListIterator;
|
||||
|
||||
public class DataEntryActivity extends Activity {
|
||||
public static final int ADD_DATA_REQUEST = 0;
|
||||
public static final int EDIT_DATA_REQUEST = 1;
|
||||
|
||||
private TextView txtDataNr;
|
||||
private EditText txtWeight;
|
||||
private EditText txtFat;
|
||||
private EditText txtWater;
|
||||
private EditText txtMuscle;
|
||||
private EditText txtDate;
|
||||
private EditText txtTime;
|
||||
private EditText txtComment;
|
||||
|
||||
private Button btnAdd;
|
||||
private Button btnOk;
|
||||
private Button btnCancel;
|
||||
private Button btnDelete;
|
||||
private Button btnLeft;
|
||||
private Button btnRight;
|
||||
|
||||
private SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
||||
private SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm");
|
||||
|
||||
private long id;
|
||||
|
||||
private Context context;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
setContentView(R.layout.activity_dataentry);
|
||||
|
||||
context = this;
|
||||
|
||||
txtDataNr = (TextView) findViewById(R.id.txtDataNr);
|
||||
txtWeight = (EditText) findViewById(R.id.txtWeight);
|
||||
txtWeight.setHint(getResources().getString(R.string.info_enter_value_unit) + " " + ScaleUser.UNIT_STRING[OpenScale.getInstance(context).getSelectedScaleUser().scale_unit]);
|
||||
txtFat = (EditText) findViewById(R.id.txtFat);
|
||||
txtWater = (EditText) findViewById(R.id.txtWater);
|
||||
txtMuscle = (EditText) findViewById(R.id.txtMuscle);
|
||||
txtDate = (EditText) findViewById(R.id.txtDate);
|
||||
txtTime = (EditText) findViewById(R.id.txtTime);
|
||||
txtComment = (EditText) findViewById(R.id.txtComment);
|
||||
|
||||
btnAdd = (Button) findViewById(R.id.btnAdd);
|
||||
btnOk = (Button) findViewById(R.id.btnOk);
|
||||
btnCancel = (Button) findViewById(R.id.btnCancel);
|
||||
btnDelete = (Button) findViewById(R.id.btnDelete);
|
||||
btnLeft = (Button) findViewById(R.id.btnLeft);
|
||||
btnRight = (Button) findViewById(R.id.btnRight);
|
||||
|
||||
btnAdd.setOnClickListener(new onClickListenerAdd());
|
||||
btnOk.setOnClickListener(new onClickListenerOk());
|
||||
btnCancel.setOnClickListener(new onClickListenerCancel());
|
||||
btnDelete.setOnClickListener(new onClickListenerDelete());
|
||||
btnLeft.setOnClickListener(new onClickListenerLeft());
|
||||
btnRight.setOnClickListener(new onClickListenerRight());
|
||||
|
||||
txtDate.setOnFocusChangeListener(new onFocusChangeDate());
|
||||
txtTime.setOnFocusChangeListener(new onFocusChangeTime());
|
||||
|
||||
updateOnView();
|
||||
}
|
||||
|
||||
private void updateOnView()
|
||||
{
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
if(!prefs.getBoolean("fatEnable", true)) {
|
||||
TableRow row = (TableRow)findViewById(R.id.tableRowFat);
|
||||
row.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("muscleEnable", true)) {
|
||||
TableRow row = (TableRow)findViewById(R.id.tableRowMuscle);
|
||||
row.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("waterEnable", true)) {
|
||||
TableRow row = (TableRow)findViewById(R.id.tableRowWater);
|
||||
row.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (getIntent().getExtras().getInt("mode") == EDIT_DATA_REQUEST) {
|
||||
editMode();
|
||||
}
|
||||
else
|
||||
{
|
||||
addMode();
|
||||
}
|
||||
}
|
||||
|
||||
private void editMode()
|
||||
{
|
||||
btnOk.setVisibility(View.VISIBLE);
|
||||
btnAdd.setVisibility(View.GONE);
|
||||
btnDelete.setVisibility(View.VISIBLE);
|
||||
btnLeft.setVisibility(View.VISIBLE);
|
||||
btnRight.setVisibility(View.VISIBLE);
|
||||
txtDataNr.setVisibility(View.VISIBLE);
|
||||
|
||||
id = getIntent().getExtras().getLong("id");
|
||||
|
||||
OpenScale openScale = OpenScale.getInstance(context);
|
||||
|
||||
ScaleData editScaleData = openScale.getScaleData(id);
|
||||
|
||||
txtDataNr.setText(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT).format(editScaleData.date_time));
|
||||
txtWeight.setText(editScaleData.weight+"");
|
||||
txtFat.setText(editScaleData.fat+"");
|
||||
txtWater.setText(editScaleData.water+"");
|
||||
txtMuscle.setText(editScaleData.muscle+"");
|
||||
txtComment.setText(editScaleData.comment);
|
||||
|
||||
txtDate.setText(dateFormat.format(editScaleData.date_time));
|
||||
txtTime.setText(timeFormat.format(editScaleData.date_time));
|
||||
}
|
||||
|
||||
private void addMode()
|
||||
{
|
||||
btnOk.setVisibility(View.GONE);
|
||||
btnAdd.setVisibility(View.VISIBLE);
|
||||
btnDelete.setVisibility(View.GONE);
|
||||
btnLeft.setVisibility(View.GONE);
|
||||
btnRight.setVisibility(View.GONE);
|
||||
txtDataNr.setVisibility(View.GONE);
|
||||
|
||||
if (!OpenScale.getInstance(this).getScaleDataList().isEmpty())
|
||||
{
|
||||
ScaleData lastScaleData = OpenScale.getInstance(this).getScaleDataList().get(0);
|
||||
|
||||
txtFat.setText(Float.toString(lastScaleData.fat));
|
||||
txtWater.setText(Float.toString(lastScaleData.water));
|
||||
txtMuscle.setText(Float.toString(lastScaleData.muscle));
|
||||
} else {
|
||||
txtFat.setText(Float.toString(0.0f));
|
||||
txtWater.setText(Float.toString(0.0f));
|
||||
txtMuscle.setText(Float.toString(0.0f));
|
||||
}
|
||||
|
||||
txtDate.setText(dateFormat.format(new Date()));
|
||||
txtTime.setText(timeFormat.format(new Date()));
|
||||
}
|
||||
|
||||
private boolean validateInput()
|
||||
{
|
||||
boolean validate = true;
|
||||
|
||||
if( txtWeight.getText().toString().length() == 0 )
|
||||
{
|
||||
txtWeight.setError(getResources().getString(R.string.error_weight_value_required));
|
||||
validate = false;
|
||||
} else if( !(Float.valueOf(txtWeight.getText().toString()) >= 0 && Float.valueOf(txtWeight.getText().toString()) <= 300) )
|
||||
{
|
||||
txtWeight.setError(getResources().getString(R.string.error_value_range_0_300));
|
||||
validate = false;
|
||||
}
|
||||
|
||||
if( txtFat.getText().toString().length() == 0 )
|
||||
{
|
||||
txtFat.setError(getResources().getString(R.string.error_fat_value_required));
|
||||
validate = false;
|
||||
} else if(!isInRange(txtFat.getText().toString()))
|
||||
{
|
||||
txtFat.setError(getResources().getString(R.string.error_value_range_0_100));
|
||||
validate = false;
|
||||
}
|
||||
|
||||
|
||||
if( txtWater.getText().toString().length() == 0 )
|
||||
{
|
||||
txtWater.setError(getResources().getString(R.string.error_water_value_required));
|
||||
validate = false;
|
||||
} else if(!isInRange(txtWater.getText().toString()))
|
||||
{
|
||||
txtWater.setError(getResources().getString(R.string.error_value_range_0_100));
|
||||
validate = false;
|
||||
}
|
||||
|
||||
if( txtMuscle.getText().toString().length() == 0 )
|
||||
{
|
||||
txtMuscle.setError(getResources().getString(R.string.error_muscle_value_required));
|
||||
validate = false;
|
||||
} else if(!isInRange(txtMuscle.getText().toString()))
|
||||
{
|
||||
txtMuscle.setError(getResources().getString(R.string.error_value_range_0_100));
|
||||
validate = false;
|
||||
}
|
||||
|
||||
return validate;
|
||||
}
|
||||
|
||||
private boolean isInRange(String value)
|
||||
{
|
||||
if (value.length() == 0)
|
||||
return false;
|
||||
|
||||
float val = Float.valueOf(value);
|
||||
|
||||
if (val >= 0 && val <= 100)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean moveLeft() {
|
||||
ArrayList<ScaleData> scaleDataList = OpenScale.getInstance(context).getScaleDataList();
|
||||
|
||||
ListIterator<ScaleData> scaleDataIterator = scaleDataList.listIterator();
|
||||
|
||||
while(scaleDataIterator.hasNext())
|
||||
{
|
||||
ScaleData scaleData = scaleDataIterator.next();
|
||||
|
||||
if (scaleData.id == id)
|
||||
{
|
||||
if (scaleDataIterator.hasNext()) {
|
||||
getIntent().putExtra("id",scaleDataIterator.next().id );
|
||||
updateOnView();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean moveRight()
|
||||
{
|
||||
ArrayList<ScaleData> scaleDataList = OpenScale.getInstance(context).getScaleDataList();
|
||||
|
||||
ListIterator<ScaleData> scaleDataIterator = scaleDataList.listIterator(scaleDataList.size());
|
||||
|
||||
while(scaleDataIterator.hasPrevious())
|
||||
{
|
||||
ScaleData scaleData = scaleDataIterator.previous();
|
||||
|
||||
if (scaleData.id == id)
|
||||
{
|
||||
if (scaleDataIterator.hasPrevious()) {
|
||||
getIntent().putExtra("id", scaleDataIterator.previous().id);
|
||||
updateOnView();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() {
|
||||
@Override
|
||||
public void onDateSet(DatePicker view, int selectedYear, int selectedMonth, int selectedDay) {
|
||||
txtDate.setText(String.format("%02d.%02d.%04d", selectedDay, selectedMonth+1, selectedYear));
|
||||
}
|
||||
};
|
||||
|
||||
private TimePickerDialog.OnTimeSetListener timePickerListener = new TimePickerDialog.OnTimeSetListener() {
|
||||
@Override
|
||||
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
|
||||
txtTime.setText(String.format("%02d:%02d", hourOfDay, minute));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private class onClickListenerAdd implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (validateInput())
|
||||
{
|
||||
OpenScale openScale = OpenScale.getInstance(context);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
int selectedUserId = prefs.getInt("selectedUserId", -1);
|
||||
|
||||
if (selectedUserId == -1) {
|
||||
AlertDialog.Builder infoDialog = new AlertDialog.Builder(context);
|
||||
|
||||
infoDialog.setMessage(getResources().getString(R.string.info_no_selected_user));
|
||||
|
||||
infoDialog.setPositiveButton(getResources().getString(R.string.label_ok), null);
|
||||
|
||||
infoDialog.show();
|
||||
} else {
|
||||
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());
|
||||
String comment = txtComment.getText().toString();
|
||||
|
||||
String date = txtDate.getText().toString();
|
||||
String time = txtTime.getText().toString();
|
||||
|
||||
openScale.addScaleData(selectedUserId, date + " " + time, weight, fat, water, muscle, comment);
|
||||
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class onClickListenerOk implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (validateInput()) {
|
||||
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());
|
||||
String comment = txtComment.getText().toString();
|
||||
|
||||
OpenScale openScale = OpenScale.getInstance(context);
|
||||
|
||||
openScale.updateScaleData(id, weight, fat, water, muscle, comment);
|
||||
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class onClickListenerLeft implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
moveLeft();
|
||||
}
|
||||
}
|
||||
|
||||
private class onClickListenerRight implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
moveRight();
|
||||
}
|
||||
}
|
||||
|
||||
private class onClickListenerCancel implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
private class onClickListenerDelete implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
long delId = id;
|
||||
|
||||
boolean hasNext = moveLeft();
|
||||
|
||||
OpenScale.getInstance(context).deleteScaleData(delId);
|
||||
Toast.makeText(context, getResources().getString(R.string.info_data_deleted), Toast.LENGTH_SHORT).show();
|
||||
|
||||
if (!hasNext) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class onFocusChangeDate implements View.OnFocusChangeListener {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (hasFocus) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
|
||||
if (getIntent().getExtras().getInt("mode") == EDIT_DATA_REQUEST) {
|
||||
OpenScale openScale = OpenScale.getInstance(context);
|
||||
ScaleData editScaleData = openScale.getScaleData(id);
|
||||
cal.setTime(editScaleData.date_time);
|
||||
}
|
||||
|
||||
DatePickerDialog datePicker = new DatePickerDialog(context, datePickerListener, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
|
||||
datePicker.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class onFocusChangeTime implements View.OnFocusChangeListener {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (hasFocus) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
|
||||
if (getIntent().getExtras().getInt("mode") == EDIT_DATA_REQUEST) {
|
||||
OpenScale openScale = OpenScale.getInstance(context);
|
||||
ScaleData editScaleData = openScale.getScaleData(id);
|
||||
cal.setTime(editScaleData.date_time);
|
||||
}
|
||||
|
||||
TimePickerDialog timePicker = new TimePickerDialog(context, timePickerListener, cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), true);
|
||||
timePicker.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,187 +0,0 @@
|
||||
/* 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.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TableRow;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.OpenScale;
|
||||
import com.health.openscale.core.ScaleData;
|
||||
|
||||
import java.text.DateFormat;
|
||||
|
||||
public class EditDataActivity extends Activity {
|
||||
|
||||
private EditText txtWeight;
|
||||
private EditText txtFat;
|
||||
private EditText txtWater;
|
||||
private EditText txtMuscle;
|
||||
private EditText txtComment;
|
||||
|
||||
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);
|
||||
txtComment = (EditText) findViewById(R.id.txtComment);
|
||||
|
||||
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+"");
|
||||
txtComment.setText(editScaleData.comment);
|
||||
|
||||
setTitle(getResources().getString(R.string.title_edit_data_entry) + ": " + DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT).format(editScaleData.date_time));
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
if(!prefs.getBoolean("fatEnable", true)) {
|
||||
TableRow row = (TableRow)findViewById(R.id.tableRowFat);
|
||||
row.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("muscleEnable", true)) {
|
||||
TableRow row = (TableRow)findViewById(R.id.tableRowMuscle);
|
||||
row.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("waterEnable", true)) {
|
||||
TableRow row = (TableRow)findViewById(R.id.tableRowWater);
|
||||
row.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean validateInput()
|
||||
{
|
||||
boolean validate = true;
|
||||
|
||||
if( txtWeight.getText().toString().length() == 0 )
|
||||
{
|
||||
txtWeight.setError(getResources().getString(R.string.error_weight_value_required));
|
||||
validate = false;
|
||||
} else if( !(Float.valueOf(txtWeight.getText().toString()) >= 0 && Float.valueOf(txtWeight.getText().toString()) <= 300) )
|
||||
{
|
||||
txtWeight.setError(getResources().getString(R.string.error_value_range_0_300));
|
||||
validate = false;
|
||||
}
|
||||
|
||||
if( txtFat.getText().toString().length() == 0 )
|
||||
{
|
||||
txtFat.setError(getResources().getString(R.string.error_fat_value_required));
|
||||
validate = false;
|
||||
} else if(!isInRange(txtFat.getText().toString()))
|
||||
{
|
||||
txtFat.setError(getResources().getString(R.string.error_value_range_0_100));
|
||||
validate = false;
|
||||
}
|
||||
|
||||
|
||||
if( txtWater.getText().toString().length() == 0 )
|
||||
{
|
||||
txtWater.setError(getResources().getString(R.string.error_water_value_required));
|
||||
validate = false;
|
||||
} else if(!isInRange(txtWater.getText().toString()))
|
||||
{
|
||||
txtWater.setError(getResources().getString(R.string.error_value_range_0_100));
|
||||
validate = false;
|
||||
}
|
||||
|
||||
if( txtMuscle.getText().toString().length() == 0 )
|
||||
{
|
||||
txtMuscle.setError(getResources().getString(R.string.error_muscle_value_required));
|
||||
validate = false;
|
||||
} else if(!isInRange(txtMuscle.getText().toString()))
|
||||
{
|
||||
txtMuscle.setError(getResources().getString(R.string.error_value_range_0_100));
|
||||
validate = false;
|
||||
}
|
||||
|
||||
return validate;
|
||||
}
|
||||
|
||||
private boolean isInRange(String value)
|
||||
{
|
||||
if (value.length() == 0)
|
||||
return false;
|
||||
|
||||
float val = Float.valueOf(value);
|
||||
|
||||
if (val >= 0 && val <= 100)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private class onClickListenerOk implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (validateInput()) {
|
||||
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());
|
||||
String comment = txtComment.getText().toString();
|
||||
|
||||
OpenScale openScale = OpenScale.getInstance(context);
|
||||
|
||||
openScale.updateScaleData(id, weight, fat, water, muscle, comment);
|
||||
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class onClickListenerCancel implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
@@ -275,7 +275,8 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
||||
|
||||
long id = scaleData.id;
|
||||
|
||||
Intent intent = new Intent(graphView.getContext(), EditDataActivity.class);
|
||||
Intent intent = new Intent(graphView.getContext(), DataEntryActivity.class);
|
||||
intent.putExtra("mode", DataEntryActivity.EDIT_DATA_REQUEST);
|
||||
intent.putExtra("id", id);
|
||||
startActivityForResult(intent, 1);
|
||||
}
|
||||
|
@@ -1,253 +0,0 @@
|
||||
/* 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.app.AlertDialog;
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.TimePickerDialog;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.View;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TableRow;
|
||||
import android.widget.TimePicker;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.OpenScale;
|
||||
import com.health.openscale.core.ScaleData;
|
||||
import com.health.openscale.core.ScaleUser;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class NewEntryActivity extends Activity {
|
||||
|
||||
private EditText txtWeight;
|
||||
private EditText txtFat;
|
||||
private EditText txtWater;
|
||||
private EditText txtMuscle;
|
||||
private EditText txtDate;
|
||||
private EditText txtTime;
|
||||
private EditText txtComment;
|
||||
|
||||
private SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
||||
private SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm");
|
||||
|
||||
private Context context;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_newentry);
|
||||
context = this;
|
||||
|
||||
txtWeight = (EditText) findViewById(R.id.txtWeight);
|
||||
txtWeight.setHint(getResources().getString(R.string.info_enter_value_unit) + " " + ScaleUser.UNIT_STRING[OpenScale.getInstance(context).getSelectedScaleUser().scale_unit]);
|
||||
txtFat = (EditText) findViewById(R.id.txtFat);
|
||||
txtWater = (EditText) findViewById(R.id.txtWater);
|
||||
txtMuscle = (EditText) findViewById(R.id.txtMuscle);
|
||||
txtDate = (EditText) findViewById(R.id.txtDate);
|
||||
txtTime = (EditText) findViewById(R.id.txtTime);
|
||||
txtComment = (EditText) findViewById(R.id.txtComment);
|
||||
|
||||
findViewById(R.id.btnAdd).setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
btnOnClickAdd();
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.btnCancel).setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
btnOnClickCancel();
|
||||
}
|
||||
});
|
||||
|
||||
txtDate.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (hasFocus) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
DatePickerDialog datePicker = new DatePickerDialog(context, datePickerListener, cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
|
||||
datePicker.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
txtTime.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (hasFocus) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
TimePickerDialog timePicker = new TimePickerDialog(context, timePickerListener, cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), true);
|
||||
timePicker.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!OpenScale.getInstance(this).getScaleDataList().isEmpty())
|
||||
{
|
||||
ScaleData lastScaleData = OpenScale.getInstance(this).getScaleDataList().get(0);
|
||||
|
||||
txtFat.setText(Float.toString(lastScaleData.fat));
|
||||
txtWater.setText(Float.toString(lastScaleData.water));
|
||||
txtMuscle.setText(Float.toString(lastScaleData.muscle));
|
||||
} else {
|
||||
txtFat.setText(Float.toString(0.0f));
|
||||
txtWater.setText(Float.toString(0.0f));
|
||||
txtMuscle.setText(Float.toString(0.0f));
|
||||
}
|
||||
|
||||
txtDate.setText(dateFormat.format(new Date()));
|
||||
txtTime.setText(timeFormat.format(new Date()));
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
if(!prefs.getBoolean("fatEnable", true)) {
|
||||
TableRow row = (TableRow)findViewById(R.id.tableRowFat);
|
||||
row.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("muscleEnable", true)) {
|
||||
TableRow row = (TableRow)findViewById(R.id.tableRowMuscle);
|
||||
row.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("waterEnable", true)) {
|
||||
TableRow row = (TableRow)findViewById(R.id.tableRowWater);
|
||||
row.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean validateInput()
|
||||
{
|
||||
boolean validate = true;
|
||||
|
||||
if( txtWeight.getText().toString().length() == 0 )
|
||||
{
|
||||
txtWeight.setError(getResources().getString(R.string.error_weight_value_required));
|
||||
validate = false;
|
||||
} else if( !(Float.valueOf(txtWeight.getText().toString()) >= 0 && Float.valueOf(txtWeight.getText().toString()) <= 300) )
|
||||
{
|
||||
txtWeight.setError(getResources().getString(R.string.error_value_range_0_300));
|
||||
validate = false;
|
||||
}
|
||||
|
||||
if( txtFat.getText().toString().length() == 0 )
|
||||
{
|
||||
txtFat.setError(getResources().getString(R.string.error_fat_value_required));
|
||||
validate = false;
|
||||
} else if(!isInRange(txtFat.getText().toString()))
|
||||
{
|
||||
txtFat.setError(getResources().getString(R.string.error_value_range_0_100));
|
||||
validate = false;
|
||||
}
|
||||
|
||||
|
||||
if( txtWater.getText().toString().length() == 0 )
|
||||
{
|
||||
txtWater.setError(getResources().getString(R.string.error_water_value_required));
|
||||
validate = false;
|
||||
} else if(!isInRange(txtWater.getText().toString()))
|
||||
{
|
||||
txtWater.setError(getResources().getString(R.string.error_value_range_0_100));
|
||||
validate = false;
|
||||
}
|
||||
|
||||
if( txtMuscle.getText().toString().length() == 0 )
|
||||
{
|
||||
txtMuscle.setError(getResources().getString(R.string.error_muscle_value_required));
|
||||
validate = false;
|
||||
} else if(!isInRange(txtMuscle.getText().toString()))
|
||||
{
|
||||
txtMuscle.setError(getResources().getString(R.string.error_value_range_0_100));
|
||||
validate = false;
|
||||
}
|
||||
|
||||
return validate;
|
||||
}
|
||||
|
||||
private boolean isInRange(String value)
|
||||
{
|
||||
if (value.length() == 0)
|
||||
return false;
|
||||
|
||||
float val = Float.valueOf(value);
|
||||
|
||||
if (val >= 0 && val <= 100)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void btnOnClickAdd()
|
||||
{
|
||||
if (validateInput())
|
||||
{
|
||||
OpenScale openScale = OpenScale.getInstance(context);
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
int selectedUserId = prefs.getInt("selectedUserId", -1);
|
||||
|
||||
if (selectedUserId == -1) {
|
||||
AlertDialog.Builder infoDialog = new AlertDialog.Builder(context);
|
||||
|
||||
infoDialog.setMessage(getResources().getString(R.string.info_no_selected_user));
|
||||
|
||||
infoDialog.setPositiveButton(getResources().getString(R.string.label_ok), null);
|
||||
|
||||
infoDialog.show();
|
||||
} else {
|
||||
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());
|
||||
String comment = txtComment.getText().toString();
|
||||
|
||||
String date = txtDate.getText().toString();
|
||||
String time = txtTime.getText().toString();
|
||||
|
||||
openScale.addScaleData(selectedUserId, date + " " + time, weight, fat, water, muscle, comment);
|
||||
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void btnOnClickCancel()
|
||||
{
|
||||
finish();
|
||||
}
|
||||
|
||||
private DatePickerDialog.OnDateSetListener datePickerListener = new DatePickerDialog.OnDateSetListener() {
|
||||
@Override
|
||||
public void onDateSet(DatePicker view, int selectedYear, int selectedMonth, int selectedDay) {
|
||||
txtDate.setText(String.format("%02d.%02d.%04d", selectedDay, selectedMonth+1, selectedYear));
|
||||
}
|
||||
};
|
||||
|
||||
private TimePickerDialog.OnTimeSetListener timePickerListener = new TimePickerDialog.OnTimeSetListener() {
|
||||
@Override
|
||||
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
|
||||
txtTime.setText(String.format("%02d:%02d", hourOfDay, minute));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
@@ -524,7 +524,8 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
|
||||
public void btnOnClickInsertData()
|
||||
{
|
||||
Intent intent = new Intent(overviewView.getContext(), NewEntryActivity.class);
|
||||
Intent intent = new Intent(overviewView.getContext(), DataEntryActivity.class);
|
||||
intent.putExtra("mode", DataEntryActivity.ADD_DATA_REQUEST);
|
||||
startActivityForResult(intent, 1);
|
||||
}
|
||||
|
||||
|
@@ -231,7 +231,8 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
||||
TextView idTextView = (TextView) dataRow.getChildAt(0);
|
||||
long id = Long.parseLong(idTextView.getText().toString());
|
||||
|
||||
Intent intent = new Intent(tableView.getContext(), EditDataActivity.class);
|
||||
Intent intent = new Intent(tableView.getContext(), DataEntryActivity.class);
|
||||
intent.putExtra("mode", DataEntryActivity.EDIT_DATA_REQUEST);
|
||||
intent.putExtra("id", id);
|
||||
startActivityForResult(intent, 1);
|
||||
}
|
||||
|
@@ -5,6 +5,46 @@
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:gravity="center">
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:text="<"
|
||||
android:id="@+id/btnLeft"
|
||||
android:background="@drawable/flat_selector"
|
||||
android:textColor="@android:color/white" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="date/time"
|
||||
android:id="@+id/txtDataNr"
|
||||
android:gravity="center"
|
||||
android:layout_weight="0"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginRight="30dp" />
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonStyleSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="20dp"
|
||||
android:text=">"
|
||||
android:id="@+id/btnRight"
|
||||
android:background="@drawable/flat_selector"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_weight="0" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -266,6 +306,19 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.5" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDelete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5"
|
||||
android:background="@drawable/flat_selector"
|
||||
android:text="@string/label_delete"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.5" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAdd"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -273,6 +326,14 @@
|
||||
android:layout_weight="5"
|
||||
android:background="@drawable/flat_selector"
|
||||
android:text="@string/label_add" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnOk"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5"
|
||||
android:background="@drawable/flat_selector"
|
||||
android:text="@string/label_ok" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@@ -1,212 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp" >
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/scrollView2" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp" >
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:stretchColumns="2" >
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/tableRowWeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:id="@+id/imageView10"
|
||||
android:layout_column="0"
|
||||
android:src="@drawable/weight"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginRight="2dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_weight"
|
||||
android:layout_column="1" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtWeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="numberDecimal|numberSigned"
|
||||
android:layout_column="2"
|
||||
android:hint="@string/info_enter_goal_weight">
|
||||
|
||||
<requestFocus />
|
||||
</EditText>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/tableRowFat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:id="@+id/imageView12"
|
||||
android:layout_column="0"
|
||||
android:src="@drawable/fat"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginRight="2dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_fat"
|
||||
android:layout_column="1" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtFat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="numberDecimal|numberSigned"
|
||||
android:layout_column="2"
|
||||
android:hint="@string/info_enter_value_percent" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/tableRowWater"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:id="@+id/imageView13"
|
||||
android:layout_column="0"
|
||||
android:src="@drawable/water"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginRight="2dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_water"
|
||||
android:layout_column="1" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtWater"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5"
|
||||
android:ems="10"
|
||||
android:inputType="numberDecimal|numberSigned"
|
||||
android:layout_column="2"
|
||||
android:hint="@string/info_enter_value_percent" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/tableRowMuscle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:id="@+id/imageView14"
|
||||
android:layout_column="0"
|
||||
android:src="@drawable/muscle"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginRight="2dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_muscle"
|
||||
android:layout_column="1" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtMuscle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="numberDecimal|numberSigned"
|
||||
android:layout_column="2"
|
||||
android:hint="@string/info_enter_value_percent" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/tableRowComment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:id="@+id/imageView15"
|
||||
android:layout_column="0"
|
||||
android:src="@drawable/comment"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginRight="2dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_comment"
|
||||
android:layout_column="1" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/txtComment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:layout_column="2"
|
||||
android:inputType="text|textImeMultiLine|textMultiLine|textAutoComplete|textAutoCorrect"
|
||||
android:hint="@string/info_enter_comment" />
|
||||
</TableRow>
|
||||
|
||||
</TableLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
<Button
|
||||
android:id="@+id/btnCancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5"
|
||||
android:background="@drawable/flat_selector"
|
||||
android:text="@string/label_cancel"
|
||||
android:layout_marginRight="10dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnOk"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5"
|
||||
android:background="@drawable/flat_selector"
|
||||
android:text="@string/label_ok" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
@@ -82,10 +82,8 @@
|
||||
<string name="label_yes">Ja</string>
|
||||
<string name="question_really_delete_user">Wollen Sie wirklich den Benutzer löschen?</string>
|
||||
<string name="question_really_delete_all">Wollen Sie wirklich alle Datenbankeinträge löschen?</string>
|
||||
<string name="title_edit_data_entry">Bearbeiten</string>
|
||||
<string name="title_frag">Tabelle</string>
|
||||
<string name="title_graph">Diagramm</string>
|
||||
<string name="title_new_data_entry">Dateneingabe</string>
|
||||
<string name="title_overview">Übersicht</string>
|
||||
<string name="title_users">Benutzer</string>
|
||||
<string name="label_add_user">Benutzer hinzufügen</string>
|
||||
|
@@ -4,7 +4,6 @@
|
||||
<string name="title_users">ユーザー</string>
|
||||
<string name="title_frag">早見表</string>
|
||||
<string name="title_graph">図表</string>
|
||||
<string name="title_new_data_entry">データ入力</string>
|
||||
<string name="title_overview">概説</string>
|
||||
<string name="label_yes">はい</string>
|
||||
<string name="label_woman">女性</string>
|
||||
@@ -48,7 +47,6 @@
|
||||
<string name="label_enable_fat">体脂肪</string>
|
||||
<string name="label_delete_all">全てデリート</string>
|
||||
<string name="label_bluetooth_enable">Bluetoothの体重計を探索する</string>
|
||||
<string name="title_edit_data_entry">エディット</string>
|
||||
<string name="label_last_month">過去30日</string>
|
||||
<string name="label_last_week">過去7日</string>
|
||||
<string name="label_device_name">デバイス名</string>
|
||||
|
@@ -6,8 +6,6 @@
|
||||
<string name="title_graph">Chart</string>
|
||||
<string name="title_frag">Table</string>
|
||||
<string name="title_users">Users</string>
|
||||
<string name="title_new_data_entry">Data entry</string>
|
||||
<string name="title_edit_data_entry">Edit</string>
|
||||
<string name="title_data">Data</string>
|
||||
|
||||
<string name="action_settings">Settings</string>
|
||||
|
Reference in New Issue
Block a user