mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-24 09:13:04 +02:00
Clean up space around if, for, functions etc.
This commit is contained in:
@@ -415,7 +415,7 @@ public class OpenScale {
|
|||||||
|
|
||||||
scaleDataList = scaleDB.getScaleDataList(selectedUserId);
|
scaleDataList = scaleDB.getScaleDataList(selectedUserId);
|
||||||
|
|
||||||
for(FragmentUpdateListener fragment : fragmentList) {
|
for (FragmentUpdateListener fragment : fragmentList) {
|
||||||
if (fragment != null) {
|
if (fragment != null) {
|
||||||
if (((Fragment)fragment).isAdded()) {
|
if (((Fragment)fragment).isAdded()) {
|
||||||
fragment.updateOnView(scaleDataList);
|
fragment.updateOnView(scaleDataList);
|
||||||
|
@@ -59,10 +59,10 @@ public class AlarmHandler
|
|||||||
Calendar dataTimestamp = Calendar.getInstance();
|
Calendar dataTimestamp = Calendar.getInstance();
|
||||||
dataTimestamp.setTimeInMillis(dataMillis);
|
dataTimestamp.setTimeInMillis(dataMillis);
|
||||||
|
|
||||||
if(AlarmHandler.isSameDate(dataTimestamp, Calendar.getInstance()))
|
if (AlarmHandler.isSameDate(dataTimestamp, Calendar.getInstance()))
|
||||||
{
|
{
|
||||||
cancelAlarmNotification(context);
|
cancelAlarmNotification(context);
|
||||||
cancelAndRescheduleAlarmForNextWeek( context, dataTimestamp );
|
cancelAndRescheduleAlarmForNextWeek(context, dataTimestamp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -240,7 +240,7 @@ public abstract class BluetoothCommunication {
|
|||||||
* @param gattCharacteristic the Bluetooth Gatt characteristic
|
* @param gattCharacteristic the Bluetooth Gatt characteristic
|
||||||
* @param status the status code
|
* @param status the status code
|
||||||
*/
|
*/
|
||||||
protected void onBluetoothDataRead(BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic gattCharacteristic, int status){};
|
protected void onBluetoothDataRead(BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic gattCharacteristic, int status) {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method is triggered if a Bluetooth data from a device is notified or indicated.
|
* Method is triggered if a Bluetooth data from a device is notified or indicated.
|
||||||
@@ -248,7 +248,7 @@ public abstract class BluetoothCommunication {
|
|||||||
* @param bluetoothGatt the Bluetooth Gatt
|
* @param bluetoothGatt the Bluetooth Gatt
|
||||||
* @param gattCharacteristic the Bluetooth characteristic
|
* @param gattCharacteristic the Bluetooth characteristic
|
||||||
*/
|
*/
|
||||||
protected void onBluetoothDataChange(BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic gattCharacteristic){};
|
protected void onBluetoothDataChange(BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic gattCharacteristic) {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Bluetooth machine state to a specific state.
|
* Set the Bluetooth machine state to a specific state.
|
||||||
@@ -369,7 +369,7 @@ public abstract class BluetoothCommunication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder stringBuilder = new StringBuilder(data.length);
|
final StringBuilder stringBuilder = new StringBuilder(data.length);
|
||||||
for(byte byteChar : data) {
|
for (byte byteChar : data) {
|
||||||
stringBuilder.append(String.format("%02X ", byteChar));
|
stringBuilder.append(String.format("%02X ", byteChar));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -133,7 +133,7 @@ public class BluetoothDigooDGSO38H extends BluetoothCommunication {
|
|||||||
ScaleData scaleBtData = new ScaleData();
|
ScaleData scaleBtData = new ScaleData();
|
||||||
weight = (float) (((weightBytes[3] & 0xFF) << 8) | (weightBytes[4] & 0xFF)) / 100.0f;
|
weight = (float) (((weightBytes[3] & 0xFF) << 8) | (weightBytes[4] & 0xFF)) / 100.0f;
|
||||||
fat = (float) (((weightBytes[6] & 0xFF) << 8) | (weightBytes[7] & 0xFF)) / 10.0f;
|
fat = (float) (((weightBytes[6] & 0xFF) << 8) | (weightBytes[7] & 0xFF)) / 10.0f;
|
||||||
if(Math.abs(fat - 0.0) < 0.00001) {
|
if (Math.abs(fat - 0.0) < 0.00001) {
|
||||||
Log.d("BluetoothDigooDGSO38H", "Scale signaled that measurement of all data " +
|
Log.d("BluetoothDigooDGSO38H", "Scale signaled that measurement of all data " +
|
||||||
"is done, but fat ist still zero. Settling for just adding weight.");
|
"is done, but fat ist still zero. Settling for just adding weight.");
|
||||||
} else {
|
} else {
|
||||||
|
@@ -47,19 +47,19 @@ public class BluetoothMGB extends BluetoothCommunication {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
private int popInt( ){
|
private int popInt() {
|
||||||
return packet_buf[packet_pos++] & 0xFF;
|
return packet_buf[packet_pos++] & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private float popFloat( ){
|
private float popFloat() {
|
||||||
int r = popInt();
|
int r = popInt();
|
||||||
r = popInt() | (r<<8);
|
r = popInt() | (r<<8);
|
||||||
return r * 0.1f;
|
return r * 0.1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void writeCfg( int b2 , int b3 , int b4 , int b5 ){
|
private void writeCfg(int b2, int b3, int b4, int b5) {
|
||||||
byte[] buf = new byte[8];
|
byte[] buf = new byte[8];
|
||||||
buf[0] = (byte)0xAC;
|
buf[0] = (byte)0xAC;
|
||||||
buf[1] = (byte)0x02;
|
buf[1] = (byte)0x02;
|
||||||
@@ -68,15 +68,13 @@ public class BluetoothMGB extends BluetoothCommunication {
|
|||||||
buf[4] = (byte)b4;
|
buf[4] = (byte)b4;
|
||||||
buf[5] = (byte)b5;
|
buf[5] = (byte)b5;
|
||||||
buf[6] = (byte)0xCC;
|
buf[6] = (byte)0xCC;
|
||||||
buf[7] = (byte)( ( buf[2] + buf[3] + buf[4] + buf[5] + buf[6] ) & 0xFF );
|
buf[7] = (byte)((buf[2] + buf[3] + buf[4] + buf[5] + buf[6]) & 0xFF);
|
||||||
|
|
||||||
writeBytes( uuid_service , uuid_char_cfg , buf );
|
writeBytes(uuid_service, uuid_char_cfg, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public BluetoothMGB(Context context) {
|
||||||
|
|
||||||
public BluetoothMGB( Context context ){
|
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,33 +103,33 @@ public class BluetoothMGB extends BluetoothCommunication {
|
|||||||
boolean nextInitCmd(int stateNr) {
|
boolean nextInitCmd(int stateNr) {
|
||||||
switch (stateNr) {
|
switch (stateNr) {
|
||||||
case 0:
|
case 0:
|
||||||
setNotificationOn( uuid_service , uuid_char_ctrl , uuid_desc_ctrl );
|
setNotificationOn(uuid_service, uuid_char_ctrl, uuid_desc_ctrl);
|
||||||
now = Calendar.getInstance();
|
now = Calendar.getInstance();
|
||||||
user = OpenScale.getInstance(context).getSelectedScaleUser();
|
user = OpenScale.getInstance(context).getSelectedScaleUser();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
writeCfg( 0xF7 , 0 , 0 , 0 );
|
writeCfg(0xF7, 0, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
writeCfg( 0xFA , 0 , 0 , 0 );
|
writeCfg(0xFA, 0, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
writeCfg( 0xFB , (user.isMale() ? 1 : 2) , user.getAge(new Date()) , user.body_height );
|
writeCfg(0xFB, (user.isMale() ? 1 : 2), user.getAge(new Date()), user.body_height);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
writeCfg( 0xFD , now.get( Calendar.YEAR ) - 2000 , now.get( Calendar.MONTH ) - Calendar.JANUARY + 1 , now.get( Calendar.DAY_OF_MONTH ) );
|
writeCfg(0xFD, now.get(Calendar.YEAR) - 2000, now.get(Calendar.MONTH) - Calendar.JANUARY + 1, now.get(Calendar.DAY_OF_MONTH));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
writeCfg( 0xFC , now.get( Calendar.HOUR_OF_DAY ) , now.get( Calendar.MINUTE ) , now.get( Calendar.SECOND ) );
|
writeCfg(0xFC, now.get(Calendar.HOUR_OF_DAY), now.get(Calendar.MINUTE), now.get(Calendar.SECOND));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
writeCfg( 0xFE , 6 , 1 , 0 );
|
writeCfg(0xFE, 6, 1, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -159,11 +157,11 @@ public class BluetoothMGB extends BluetoothCommunication {
|
|||||||
packet_buf = gattCharacteristic.getValue();
|
packet_buf = gattCharacteristic.getValue();
|
||||||
packet_pos = 0;
|
packet_pos = 0;
|
||||||
|
|
||||||
if( packet_buf == null || packet_buf.length <= 0 ){
|
if (packet_buf == null || packet_buf.length <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( packet_buf.length != 20 ){
|
if (packet_buf.length != 20) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +169,7 @@ public class BluetoothMGB extends BluetoothCommunication {
|
|||||||
int hdr_2 = popInt();
|
int hdr_2 = popInt();
|
||||||
int hdr_3 = popInt();
|
int hdr_3 = popInt();
|
||||||
|
|
||||||
if( hdr_1 == 0xAC && hdr_2 == 0x02 && hdr_3 == 0xFF ){
|
if (hdr_1 == 0xAC && hdr_2 == 0x02 && hdr_3 == 0xFF) {
|
||||||
measurement = new ScaleData();
|
measurement = new ScaleData();
|
||||||
|
|
||||||
popInt(); //unknown =00
|
popInt(); //unknown =00
|
||||||
@@ -185,26 +183,25 @@ public class BluetoothMGB extends BluetoothCommunication {
|
|||||||
popInt(); //Minute
|
popInt(); //Minute
|
||||||
popInt(); //Second
|
popInt(); //Second
|
||||||
|
|
||||||
measurement.setDateTime( new Date() );
|
measurement.setDateTime(new Date());
|
||||||
|
|
||||||
measurement.setWeight( popFloat() );
|
measurement.setWeight(popFloat());
|
||||||
|
|
||||||
popFloat(); //BMI
|
popFloat(); //BMI
|
||||||
|
|
||||||
measurement.setFat( popFloat() );
|
measurement.setFat(popFloat());
|
||||||
|
|
||||||
popInt(); //unknown =00
|
popInt(); //unknown =00
|
||||||
popInt(); //unknown =00
|
popInt(); //unknown =00
|
||||||
|
|
||||||
}else
|
} else if (hdr_1 == 0x01 && hdr_2 == 0x00) {
|
||||||
if( hdr_1 == 0x01 && hdr_2 == 0x00 ){
|
measurement.setMuscle(popFloat());
|
||||||
measurement.setMuscle( popFloat() );
|
|
||||||
|
|
||||||
popFloat(); //BMR
|
popFloat(); //BMR
|
||||||
|
|
||||||
measurement.setBone( popFloat() );
|
measurement.setBone(popFloat());
|
||||||
|
|
||||||
measurement.setWater( popFloat() );
|
measurement.setWater(popFloat());
|
||||||
|
|
||||||
popInt(); // Age
|
popInt(); // Age
|
||||||
|
|
||||||
@@ -217,7 +214,7 @@ public class BluetoothMGB extends BluetoothCommunication {
|
|||||||
popInt(); // unknown =02
|
popInt(); // unknown =02
|
||||||
popInt(); // unknown =47;48;4e;4b;42
|
popInt(); // unknown =47;48;4e;4b;42
|
||||||
|
|
||||||
addScaleData( measurement );
|
addScaleData(measurement);
|
||||||
|
|
||||||
// Visceral fat?
|
// Visceral fat?
|
||||||
// Standart weight?
|
// Standart weight?
|
||||||
|
@@ -60,12 +60,12 @@ public class BluetoothMedisanaBS444 extends BluetoothCommunication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean nextInitCmd(int stateNr){
|
boolean nextInitCmd(int stateNr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean nextBluetoothCmd(int stateNr){
|
boolean nextBluetoothCmd(int stateNr) {
|
||||||
switch (stateNr) {
|
switch (stateNr) {
|
||||||
case 0:
|
case 0:
|
||||||
// set indication on for feature characteristic
|
// set indication on for feature characteristic
|
||||||
@@ -82,7 +82,7 @@ public class BluetoothMedisanaBS444 extends BluetoothCommunication {
|
|||||||
case 3:
|
case 3:
|
||||||
// send magic number to receive weight data
|
// send magic number to receive weight data
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
int unix_timestamp = (int) ((date.getTime() / 1000) - 1262304000) ; // -40 years because unix time starts in year 1970
|
int unix_timestamp = (int) ((date.getTime() / 1000) - 1262304000); // -40 years because unix time starts in year 1970
|
||||||
|
|
||||||
byte[] magicBytes = new byte[] {
|
byte[] magicBytes = new byte[] {
|
||||||
(byte)0x02,
|
(byte)0x02,
|
||||||
@@ -103,13 +103,13 @@ public class BluetoothMedisanaBS444 extends BluetoothCommunication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean nextCleanUpCmd(int stateNr){
|
boolean nextCleanUpCmd(int stateNr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBluetoothDataChange(BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic gattCharacteristic){
|
public void onBluetoothDataChange(BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic gattCharacteristic) {
|
||||||
final byte[] data = gattCharacteristic.getValue();
|
final byte[] data = gattCharacteristic.getValue();
|
||||||
|
|
||||||
if (gattCharacteristic.getUuid().equals(WEIGHT_MEASUREMENT_CHARACTERISTIC)) {
|
if (gattCharacteristic.getUuid().equals(WEIGHT_MEASUREMENT_CHARACTERISTIC)) {
|
||||||
|
@@ -21,7 +21,7 @@ import com.health.openscale.core.datatypes.ScaleUser;
|
|||||||
public abstract class EstimatedFatMetric {
|
public abstract class EstimatedFatMetric {
|
||||||
public enum FORMULA { BF_DEURENBERG, BF_DEURENBERG_II, BF_EDDY, BF_GALLAGHER, BF_GALLAGHER_ASIAN };
|
public enum FORMULA { BF_DEURENBERG, BF_DEURENBERG_II, BF_EDDY, BF_GALLAGHER, BF_GALLAGHER_ASIAN };
|
||||||
|
|
||||||
public static EstimatedFatMetric getEstimatedMetric( FORMULA metric) {
|
public static EstimatedFatMetric getEstimatedMetric(FORMULA metric) {
|
||||||
switch (metric) {
|
switch (metric) {
|
||||||
case BF_DEURENBERG:
|
case BF_DEURENBERG:
|
||||||
return new BFDeurenberg();
|
return new BFDeurenberg();
|
||||||
|
@@ -21,7 +21,7 @@ import com.health.openscale.core.datatypes.ScaleUser;
|
|||||||
public abstract class EstimatedWaterMetric {
|
public abstract class EstimatedWaterMetric {
|
||||||
public enum FORMULA { TBW_BEHNKE, TBW_DELWAIDECRENIER, TBW_HUMEWEYERS, TBW_LEESONGKIM };
|
public enum FORMULA { TBW_BEHNKE, TBW_DELWAIDECRENIER, TBW_HUMEWEYERS, TBW_LEESONGKIM };
|
||||||
|
|
||||||
public static EstimatedWaterMetric getEstimatedMetric( FORMULA metric) {
|
public static EstimatedWaterMetric getEstimatedMetric(FORMULA metric) {
|
||||||
switch (metric) {
|
switch (metric) {
|
||||||
case TBW_BEHNKE:
|
case TBW_BEHNKE:
|
||||||
return new TBWBehnke();
|
return new TBWBehnke();
|
||||||
|
@@ -421,7 +421,7 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
|||||||
} catch (ParseException ex) {
|
} catch (ParseException ex) {
|
||||||
Log.e("ScaleDatabase", "Can't parse the date time string: " + ex.getMessage());
|
Log.e("ScaleDatabase", "Can't parse the date time string: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
catch ( IllegalArgumentException ex) {
|
catch (IllegalArgumentException ex) {
|
||||||
Log.e("ScaleDatabase", "Illegal argument while reading from scale database: " + ex.getMessage());
|
Log.e("ScaleDatabase", "Illegal argument while reading from scale database: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -227,7 +227,7 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
|||||||
} catch (ParseException ex) {
|
} catch (ParseException ex) {
|
||||||
Log.e("ScaleDatabase", "Can't parse the date time string: " + ex.getMessage());
|
Log.e("ScaleDatabase", "Can't parse the date time string: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
catch ( IllegalArgumentException ex) {
|
catch (IllegalArgumentException ex) {
|
||||||
Log.e("ScaleDatabase", "Illegal argument while reading from scale database: " + ex.getMessage());
|
Log.e("ScaleDatabase", "Illegal argument while reading from scale database: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -194,7 +194,7 @@ public class ScaleData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public float getWHtR(int body_height) {
|
public float getWHtR(int body_height) {
|
||||||
return waist / (float)body_height ;
|
return waist / (float)body_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getWHR() {
|
public float getWHR() {
|
||||||
|
@@ -173,26 +173,22 @@ public class UserSettingsActivity extends Activity {
|
|||||||
{
|
{
|
||||||
boolean validate = true;
|
boolean validate = true;
|
||||||
|
|
||||||
if( txtUserName.getText().toString().length() == 0 )
|
if (txtUserName.getText().toString().length() == 0) {
|
||||||
{
|
|
||||||
txtUserName.setError(getResources().getString(R.string.error_user_name_required));
|
txtUserName.setError(getResources().getString(R.string.error_user_name_required));
|
||||||
validate = false;
|
validate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( txtBodyHeight.getText().toString().length() == 0 )
|
if (txtBodyHeight.getText().toString().length() == 0) {
|
||||||
{
|
|
||||||
txtBodyHeight.setError(getResources().getString(R.string.error_body_height_required));
|
txtBodyHeight.setError(getResources().getString(R.string.error_body_height_required));
|
||||||
validate = false;
|
validate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( txtInitialWeight.getText().toString().length() == 0 )
|
if (txtInitialWeight.getText().toString().length() == 0) {
|
||||||
{
|
|
||||||
txtInitialWeight.setError(getResources().getString(R.string.error_initial_weight_required));
|
txtInitialWeight.setError(getResources().getString(R.string.error_initial_weight_required));
|
||||||
validate = false;
|
validate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( txtGoalWeight.getText().toString().length() == 0 )
|
if (txtGoalWeight.getText().toString().length() == 0) {
|
||||||
{
|
|
||||||
txtGoalWeight.setError(getResources().getString(R.string.error_goal_weight_required));
|
txtGoalWeight.setError(getResources().getString(R.string.error_goal_weight_required));
|
||||||
validate = false;
|
validate = false;
|
||||||
}
|
}
|
||||||
|
@@ -131,35 +131,35 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
|
|
||||||
prefs = PreferenceManager.getDefaultSharedPreferences(graphView.getContext());
|
prefs = PreferenceManager.getDefaultSharedPreferences(graphView.getContext());
|
||||||
|
|
||||||
if(!prefs.getBoolean("weightEnable", true)) {
|
if (!prefs.getBoolean("weightEnable", true)) {
|
||||||
diagramWeight.setVisibility(View.GONE);
|
diagramWeight.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!prefs.getBoolean("fatEnable", true)) {
|
if (!prefs.getBoolean("fatEnable", true)) {
|
||||||
diagramFat.setVisibility(View.GONE);
|
diagramFat.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!prefs.getBoolean("waterEnable", true)) {
|
if (!prefs.getBoolean("waterEnable", true)) {
|
||||||
diagramWater.setVisibility(View.GONE);
|
diagramWater.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!prefs.getBoolean("muscleEnable", true)) {
|
if (!prefs.getBoolean("muscleEnable", true)) {
|
||||||
diagramMuscle.setVisibility(View.GONE);
|
diagramMuscle.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!prefs.getBoolean("lbwEnable", false)) {
|
if (!prefs.getBoolean("lbwEnable", false)) {
|
||||||
diagramLBW.setVisibility(View.GONE);
|
diagramLBW.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!prefs.getBoolean("boneEnable", false)) {
|
if (!prefs.getBoolean("boneEnable", false)) {
|
||||||
diagramBone.setVisibility(View.GONE);
|
diagramBone.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!prefs.getBoolean("waistEnable", false)) {
|
if (!prefs.getBoolean("waistEnable", false)) {
|
||||||
diagramWaist.setVisibility(View.GONE);
|
diagramWaist.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!prefs.getBoolean("hipEnable", false)) {
|
if (!prefs.getBoolean("hipEnable", false)) {
|
||||||
diagramHip.setVisibility(View.GONE);
|
diagramHip.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,8 +258,7 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
|
|
||||||
pointIndexScaleDataList = new ArrayList<>();
|
pointIndexScaleDataList = new ArrayList<>();
|
||||||
|
|
||||||
for(ScaleData scaleEntry: scaleDataList)
|
for (ScaleData scaleEntry: scaleDataList) {
|
||||||
{
|
|
||||||
calDB.setTime(scaleEntry.getDateTime());
|
calDB.setTime(scaleEntry.getDateTime());
|
||||||
|
|
||||||
if (addPointValue(valuesWeight, calDB.get(field), scaleEntry.getConvertedWeight(openScale.getSelectedScaleUser().scale_unit))) {
|
if (addPointValue(valuesWeight, calDB.get(field), scaleEntry.getConvertedWeight(openScale.getSelectedScaleUser().scale_unit))) {
|
||||||
@@ -317,63 +316,63 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
setHasPoints(prefs.getBoolean("pointsEnable", true)).
|
setHasPoints(prefs.getBoolean("pointsEnable", true)).
|
||||||
setFormatter(new SimpleLineChartValueFormatter(1));
|
setFormatter(new SimpleLineChartValueFormatter(1));
|
||||||
|
|
||||||
if(prefs.getBoolean("weightEnable", true) && prefs.getBoolean(String.valueOf(diagramWeight.getId()), true)) {
|
if (prefs.getBoolean("weightEnable", true) && prefs.getBoolean(String.valueOf(diagramWeight.getId()), true)) {
|
||||||
lines.add(lineWeight);
|
lines.add(lineWeight);
|
||||||
diagramWeight.setBackgroundTintList(ColorStateList.valueOf(ChartUtils.COLOR_VIOLET));
|
diagramWeight.setBackgroundTintList(ColorStateList.valueOf(ChartUtils.COLOR_VIOLET));
|
||||||
} else {
|
} else {
|
||||||
diagramWeight.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
diagramWeight.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("fatEnable", true) && prefs.getBoolean(String.valueOf(diagramFat.getId()), true)) {
|
if (prefs.getBoolean("fatEnable", true) && prefs.getBoolean(String.valueOf(diagramFat.getId()), true)) {
|
||||||
lines.add(lineFat);
|
lines.add(lineFat);
|
||||||
diagramFat.setBackgroundTintList(ColorStateList.valueOf(ChartUtils.COLOR_ORANGE));
|
diagramFat.setBackgroundTintList(ColorStateList.valueOf(ChartUtils.COLOR_ORANGE));
|
||||||
} else {
|
} else {
|
||||||
diagramFat.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
diagramFat.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("waterEnable", true) && prefs.getBoolean(String.valueOf(diagramWater.getId()), true)) {
|
if (prefs.getBoolean("waterEnable", true) && prefs.getBoolean(String.valueOf(diagramWater.getId()), true)) {
|
||||||
lines.add(lineWater);
|
lines.add(lineWater);
|
||||||
diagramWater.setBackgroundTintList(ColorStateList.valueOf(ChartUtils.COLOR_BLUE));
|
diagramWater.setBackgroundTintList(ColorStateList.valueOf(ChartUtils.COLOR_BLUE));
|
||||||
} else {
|
} else {
|
||||||
diagramWater.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
diagramWater.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("muscleEnable", true) && prefs.getBoolean(String.valueOf(diagramMuscle.getId()), true)) {
|
if (prefs.getBoolean("muscleEnable", true) && prefs.getBoolean(String.valueOf(diagramMuscle.getId()), true)) {
|
||||||
lines.add(lineMuscle);
|
lines.add(lineMuscle);
|
||||||
diagramMuscle.setBackgroundTintList(ColorStateList.valueOf(ChartUtils.COLOR_GREEN));
|
diagramMuscle.setBackgroundTintList(ColorStateList.valueOf(ChartUtils.COLOR_GREEN));
|
||||||
} else {
|
} else {
|
||||||
diagramMuscle.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
diagramMuscle.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("lbwEnable", false) && prefs.getBoolean(String.valueOf(diagramLBW.getId()), true)) {
|
if (prefs.getBoolean("lbwEnable", false) && prefs.getBoolean(String.valueOf(diagramLBW.getId()), true)) {
|
||||||
lines.add(lineLBW);
|
lines.add(lineLBW);
|
||||||
diagramLBW.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#cc0099")));
|
diagramLBW.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#cc0099")));
|
||||||
} else {
|
} else {
|
||||||
diagramLBW.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
diagramLBW.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("waistEnable", false) && prefs.getBoolean(String.valueOf(diagramWaist.getId()), true)) {
|
if (prefs.getBoolean("waistEnable", false) && prefs.getBoolean(String.valueOf(diagramWaist.getId()), true)) {
|
||||||
lines.add(lineWaist);
|
lines.add(lineWaist);
|
||||||
diagramWaist.setBackgroundTintList(ColorStateList.valueOf(Color.MAGENTA));
|
diagramWaist.setBackgroundTintList(ColorStateList.valueOf(Color.MAGENTA));
|
||||||
} else {
|
} else {
|
||||||
diagramWaist.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
diagramWaist.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("hipEnable", false) && prefs.getBoolean(String.valueOf(diagramHip.getId()), true)) {
|
if (prefs.getBoolean("hipEnable", false) && prefs.getBoolean(String.valueOf(diagramHip.getId()), true)) {
|
||||||
lines.add(lineHip);
|
lines.add(lineHip);
|
||||||
diagramHip.setBackgroundTintList(ColorStateList.valueOf(Color.YELLOW));
|
diagramHip.setBackgroundTintList(ColorStateList.valueOf(Color.YELLOW));
|
||||||
} else {
|
} else {
|
||||||
diagramHip.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
diagramHip.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("boneEnable", false) && prefs.getBoolean(String.valueOf(diagramBone.getId()), true)) {
|
if (prefs.getBoolean("boneEnable", false) && prefs.getBoolean(String.valueOf(diagramBone.getId()), true)) {
|
||||||
lines.add(lineBone);
|
lines.add(lineBone);
|
||||||
diagramBone.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#00cc9e")));
|
diagramBone.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#00cc9e")));
|
||||||
} else {
|
} else {
|
||||||
diagramBone.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
diagramBone.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean(String.valueOf(enableMonth.getId()), true)) {
|
if (prefs.getBoolean(String.valueOf(enableMonth.getId()), true)) {
|
||||||
enableMonth.setBackgroundTintList(ColorStateList.valueOf(ChartUtils.COLOR_BLUE));
|
enableMonth.setBackgroundTintList(ColorStateList.valueOf(ChartUtils.COLOR_BLUE));
|
||||||
} else {
|
} else {
|
||||||
enableMonth.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
enableMonth.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
||||||
@@ -414,7 +413,7 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
if (prefs.getBoolean("regressionLine", false)) {
|
if (prefs.getBoolean("regressionLine", false)) {
|
||||||
PolynomialFitter polyFitter = new PolynomialFitter(Integer.parseInt(prefs.getString("regressionLineOrder", "1")));
|
PolynomialFitter polyFitter = new PolynomialFitter(Integer.parseInt(prefs.getString("regressionLineOrder", "1")));
|
||||||
|
|
||||||
for(PointValue weightValue : valuesWeight) {
|
for (PointValue weightValue : valuesWeight) {
|
||||||
polyFitter.addPoint(weightValue.getX(), weightValue.getY());
|
polyFitter.addPoint(weightValue.getX(), weightValue.getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -217,7 +217,7 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
|||||||
int posUser = 0;
|
int posUser = 0;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
for(ScaleUser scaleUser :scaleUserList) {
|
for (ScaleUser scaleUser :scaleUserList) {
|
||||||
spinUserAdapter.add(scaleUser.user_name);
|
spinUserAdapter.add(scaleUser.user_name);
|
||||||
|
|
||||||
if (scaleUser.id == currentScaleUser.id) {
|
if (scaleUser.id == currentScaleUser.id) {
|
||||||
@@ -328,35 +328,35 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
|||||||
setHasPoints(prefs.getBoolean("pointsEnable", true)).
|
setHasPoints(prefs.getBoolean("pointsEnable", true)).
|
||||||
setFormatter(new SimpleLineChartValueFormatter(1));
|
setFormatter(new SimpleLineChartValueFormatter(1));
|
||||||
|
|
||||||
if(prefs.getBoolean("weightEnable", true)) {
|
if (prefs.getBoolean("weightEnable", true)) {
|
||||||
lines.add(lineWeight);
|
lines.add(lineWeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("fatEnable", true)) {
|
if (prefs.getBoolean("fatEnable", true)) {
|
||||||
lines.add(lineFat);
|
lines.add(lineFat);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("waterEnable", true)) {
|
if (prefs.getBoolean("waterEnable", true)) {
|
||||||
lines.add(lineWater);
|
lines.add(lineWater);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("muscleEnable", true)) {
|
if (prefs.getBoolean("muscleEnable", true)) {
|
||||||
lines.add(lineMuscle);
|
lines.add(lineMuscle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("lbwEnable", false)) {
|
if (prefs.getBoolean("lbwEnable", false)) {
|
||||||
lines.add(lineLBW);
|
lines.add(lineLBW);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("waistEnable", false)) {
|
if (prefs.getBoolean("waistEnable", false)) {
|
||||||
lines.add(lineWaist);
|
lines.add(lineWaist);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("hipEnable", false)) {
|
if (prefs.getBoolean("hipEnable", false)) {
|
||||||
lines.add(lineHip);
|
lines.add(lineHip);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("boneEnable", false)) {
|
if (prefs.getBoolean("boneEnable", false)) {
|
||||||
lines.add(lineBone);
|
lines.add(lineBone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -467,7 +467,7 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
|||||||
public void onValueSelected(int lineIndex, int pointIndex, PointValue pointValue) {
|
public void onValueSelected(int lineIndex, int pointIndex, PointValue pointValue) {
|
||||||
userSelectedData = scaleDataLastDays.get(pointIndex);
|
userSelectedData = scaleDataLastDays.get(pointIndex);
|
||||||
|
|
||||||
updateOnView( OpenScale.getInstance(getContext()).getScaleDataList());
|
updateOnView(OpenScale.getInstance(getContext()).getScaleDataList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -272,38 +272,38 @@ public class StatisticsFragment extends Fragment implements FragmentUpdateListen
|
|||||||
info_month += String.format("Ø-"+getResources().getString(R.string.label_bmi)+": %.1f <br>", monthAvgBMI);
|
info_month += String.format("Ø-"+getResources().getString(R.string.label_bmi)+": %.1f <br>", monthAvgBMI);
|
||||||
lines++;
|
lines++;
|
||||||
|
|
||||||
if(prefs.getBoolean("fatEnable", true)) {
|
if (prefs.getBoolean("fatEnable", true)) {
|
||||||
info_week += String.format("Ø-"+getResources().getString(R.string.label_fat)+": %.1f%% <br>", weekAvgFat);
|
info_week += String.format("Ø-"+getResources().getString(R.string.label_fat)+": %.1f%% <br>", weekAvgFat);
|
||||||
info_month += String.format("Ø-"+getResources().getString(R.string.label_fat)+": %.1f%% <br>", monthAvgFat);
|
info_month += String.format("Ø-"+getResources().getString(R.string.label_fat)+": %.1f%% <br>", monthAvgFat);
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("muscleEnable", true)) {
|
if (prefs.getBoolean("muscleEnable", true)) {
|
||||||
info_week += String.format("Ø-"+getResources().getString(R.string.label_muscle)+": %.1f%% <br>", weekAvgMuscle);
|
info_week += String.format("Ø-"+getResources().getString(R.string.label_muscle)+": %.1f%% <br>", weekAvgMuscle);
|
||||||
info_month += String.format("Ø-"+getResources().getString(R.string.label_muscle)+": %.1f%% <br>", monthAvgMuscle);
|
info_month += String.format("Ø-"+getResources().getString(R.string.label_muscle)+": %.1f%% <br>", monthAvgMuscle);
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("lbwEnable", false)) {
|
if (prefs.getBoolean("lbwEnable", false)) {
|
||||||
info_week += String.format("Ø-"+getResources().getString(R.string.label_lbw)+": %.1fkg <br>", weekAvgLBW);
|
info_week += String.format("Ø-"+getResources().getString(R.string.label_lbw)+": %.1fkg <br>", weekAvgLBW);
|
||||||
info_month += String.format("Ø-"+getResources().getString(R.string.label_lbw)+": %.1fkg <br>", monthAvgLBW);
|
info_month += String.format("Ø-"+getResources().getString(R.string.label_lbw)+": %.1fkg <br>", monthAvgLBW);
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("waterEnable", true)) {
|
if (prefs.getBoolean("waterEnable", true)) {
|
||||||
info_week += String.format("Ø-"+getResources().getString(R.string.label_water)+": %.1f%% <br>", weekAvgWater);
|
info_week += String.format("Ø-"+getResources().getString(R.string.label_water)+": %.1f%% <br>", weekAvgWater);
|
||||||
info_month += String.format("Ø-"+getResources().getString(R.string.label_water)+": %.1f%% <br>", monthAvgWater);
|
info_month += String.format("Ø-"+getResources().getString(R.string.label_water)+": %.1f%% <br>", monthAvgWater);
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("boneEnable", false)) {
|
if (prefs.getBoolean("boneEnable", false)) {
|
||||||
info_week += String.format("Ø-"+getResources().getString(R.string.label_bone)+": %.1fkg <br>", weekAvgBone);
|
info_week += String.format("Ø-"+getResources().getString(R.string.label_bone)+": %.1fkg <br>", weekAvgBone);
|
||||||
info_month += String.format("Ø-"+getResources().getString(R.string.label_bone)+": %.1fkg <br>",monthAvgBone);
|
info_month += String.format("Ø-"+getResources().getString(R.string.label_bone)+": %.1fkg <br>",monthAvgBone);
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(prefs.getBoolean("waistEnable", false)) {
|
if (prefs.getBoolean("waistEnable", false)) {
|
||||||
info_week += String.format("Ø-"+getResources().getString(R.string.label_waist)+": %.1fcm <br>", weekAvgWaist);
|
info_week += String.format("Ø-"+getResources().getString(R.string.label_waist)+": %.1fcm <br>", weekAvgWaist);
|
||||||
info_month += String.format("Ø-"+getResources().getString(R.string.label_waist)+": %.1fcm <br>", monthAvgWaist);
|
info_month += String.format("Ø-"+getResources().getString(R.string.label_waist)+": %.1fcm <br>", monthAvgWaist);
|
||||||
lines++;
|
lines++;
|
||||||
@@ -313,13 +313,13 @@ public class StatisticsFragment extends Fragment implements FragmentUpdateListen
|
|||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("hipEnable", false)) {
|
if (prefs.getBoolean("hipEnable", false)) {
|
||||||
info_week += String.format("Ø-"+getResources().getString(R.string.label_hip)+": %.1fcm <br>", weekAvgHip);
|
info_week += String.format("Ø-"+getResources().getString(R.string.label_hip)+": %.1fcm <br>", weekAvgHip);
|
||||||
info_month += String.format("Ø-"+getResources().getString(R.string.label_hip)+": %.1fcm <br>",monthAvgHip);
|
info_month += String.format("Ø-"+getResources().getString(R.string.label_hip)+": %.1fcm <br>",monthAvgHip);
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prefs.getBoolean("hipEnable", false) && prefs.getBoolean("waistEnable", false)) {
|
if (prefs.getBoolean("hipEnable", false) && prefs.getBoolean("waistEnable", false)) {
|
||||||
info_week += String.format("Ø-"+getResources().getString(R.string.label_whr)+": %.2f <br>", weekAvgWHR);
|
info_week += String.format("Ø-"+getResources().getString(R.string.label_whr)+": %.2f <br>", weekAvgWHR);
|
||||||
info_month += String.format("Ø-"+getResources().getString(R.string.label_whr)+": %.2f <br>", monthAvgWHR);
|
info_month += String.format("Ø-"+getResources().getString(R.string.label_whr)+": %.2f <br>", monthAvgWHR);
|
||||||
lines++;
|
lines++;
|
||||||
|
@@ -396,7 +396,7 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
private ArrayList<HashMap<Integer, String>> dataList;
|
private ArrayList<HashMap<Integer, String>> dataList;
|
||||||
private LinearLayout row;
|
private LinearLayout row;
|
||||||
|
|
||||||
public ListViewAdapter(ArrayList<HashMap<Integer, String>> list){
|
public ListViewAdapter(ArrayList<HashMap<Integer, String>> list) {
|
||||||
super();
|
super();
|
||||||
this.dataList =list;
|
this.dataList =list;
|
||||||
}
|
}
|
||||||
@@ -422,7 +422,7 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(convertView == null){
|
if (convertView == null) {
|
||||||
row = new LinearLayout(getContext());
|
row = new LinearLayout(getContext());
|
||||||
convertView = row;
|
convertView = row;
|
||||||
|
|
||||||
|
@@ -135,12 +135,12 @@ public class BackupPreferences extends PreferenceFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean importBackup(String databaseName, File exportDir) {
|
private boolean importBackup(String databaseName, File exportDir) {
|
||||||
if(!isExternalStoragePresent())
|
if (!isExternalStoragePresent())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
File exportFile = new File(Environment.getDataDirectory() +
|
File exportFile = new File(Environment.getDataDirectory() +
|
||||||
"/data/com.health.openscale" +
|
"/data/com.health.openscale" +
|
||||||
"/databases/" + databaseName );
|
"/databases/" + databaseName);
|
||||||
File importFile = new File(exportDir, databaseName);
|
File importFile = new File(exportDir, databaseName);
|
||||||
|
|
||||||
if (!importFile.exists()) {
|
if (!importFile.exists()) {
|
||||||
@@ -161,12 +161,12 @@ public class BackupPreferences extends PreferenceFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean exportBackup(String databaseName, File exportDir) {
|
private boolean exportBackup(String databaseName, File exportDir) {
|
||||||
if(!isExternalStoragePresent())
|
if (!isExternalStoragePresent())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
File dbFile = new File(Environment.getDataDirectory() +
|
File dbFile = new File(Environment.getDataDirectory() +
|
||||||
"/data/com.health.openscale" +
|
"/data/com.health.openscale" +
|
||||||
"/databases/" + databaseName );
|
"/databases/" + databaseName);
|
||||||
|
|
||||||
File file = new File(exportDir, databaseName);
|
File file = new File(exportDir, databaseName);
|
||||||
|
|
||||||
|
@@ -82,14 +82,14 @@ public class UsersPreferences extends PreferenceFragment {
|
|||||||
public void onActivityResult(int requestCode, int resultCode, Intent data)
|
public void onActivityResult(int requestCode, int resultCode, Intent data)
|
||||||
{
|
{
|
||||||
if (requestCode == UserSettingsActivity.ADD_USER_REQUEST) {
|
if (requestCode == UserSettingsActivity.ADD_USER_REQUEST) {
|
||||||
if(resultCode == RESULT_OK){
|
if (resultCode == RESULT_OK) {
|
||||||
updateUserPreferences();
|
updateUserPreferences();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (requestCode == UserSettingsActivity.EDIT_USER_REQUEST) {
|
if (requestCode == UserSettingsActivity.EDIT_USER_REQUEST) {
|
||||||
if(resultCode == RESULT_OK){
|
if (resultCode == RESULT_OK) {
|
||||||
updateUserPreferences();
|
updateUserPreferences();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -285,7 +285,7 @@ public abstract class MeasurementView extends TableLayout {
|
|||||||
dateTime = objTimeDate;
|
dateTime = objTimeDate;
|
||||||
value = String.valueOf(objValue);
|
value = String.valueOf(objValue);
|
||||||
|
|
||||||
try{
|
try {
|
||||||
Float floatValue = Float.parseFloat(value);
|
Float floatValue = Float.parseFloat(value);
|
||||||
if (measurementMode == VIEW || measurementMode == EDIT) {
|
if (measurementMode == VIEW || measurementMode == EDIT) {
|
||||||
evaluate(floatValue);
|
evaluate(floatValue);
|
||||||
@@ -306,7 +306,7 @@ public abstract class MeasurementView extends TableLayout {
|
|||||||
if (diff > 0.0) {
|
if (diff > 0.0) {
|
||||||
symbol = SYMBOL_UP;
|
symbol = SYMBOL_UP;
|
||||||
symbol_color = "<font color='green'>" + SYMBOL_UP + "</font>";
|
symbol_color = "<font color='green'>" + SYMBOL_UP + "</font>";
|
||||||
} else if (diff < 0.0){
|
} else if (diff < 0.0) {
|
||||||
symbol = SYMBOL_DOWN;
|
symbol = SYMBOL_DOWN;
|
||||||
symbol_color = "<font color='red'>" + SYMBOL_DOWN + "</font>";
|
symbol_color = "<font color='red'>" + SYMBOL_DOWN + "</font>";
|
||||||
} else {
|
} else {
|
||||||
@@ -335,8 +335,8 @@ public abstract class MeasurementView extends TableLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setVisible(boolean isVisible){
|
protected void setVisible(boolean isVisible) {
|
||||||
if(isVisible) {
|
if (isVisible) {
|
||||||
measurementRow.setVisibility(View.VISIBLE);
|
measurementRow.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
measurementRow.setVisibility(View.GONE);
|
measurementRow.setVisibility(View.GONE);
|
||||||
@@ -378,7 +378,7 @@ public abstract class MeasurementView extends TableLayout {
|
|||||||
evaluatorView.setLimits(evalResult.lowLimit, evalResult.highLimit);
|
evaluatorView.setLimits(evalResult.lowLimit, evalResult.highLimit);
|
||||||
evaluatorView.setValue(value);
|
evaluatorView.setValue(value);
|
||||||
|
|
||||||
switch(evalResult.eval_state)
|
switch (evalResult.eval_state)
|
||||||
{
|
{
|
||||||
case LOW:
|
case LOW:
|
||||||
indicatorView.setBackgroundColor(ChartUtils.COLOR_BLUE);
|
indicatorView.setBackgroundColor(ChartUtils.COLOR_BLUE);
|
||||||
|
Reference in New Issue
Block a user