mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-20 07:21:40 +02:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -68,7 +68,7 @@ public class UserAddTest {
|
||||
@Rule
|
||||
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class, false, false);
|
||||
|
||||
private void setLangauge(String language, String country) {
|
||||
private void setLanguage(String language, String country) {
|
||||
Locale locale = new Locale(language, country);
|
||||
Locale.setDefault(locale);
|
||||
Resources res = context.getResources();
|
||||
@@ -82,7 +82,7 @@ public class UserAddTest {
|
||||
context = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
// set app language to English
|
||||
setLangauge("en", "EN");
|
||||
setLanguage("en", "EN");
|
||||
|
||||
// Set first start to true to get the user add dialog
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
@@ -319,7 +319,7 @@ public class OpenScale {
|
||||
for (int i = 0; i < scaleUsers.size(); i++) {
|
||||
List<ScaleMeasurement> scaleUserData = measurementDAO.getAll(scaleUsers.get(i).getId());
|
||||
|
||||
float lastWeight = 0;
|
||||
float lastWeight;
|
||||
|
||||
if (scaleUserData.size() > 0) {
|
||||
lastWeight = scaleUserData.get(0).getWeight();
|
||||
|
@@ -315,7 +315,7 @@ public abstract class BluetoothCommunication {
|
||||
*
|
||||
* @param value byte which is tested
|
||||
* @param bit bit position which is tested
|
||||
* @return true if bit is set (1) ohterwise false (0)
|
||||
* @return true if bit is set (1) otherwise false (0)
|
||||
*/
|
||||
protected boolean isBitSet(byte value, int bit) {
|
||||
return (value & (1 << bit)) != 0;
|
||||
|
@@ -201,7 +201,7 @@ public class BluetoothMGB extends BluetoothCommunication {
|
||||
addScaleData(measurement);
|
||||
|
||||
// Visceral fat?
|
||||
// Standart weight?
|
||||
// Standard weight?
|
||||
// WeightControl?
|
||||
// Body fat?
|
||||
// Muscle weight?
|
||||
|
@@ -196,8 +196,6 @@ public class BluetoothMiScale extends BluetoothCommunication {
|
||||
|
||||
private void parseBytes(byte[] weightBytes) {
|
||||
try {
|
||||
float weight = 0.0f;
|
||||
|
||||
final byte ctrlByte = weightBytes[0];
|
||||
|
||||
final boolean isWeightRemoved = isBitSet(ctrlByte, 7);
|
||||
@@ -224,6 +222,7 @@ public class BluetoothMiScale extends BluetoothCommunication {
|
||||
final int min = (int) weightBytes[8];
|
||||
final int sec = (int) weightBytes[9];
|
||||
|
||||
float weight;
|
||||
if (isLBSUnit || isCattyUnit) {
|
||||
weight = (float) (((weightBytes[2] & 0xFF) << 8) | (weightBytes[1] & 0xFF)) / 100.0f;
|
||||
} else {
|
||||
|
@@ -175,8 +175,6 @@ public class BluetoothMiScale2 extends BluetoothCommunication {
|
||||
|
||||
private void parseBytes(byte[] weightBytes) {
|
||||
try {
|
||||
float weight = 0.0f;
|
||||
|
||||
final byte ctrlByte0 = weightBytes[0];
|
||||
final byte ctrlByte1 = weightBytes[1];
|
||||
|
||||
@@ -195,6 +193,7 @@ public class BluetoothMiScale2 extends BluetoothCommunication {
|
||||
final int min = (int) weightBytes[7];
|
||||
final int sec = (int) weightBytes[8];
|
||||
|
||||
float weight;
|
||||
if (isLBSUnit || isCattyUnit) {
|
||||
weight = (float) (((weightBytes[12] & 0xFF) << 8) | (weightBytes[11] & 0xFF)) / 100.0f;
|
||||
} else {
|
||||
|
@@ -143,7 +143,7 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
||||
|
||||
cursorScaleDB.close();
|
||||
} catch (SQLException ex) {
|
||||
Log.e("ScaleDatabase", "SQL exception occured while getting scale data list: " + ex.getMessage());
|
||||
Log.e("ScaleDatabase", "SQL exception occurred while getting scale data list: " + ex.getMessage());
|
||||
}
|
||||
|
||||
return scaleMeasurementList;
|
||||
|
@@ -272,7 +272,7 @@ public class ScaleMeasurement implements Cloneable {
|
||||
}
|
||||
|
||||
public float getBMR(ScaleUser scaleUser) {
|
||||
float bmr = 0.0f;
|
||||
float bmr;
|
||||
|
||||
// BMR formula by Mifflin, St Jeor et al: A new predictive equation for resting energy expenditure in healthy individuals
|
||||
if (scaleUser.getGender().isMale()) {
|
||||
|
@@ -24,13 +24,6 @@ public class EvaluationResult {
|
||||
public float highLimit;
|
||||
public EVAL_STATE eval_state;
|
||||
|
||||
public EvaluationResult() {
|
||||
this.value = -1.0f;
|
||||
this.lowLimit = -1.0f;
|
||||
this.highLimit = -1.0f;
|
||||
this.eval_state = EVAL_STATE.UNDEFINED;
|
||||
}
|
||||
|
||||
public EvaluationResult(float value, float lowLimit, float highLimit, EVAL_STATE eval_state)
|
||||
{
|
||||
this.value = value;
|
||||
@@ -38,5 +31,4 @@ public class EvaluationResult {
|
||||
this.highLimit = highLimit;
|
||||
this.eval_state = eval_state;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -168,8 +168,8 @@ public class EvaluationSheet {
|
||||
|
||||
public EvaluationResult evaluateWeight(float weight) {
|
||||
float body_height_squared = (evalUser.getBodyHeight() / 100.0f) * (evalUser.getBodyHeight() / 100.0f);
|
||||
float lowLimit = 0.0f;
|
||||
float highLimit = 0.0f;
|
||||
float lowLimit;
|
||||
float highLimit;
|
||||
|
||||
if (evalUser.getGender().isMale()) {
|
||||
lowLimit = body_height_squared * 20.0f;
|
||||
|
@@ -46,7 +46,6 @@ import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.health.openscale.BuildConfig;
|
||||
@@ -209,7 +208,7 @@ public class MainActivity extends BaseAppCompatActivity
|
||||
dialog.dismiss();
|
||||
Uri uri = Uri.parse("market://details?id=" + getPackageName());
|
||||
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
|
||||
// To count with Play market backstack, After pressing back button,
|
||||
// To count with Play market back stack, After pressing back button,
|
||||
// to taken back to our application, we need to add following flags to intent.
|
||||
goToMarket.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY |
|
||||
Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET |
|
||||
@@ -526,8 +525,8 @@ public class MainActivity extends BaseAppCompatActivity
|
||||
}
|
||||
};
|
||||
|
||||
private void setBluetoothStatusIcon(int iconRessource) {
|
||||
bluetoothStatusIcon = iconRessource;
|
||||
private void setBluetoothStatusIcon(int iconResource) {
|
||||
bluetoothStatusIcon = iconResource;
|
||||
bluetoothStatus.setIcon(getResources().getDrawable(bluetoothStatusIcon));
|
||||
}
|
||||
|
||||
|
@@ -424,12 +424,12 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
||||
}
|
||||
|
||||
if (prefs.getBoolean("regressionLine", false)) {
|
||||
PolynomialFitter.Polynomial polynom = polyFitter.getBestFit();
|
||||
PolynomialFitter.Polynomial polynomial = polyFitter.getBestFit();
|
||||
|
||||
Stack<PointValue> valuesLinearRegression = new Stack<>();
|
||||
|
||||
for (int i = 0; i < maxDays; i++) {
|
||||
double y_value = polynom.getY(i);
|
||||
double y_value = polynomial.getY(i);
|
||||
valuesLinearRegression.push(new PointValue((float) i, (float) y_value));
|
||||
}
|
||||
|
||||
|
@@ -103,7 +103,7 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
context = overviewView.getContext();
|
||||
|
||||
txtTitleUser = overviewView.findViewById(R.id.txtTitleUser);
|
||||
txtTitleLastMeasurement = overviewView.findViewById(R.id.txtTitleLastMeasurment);
|
||||
txtTitleLastMeasurement = overviewView.findViewById(R.id.txtTitleLastMeasurement);
|
||||
|
||||
pieChartLast = overviewView.findViewById(R.id.pieChartLast);
|
||||
lineChartLast = overviewView.findViewById(R.id.lineChartLast);
|
||||
|
@@ -242,8 +242,6 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
||||
|
||||
private Spanned[][] stringCache;
|
||||
|
||||
private ArrayList<HashMap<Integer, Spanned>> dataList;
|
||||
|
||||
public void setMeasurements(List<MeasurementView> visibleMeasurements,
|
||||
List<ScaleMeasurement> scaleMeasurements,
|
||||
int maxSize) {
|
||||
|
@@ -31,8 +31,6 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class GeneralPreferences extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private static final String PREFERENCE_KEY_APP_THEME = "app_theme";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@@ -31,16 +31,16 @@ public class TimePreferenceDialog extends DialogPreference {
|
||||
private Calendar calendar;
|
||||
private TimePicker picker = null;
|
||||
|
||||
public TimePreferenceDialog(Context ctxt) {
|
||||
this(ctxt, null);
|
||||
public TimePreferenceDialog(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public TimePreferenceDialog(Context ctxt, AttributeSet attrs) {
|
||||
this(ctxt, attrs, android.R.attr.dialogPreferenceStyle);
|
||||
public TimePreferenceDialog(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, android.R.attr.dialogPreferenceStyle);
|
||||
}
|
||||
|
||||
public TimePreferenceDialog(Context ctxt, AttributeSet attrs, int defStyle) {
|
||||
super(ctxt, attrs, defStyle);
|
||||
public TimePreferenceDialog(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
|
||||
setPositiveButtonText(R.string.label_ok);
|
||||
setNegativeButtonText(R.string.label_cancel);
|
||||
|
@@ -57,9 +57,9 @@
|
||||
android:weightSum="100">
|
||||
|
||||
<lecho.lib.hellocharts.view.PieChartView
|
||||
android:id="@+id/pieChartLast"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="200dp"
|
||||
android:id="@+id/pieChartLast"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="200dp"
|
||||
android:measureWithLargestChild="false"
|
||||
android:layout_weight="30" />
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_title_last_measurement"
|
||||
android:id="@+id/txtTitleLastMeasurment"
|
||||
android:id="@+id/txtTitleLastMeasurement"
|
||||
android:autoText="false"
|
||||
android:textSize="20dp"
|
||||
android:typeface="monospace" />
|
||||
|
@@ -163,6 +163,7 @@
|
||||
android:id="@+id/lblBirthday"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:labelFor="@id/txtBirthday"
|
||||
android:text="@string/label_birthday" />
|
||||
|
||||
<EditText
|
||||
@@ -225,6 +226,7 @@
|
||||
android:id="@+id/lblGoalDate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:labelFor="@id/txtGoalDate"
|
||||
android:text="@string/label_goal_date" />
|
||||
|
||||
<EditText
|
||||
|
@@ -66,7 +66,7 @@
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtTitleLastMeasurment"
|
||||
android:id="@+id/txtTitleLastMeasurement"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoText="false"
|
||||
|
@@ -156,7 +156,7 @@
|
||||
<string name="label_ignoreOutOfRange">Ignore data that are out of range</string>
|
||||
<string name="label_initial_weight">Initial weight</string>
|
||||
<string name="label_regression_line">Regression weight line</string>
|
||||
<string name="label_regression_line_degree">Regression polynom degree</string>
|
||||
<string name="label_regression_line_degree">Regression polynomial degree</string>
|
||||
<string name="label_goal_line">Goal line</string>
|
||||
<string name="label_help">Help</string>
|
||||
|
||||
|
Reference in New Issue
Block a user