mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-23 16:53: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);
|
||||
|
||||
for(FragmentUpdateListener fragment : fragmentList) {
|
||||
for (FragmentUpdateListener fragment : fragmentList) {
|
||||
if (fragment != null) {
|
||||
if (((Fragment)fragment).isAdded()) {
|
||||
fragment.updateOnView(scaleDataList);
|
||||
|
@@ -59,10 +59,10 @@ public class AlarmHandler
|
||||
Calendar dataTimestamp = Calendar.getInstance();
|
||||
dataTimestamp.setTimeInMillis(dataMillis);
|
||||
|
||||
if(AlarmHandler.isSameDate(dataTimestamp, Calendar.getInstance()))
|
||||
if (AlarmHandler.isSameDate(dataTimestamp, Calendar.getInstance()))
|
||||
{
|
||||
cancelAlarmNotification(context);
|
||||
cancelAndRescheduleAlarmForNextWeek( context, dataTimestamp );
|
||||
cancelAndRescheduleAlarmForNextWeek(context, dataTimestamp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -240,7 +240,7 @@ public abstract class BluetoothCommunication {
|
||||
* @param gattCharacteristic the Bluetooth Gatt characteristic
|
||||
* @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.
|
||||
@@ -248,7 +248,7 @@ public abstract class BluetoothCommunication {
|
||||
* @param bluetoothGatt the Bluetooth Gatt
|
||||
* @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.
|
||||
@@ -369,7 +369,7 @@ public abstract class BluetoothCommunication {
|
||||
}
|
||||
|
||||
final StringBuilder stringBuilder = new StringBuilder(data.length);
|
||||
for(byte byteChar : data) {
|
||||
for (byte byteChar : data) {
|
||||
stringBuilder.append(String.format("%02X ", byteChar));
|
||||
}
|
||||
|
||||
|
@@ -133,7 +133,7 @@ public class BluetoothDigooDGSO38H extends BluetoothCommunication {
|
||||
ScaleData scaleBtData = new ScaleData();
|
||||
weight = (float) (((weightBytes[3] & 0xFF) << 8) | (weightBytes[4] & 0xFF)) / 100.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 " +
|
||||
"is done, but fat ist still zero. Settling for just adding weight.");
|
||||
} else {
|
||||
|
@@ -47,19 +47,19 @@ public class BluetoothMGB extends BluetoothCommunication {
|
||||
|
||||
|
||||
|
||||
private int popInt( ){
|
||||
private int popInt() {
|
||||
return packet_buf[packet_pos++] & 0xFF;
|
||||
}
|
||||
|
||||
|
||||
private float popFloat( ){
|
||||
private float popFloat() {
|
||||
int r = popInt();
|
||||
r = popInt() | (r<<8);
|
||||
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];
|
||||
buf[0] = (byte)0xAC;
|
||||
buf[1] = (byte)0x02;
|
||||
@@ -68,15 +68,13 @@ public class BluetoothMGB extends BluetoothCommunication {
|
||||
buf[4] = (byte)b4;
|
||||
buf[5] = (byte)b5;
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -105,33 +103,33 @@ public class BluetoothMGB extends BluetoothCommunication {
|
||||
boolean nextInitCmd(int stateNr) {
|
||||
switch (stateNr) {
|
||||
case 0:
|
||||
setNotificationOn( uuid_service , uuid_char_ctrl , uuid_desc_ctrl );
|
||||
setNotificationOn(uuid_service, uuid_char_ctrl, uuid_desc_ctrl);
|
||||
now = Calendar.getInstance();
|
||||
user = OpenScale.getInstance(context).getSelectedScaleUser();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
writeCfg( 0xF7 , 0 , 0 , 0 );
|
||||
writeCfg(0xF7, 0, 0, 0);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
writeCfg( 0xFA , 0 , 0 , 0 );
|
||||
writeCfg(0xFA, 0, 0, 0);
|
||||
break;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
case 6:
|
||||
writeCfg( 0xFE , 6 , 1 , 0 );
|
||||
writeCfg(0xFE, 6, 1, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -159,11 +157,11 @@ public class BluetoothMGB extends BluetoothCommunication {
|
||||
packet_buf = gattCharacteristic.getValue();
|
||||
packet_pos = 0;
|
||||
|
||||
if( packet_buf == null || packet_buf.length <= 0 ){
|
||||
if (packet_buf == null || packet_buf.length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( packet_buf.length != 20 ){
|
||||
if (packet_buf.length != 20) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -171,7 +169,7 @@ public class BluetoothMGB extends BluetoothCommunication {
|
||||
int hdr_2 = 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();
|
||||
|
||||
popInt(); //unknown =00
|
||||
@@ -185,26 +183,25 @@ public class BluetoothMGB extends BluetoothCommunication {
|
||||
popInt(); //Minute
|
||||
popInt(); //Second
|
||||
|
||||
measurement.setDateTime( new Date() );
|
||||
measurement.setDateTime(new Date());
|
||||
|
||||
measurement.setWeight( popFloat() );
|
||||
measurement.setWeight(popFloat());
|
||||
|
||||
popFloat(); //BMI
|
||||
|
||||
measurement.setFat( popFloat() );
|
||||
measurement.setFat(popFloat());
|
||||
|
||||
popInt(); //unknown =00
|
||||
popInt(); //unknown =00
|
||||
|
||||
}else
|
||||
if( hdr_1 == 0x01 && hdr_2 == 0x00 ){
|
||||
measurement.setMuscle( popFloat() );
|
||||
} else if (hdr_1 == 0x01 && hdr_2 == 0x00) {
|
||||
measurement.setMuscle(popFloat());
|
||||
|
||||
popFloat(); //BMR
|
||||
|
||||
measurement.setBone( popFloat() );
|
||||
measurement.setBone(popFloat());
|
||||
|
||||
measurement.setWater( popFloat() );
|
||||
measurement.setWater(popFloat());
|
||||
|
||||
popInt(); // Age
|
||||
|
||||
@@ -217,7 +214,7 @@ public class BluetoothMGB extends BluetoothCommunication {
|
||||
popInt(); // unknown =02
|
||||
popInt(); // unknown =47;48;4e;4b;42
|
||||
|
||||
addScaleData( measurement );
|
||||
addScaleData(measurement);
|
||||
|
||||
// Visceral fat?
|
||||
// Standart weight?
|
||||
|
@@ -60,12 +60,12 @@ public class BluetoothMedisanaBS444 extends BluetoothCommunication {
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean nextInitCmd(int stateNr){
|
||||
boolean nextInitCmd(int stateNr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean nextBluetoothCmd(int stateNr){
|
||||
boolean nextBluetoothCmd(int stateNr) {
|
||||
switch (stateNr) {
|
||||
case 0:
|
||||
// set indication on for feature characteristic
|
||||
@@ -82,7 +82,7 @@ public class BluetoothMedisanaBS444 extends BluetoothCommunication {
|
||||
case 3:
|
||||
// send magic number to receive weight data
|
||||
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)0x02,
|
||||
@@ -103,13 +103,13 @@ public class BluetoothMedisanaBS444 extends BluetoothCommunication {
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean nextCleanUpCmd(int stateNr){
|
||||
boolean nextCleanUpCmd(int stateNr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBluetoothDataChange(BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic gattCharacteristic){
|
||||
public void onBluetoothDataChange(BluetoothGatt bluetoothGatt, BluetoothGattCharacteristic gattCharacteristic) {
|
||||
final byte[] data = gattCharacteristic.getValue();
|
||||
|
||||
if (gattCharacteristic.getUuid().equals(WEIGHT_MEASUREMENT_CHARACTERISTIC)) {
|
||||
|
@@ -21,7 +21,7 @@ import com.health.openscale.core.datatypes.ScaleUser;
|
||||
public abstract class EstimatedFatMetric {
|
||||
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) {
|
||||
case BF_DEURENBERG:
|
||||
return new BFDeurenberg();
|
||||
|
@@ -21,7 +21,7 @@ import com.health.openscale.core.datatypes.ScaleUser;
|
||||
public abstract class EstimatedWaterMetric {
|
||||
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) {
|
||||
case TBW_BEHNKE:
|
||||
return new TBWBehnke();
|
||||
|
@@ -421,7 +421,7 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
} catch (ParseException ex) {
|
||||
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());
|
||||
}
|
||||
|
||||
|
@@ -227,7 +227,7 @@ public class ScaleUserDatabase extends SQLiteOpenHelper {
|
||||
} catch (ParseException ex) {
|
||||
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());
|
||||
}
|
||||
|
||||
|
@@ -194,7 +194,7 @@ public class ScaleData {
|
||||
}
|
||||
|
||||
public float getWHtR(int body_height) {
|
||||
return waist / (float)body_height ;
|
||||
return waist / (float)body_height;
|
||||
}
|
||||
|
||||
public float getWHR() {
|
||||
|
@@ -173,26 +173,22 @@ public class UserSettingsActivity extends Activity {
|
||||
{
|
||||
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));
|
||||
validate = false;
|
||||
}
|
||||
|
||||
if( txtBodyHeight.getText().toString().length() == 0 )
|
||||
{
|
||||
if (txtBodyHeight.getText().toString().length() == 0) {
|
||||
txtBodyHeight.setError(getResources().getString(R.string.error_body_height_required));
|
||||
validate = false;
|
||||
}
|
||||
|
||||
if( txtInitialWeight.getText().toString().length() == 0 )
|
||||
{
|
||||
if (txtInitialWeight.getText().toString().length() == 0) {
|
||||
txtInitialWeight.setError(getResources().getString(R.string.error_initial_weight_required));
|
||||
validate = false;
|
||||
}
|
||||
|
||||
if( txtGoalWeight.getText().toString().length() == 0 )
|
||||
{
|
||||
if (txtGoalWeight.getText().toString().length() == 0) {
|
||||
txtGoalWeight.setError(getResources().getString(R.string.error_goal_weight_required));
|
||||
validate = false;
|
||||
}
|
||||
|
@@ -131,35 +131,35 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
||||
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(graphView.getContext());
|
||||
|
||||
if(!prefs.getBoolean("weightEnable", true)) {
|
||||
if (!prefs.getBoolean("weightEnable", true)) {
|
||||
diagramWeight.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("fatEnable", true)) {
|
||||
if (!prefs.getBoolean("fatEnable", true)) {
|
||||
diagramFat.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("waterEnable", true)) {
|
||||
if (!prefs.getBoolean("waterEnable", true)) {
|
||||
diagramWater.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("muscleEnable", true)) {
|
||||
if (!prefs.getBoolean("muscleEnable", true)) {
|
||||
diagramMuscle.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("lbwEnable", false)) {
|
||||
if (!prefs.getBoolean("lbwEnable", false)) {
|
||||
diagramLBW.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("boneEnable", false)) {
|
||||
if (!prefs.getBoolean("boneEnable", false)) {
|
||||
diagramBone.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("waistEnable", false)) {
|
||||
if (!prefs.getBoolean("waistEnable", false)) {
|
||||
diagramWaist.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(!prefs.getBoolean("hipEnable", false)) {
|
||||
if (!prefs.getBoolean("hipEnable", false)) {
|
||||
diagramHip.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@@ -258,8 +258,7 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
||||
|
||||
pointIndexScaleDataList = new ArrayList<>();
|
||||
|
||||
for(ScaleData scaleEntry: scaleDataList)
|
||||
{
|
||||
for (ScaleData scaleEntry: scaleDataList) {
|
||||
calDB.setTime(scaleEntry.getDateTime());
|
||||
|
||||
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)).
|
||||
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);
|
||||
diagramWeight.setBackgroundTintList(ColorStateList.valueOf(ChartUtils.COLOR_VIOLET));
|
||||
} else {
|
||||
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);
|
||||
diagramFat.setBackgroundTintList(ColorStateList.valueOf(ChartUtils.COLOR_ORANGE));
|
||||
} else {
|
||||
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);
|
||||
diagramWater.setBackgroundTintList(ColorStateList.valueOf(ChartUtils.COLOR_BLUE));
|
||||
} else {
|
||||
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);
|
||||
diagramMuscle.setBackgroundTintList(ColorStateList.valueOf(ChartUtils.COLOR_GREEN));
|
||||
} else {
|
||||
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);
|
||||
diagramLBW.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#cc0099")));
|
||||
} else {
|
||||
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);
|
||||
diagramWaist.setBackgroundTintList(ColorStateList.valueOf(Color.MAGENTA));
|
||||
} else {
|
||||
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);
|
||||
diagramHip.setBackgroundTintList(ColorStateList.valueOf(Color.YELLOW));
|
||||
} else {
|
||||
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);
|
||||
diagramBone.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#00cc9e")));
|
||||
} else {
|
||||
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));
|
||||
} else {
|
||||
enableMonth.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
||||
@@ -414,7 +413,7 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
||||
if (prefs.getBoolean("regressionLine", false)) {
|
||||
PolynomialFitter polyFitter = new PolynomialFitter(Integer.parseInt(prefs.getString("regressionLineOrder", "1")));
|
||||
|
||||
for(PointValue weightValue : valuesWeight) {
|
||||
for (PointValue weightValue : valuesWeight) {
|
||||
polyFitter.addPoint(weightValue.getX(), weightValue.getY());
|
||||
}
|
||||
|
||||
|
@@ -217,7 +217,7 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
int posUser = 0;
|
||||
int pos = 0;
|
||||
|
||||
for(ScaleUser scaleUser :scaleUserList) {
|
||||
for (ScaleUser scaleUser :scaleUserList) {
|
||||
spinUserAdapter.add(scaleUser.user_name);
|
||||
|
||||
if (scaleUser.id == currentScaleUser.id) {
|
||||
@@ -328,35 +328,35 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
setHasPoints(prefs.getBoolean("pointsEnable", true)).
|
||||
setFormatter(new SimpleLineChartValueFormatter(1));
|
||||
|
||||
if(prefs.getBoolean("weightEnable", true)) {
|
||||
if (prefs.getBoolean("weightEnable", true)) {
|
||||
lines.add(lineWeight);
|
||||
}
|
||||
|
||||
if(prefs.getBoolean("fatEnable", true)) {
|
||||
if (prefs.getBoolean("fatEnable", true)) {
|
||||
lines.add(lineFat);
|
||||
}
|
||||
|
||||
if(prefs.getBoolean("waterEnable", true)) {
|
||||
if (prefs.getBoolean("waterEnable", true)) {
|
||||
lines.add(lineWater);
|
||||
}
|
||||
|
||||
if(prefs.getBoolean("muscleEnable", true)) {
|
||||
if (prefs.getBoolean("muscleEnable", true)) {
|
||||
lines.add(lineMuscle);
|
||||
}
|
||||
|
||||
if(prefs.getBoolean("lbwEnable", false)) {
|
||||
if (prefs.getBoolean("lbwEnable", false)) {
|
||||
lines.add(lineLBW);
|
||||
}
|
||||
|
||||
if(prefs.getBoolean("waistEnable", false)) {
|
||||
if (prefs.getBoolean("waistEnable", false)) {
|
||||
lines.add(lineWaist);
|
||||
}
|
||||
|
||||
if(prefs.getBoolean("hipEnable", false)) {
|
||||
if (prefs.getBoolean("hipEnable", false)) {
|
||||
lines.add(lineHip);
|
||||
}
|
||||
|
||||
if(prefs.getBoolean("boneEnable", false)) {
|
||||
if (prefs.getBoolean("boneEnable", false)) {
|
||||
lines.add(lineBone);
|
||||
}
|
||||
|
||||
@@ -467,7 +467,7 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
public void onValueSelected(int lineIndex, int pointIndex, PointValue pointValue) {
|
||||
userSelectedData = scaleDataLastDays.get(pointIndex);
|
||||
|
||||
updateOnView( OpenScale.getInstance(getContext()).getScaleDataList());
|
||||
updateOnView(OpenScale.getInstance(getContext()).getScaleDataList());
|
||||
}
|
||||
|
||||
@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);
|
||||
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_month += String.format("Ø-"+getResources().getString(R.string.label_fat)+": %.1f%% <br>", monthAvgFat);
|
||||
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_month += String.format("Ø-"+getResources().getString(R.string.label_muscle)+": %.1f%% <br>", monthAvgMuscle);
|
||||
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_month += String.format("Ø-"+getResources().getString(R.string.label_lbw)+": %.1fkg <br>", monthAvgLBW);
|
||||
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_month += String.format("Ø-"+getResources().getString(R.string.label_water)+": %.1f%% <br>", monthAvgWater);
|
||||
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_month += String.format("Ø-"+getResources().getString(R.string.label_bone)+": %.1fkg <br>",monthAvgBone);
|
||||
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_month += String.format("Ø-"+getResources().getString(R.string.label_waist)+": %.1fcm <br>", monthAvgWaist);
|
||||
lines++;
|
||||
@@ -313,13 +313,13 @@ public class StatisticsFragment extends Fragment implements FragmentUpdateListen
|
||||
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_month += String.format("Ø-"+getResources().getString(R.string.label_hip)+": %.1fcm <br>",monthAvgHip);
|
||||
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_month += String.format("Ø-"+getResources().getString(R.string.label_whr)+": %.2f <br>", monthAvgWHR);
|
||||
lines++;
|
||||
|
@@ -396,7 +396,7 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
||||
private ArrayList<HashMap<Integer, String>> dataList;
|
||||
private LinearLayout row;
|
||||
|
||||
public ListViewAdapter(ArrayList<HashMap<Integer, String>> list){
|
||||
public ListViewAdapter(ArrayList<HashMap<Integer, String>> list) {
|
||||
super();
|
||||
this.dataList =list;
|
||||
}
|
||||
@@ -422,7 +422,7 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
||||
return convertView;
|
||||
}
|
||||
|
||||
if(convertView == null){
|
||||
if (convertView == null) {
|
||||
row = new LinearLayout(getContext());
|
||||
convertView = row;
|
||||
|
||||
|
@@ -135,12 +135,12 @@ public class BackupPreferences extends PreferenceFragment {
|
||||
}
|
||||
|
||||
private boolean importBackup(String databaseName, File exportDir) {
|
||||
if(!isExternalStoragePresent())
|
||||
if (!isExternalStoragePresent())
|
||||
return false;
|
||||
|
||||
File exportFile = new File(Environment.getDataDirectory() +
|
||||
"/data/com.health.openscale" +
|
||||
"/databases/" + databaseName );
|
||||
"/databases/" + databaseName);
|
||||
File importFile = new File(exportDir, databaseName);
|
||||
|
||||
if (!importFile.exists()) {
|
||||
@@ -161,12 +161,12 @@ public class BackupPreferences extends PreferenceFragment {
|
||||
}
|
||||
|
||||
private boolean exportBackup(String databaseName, File exportDir) {
|
||||
if(!isExternalStoragePresent())
|
||||
if (!isExternalStoragePresent())
|
||||
return false;
|
||||
|
||||
File dbFile = new File(Environment.getDataDirectory() +
|
||||
"/data/com.health.openscale" +
|
||||
"/databases/" + databaseName );
|
||||
"/databases/" + 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)
|
||||
{
|
||||
if (requestCode == UserSettingsActivity.ADD_USER_REQUEST) {
|
||||
if(resultCode == RESULT_OK){
|
||||
if (resultCode == RESULT_OK) {
|
||||
updateUserPreferences();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (requestCode == UserSettingsActivity.EDIT_USER_REQUEST) {
|
||||
if(resultCode == RESULT_OK){
|
||||
if (resultCode == RESULT_OK) {
|
||||
updateUserPreferences();
|
||||
}
|
||||
}
|
||||
|
@@ -285,7 +285,7 @@ public abstract class MeasurementView extends TableLayout {
|
||||
dateTime = objTimeDate;
|
||||
value = String.valueOf(objValue);
|
||||
|
||||
try{
|
||||
try {
|
||||
Float floatValue = Float.parseFloat(value);
|
||||
if (measurementMode == VIEW || measurementMode == EDIT) {
|
||||
evaluate(floatValue);
|
||||
@@ -306,7 +306,7 @@ public abstract class MeasurementView extends TableLayout {
|
||||
if (diff > 0.0) {
|
||||
symbol = SYMBOL_UP;
|
||||
symbol_color = "<font color='green'>" + SYMBOL_UP + "</font>";
|
||||
} else if (diff < 0.0){
|
||||
} else if (diff < 0.0) {
|
||||
symbol = SYMBOL_DOWN;
|
||||
symbol_color = "<font color='red'>" + SYMBOL_DOWN + "</font>";
|
||||
} else {
|
||||
@@ -335,8 +335,8 @@ public abstract class MeasurementView extends TableLayout {
|
||||
}
|
||||
}
|
||||
|
||||
protected void setVisible(boolean isVisible){
|
||||
if(isVisible) {
|
||||
protected void setVisible(boolean isVisible) {
|
||||
if (isVisible) {
|
||||
measurementRow.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
measurementRow.setVisibility(View.GONE);
|
||||
@@ -378,7 +378,7 @@ public abstract class MeasurementView extends TableLayout {
|
||||
evaluatorView.setLimits(evalResult.lowLimit, evalResult.highLimit);
|
||||
evaluatorView.setValue(value);
|
||||
|
||||
switch(evalResult.eval_state)
|
||||
switch (evalResult.eval_state)
|
||||
{
|
||||
case LOW:
|
||||
indicatorView.setBackgroundColor(ChartUtils.COLOR_BLUE);
|
||||
|
Reference in New Issue
Block a user