1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-21 16:02:04 +02:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate
2018-04-16 21:50:06 +02:00
20 changed files with 31 additions and 44 deletions

View File

@@ -68,7 +68,7 @@ public class UserAddTest {
@Rule @Rule
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class, false, false); 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 locale = new Locale(language, country);
Locale.setDefault(locale); Locale.setDefault(locale);
Resources res = context.getResources(); Resources res = context.getResources();
@@ -82,7 +82,7 @@ public class UserAddTest {
context = InstrumentationRegistry.getTargetContext(); context = InstrumentationRegistry.getTargetContext();
// set app language to English // set app language to English
setLangauge("en", "EN"); setLanguage("en", "EN");
// Set first start to true to get the user add dialog // Set first start to true to get the user add dialog
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);

View File

@@ -319,7 +319,7 @@ public class OpenScale {
for (int i = 0; i < scaleUsers.size(); i++) { for (int i = 0; i < scaleUsers.size(); i++) {
List<ScaleMeasurement> scaleUserData = measurementDAO.getAll(scaleUsers.get(i).getId()); List<ScaleMeasurement> scaleUserData = measurementDAO.getAll(scaleUsers.get(i).getId());
float lastWeight = 0; float lastWeight;
if (scaleUserData.size() > 0) { if (scaleUserData.size() > 0) {
lastWeight = scaleUserData.get(0).getWeight(); lastWeight = scaleUserData.get(0).getWeight();

View File

@@ -315,7 +315,7 @@ public abstract class BluetoothCommunication {
* *
* @param value byte which is tested * @param value byte which is tested
* @param bit bit position 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) { protected boolean isBitSet(byte value, int bit) {
return (value & (1 << bit)) != 0; return (value & (1 << bit)) != 0;

View File

@@ -201,7 +201,7 @@ public class BluetoothMGB extends BluetoothCommunication {
addScaleData(measurement); addScaleData(measurement);
// Visceral fat? // Visceral fat?
// Standart weight? // Standard weight?
// WeightControl? // WeightControl?
// Body fat? // Body fat?
// Muscle weight? // Muscle weight?

View File

@@ -196,8 +196,6 @@ public class BluetoothMiScale extends BluetoothCommunication {
private void parseBytes(byte[] weightBytes) { private void parseBytes(byte[] weightBytes) {
try { try {
float weight = 0.0f;
final byte ctrlByte = weightBytes[0]; final byte ctrlByte = weightBytes[0];
final boolean isWeightRemoved = isBitSet(ctrlByte, 7); final boolean isWeightRemoved = isBitSet(ctrlByte, 7);
@@ -224,6 +222,7 @@ public class BluetoothMiScale extends BluetoothCommunication {
final int min = (int) weightBytes[8]; final int min = (int) weightBytes[8];
final int sec = (int) weightBytes[9]; final int sec = (int) weightBytes[9];
float weight;
if (isLBSUnit || isCattyUnit) { if (isLBSUnit || isCattyUnit) {
weight = (float) (((weightBytes[2] & 0xFF) << 8) | (weightBytes[1] & 0xFF)) / 100.0f; weight = (float) (((weightBytes[2] & 0xFF) << 8) | (weightBytes[1] & 0xFF)) / 100.0f;
} else { } else {

View File

@@ -175,8 +175,6 @@ public class BluetoothMiScale2 extends BluetoothCommunication {
private void parseBytes(byte[] weightBytes) { private void parseBytes(byte[] weightBytes) {
try { try {
float weight = 0.0f;
final byte ctrlByte0 = weightBytes[0]; final byte ctrlByte0 = weightBytes[0];
final byte ctrlByte1 = weightBytes[1]; final byte ctrlByte1 = weightBytes[1];
@@ -195,6 +193,7 @@ public class BluetoothMiScale2 extends BluetoothCommunication {
final int min = (int) weightBytes[7]; final int min = (int) weightBytes[7];
final int sec = (int) weightBytes[8]; final int sec = (int) weightBytes[8];
float weight;
if (isLBSUnit || isCattyUnit) { if (isLBSUnit || isCattyUnit) {
weight = (float) (((weightBytes[12] & 0xFF) << 8) | (weightBytes[11] & 0xFF)) / 100.0f; weight = (float) (((weightBytes[12] & 0xFF) << 8) | (weightBytes[11] & 0xFF)) / 100.0f;
} else { } else {

View File

@@ -143,7 +143,7 @@ public class ScaleDatabase extends SQLiteOpenHelper {
cursorScaleDB.close(); cursorScaleDB.close();
} catch (SQLException ex) { } 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; return scaleMeasurementList;

View File

@@ -272,7 +272,7 @@ public class ScaleMeasurement implements Cloneable {
} }
public float getBMR(ScaleUser scaleUser) { 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 // BMR formula by Mifflin, St Jeor et al: A new predictive equation for resting energy expenditure in healthy individuals
if (scaleUser.getGender().isMale()) { if (scaleUser.getGender().isMale()) {

View File

@@ -24,13 +24,6 @@ public class EvaluationResult {
public float highLimit; public float highLimit;
public EVAL_STATE eval_state; 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) public EvaluationResult(float value, float lowLimit, float highLimit, EVAL_STATE eval_state)
{ {
this.value = value; this.value = value;
@@ -38,5 +31,4 @@ public class EvaluationResult {
this.highLimit = highLimit; this.highLimit = highLimit;
this.eval_state = eval_state; this.eval_state = eval_state;
} }
} }

View File

@@ -168,8 +168,8 @@ public class EvaluationSheet {
public EvaluationResult evaluateWeight(float weight) { public EvaluationResult evaluateWeight(float weight) {
float body_height_squared = (evalUser.getBodyHeight() / 100.0f) * (evalUser.getBodyHeight() / 100.0f); float body_height_squared = (evalUser.getBodyHeight() / 100.0f) * (evalUser.getBodyHeight() / 100.0f);
float lowLimit = 0.0f; float lowLimit;
float highLimit = 0.0f; float highLimit;
if (evalUser.getGender().isMale()) { if (evalUser.getGender().isMale()) {
lowLimit = body_height_squared * 20.0f; lowLimit = body_height_squared * 20.0f;

View File

@@ -46,7 +46,6 @@ import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View;
import android.widget.Toast; import android.widget.Toast;
import com.health.openscale.BuildConfig; import com.health.openscale.BuildConfig;
@@ -526,8 +525,8 @@ public class MainActivity extends BaseAppCompatActivity
} }
}; };
private void setBluetoothStatusIcon(int iconRessource) { private void setBluetoothStatusIcon(int iconResource) {
bluetoothStatusIcon = iconRessource; bluetoothStatusIcon = iconResource;
bluetoothStatus.setIcon(getResources().getDrawable(bluetoothStatusIcon)); bluetoothStatus.setIcon(getResources().getDrawable(bluetoothStatusIcon));
} }

View File

@@ -424,12 +424,12 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
} }
if (prefs.getBoolean("regressionLine", false)) { if (prefs.getBoolean("regressionLine", false)) {
PolynomialFitter.Polynomial polynom = polyFitter.getBestFit(); PolynomialFitter.Polynomial polynomial = polyFitter.getBestFit();
Stack<PointValue> valuesLinearRegression = new Stack<>(); Stack<PointValue> valuesLinearRegression = new Stack<>();
for (int i = 0; i < maxDays; i++) { 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)); valuesLinearRegression.push(new PointValue((float) i, (float) y_value));
} }

View File

@@ -103,7 +103,7 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
context = overviewView.getContext(); context = overviewView.getContext();
txtTitleUser = overviewView.findViewById(R.id.txtTitleUser); txtTitleUser = overviewView.findViewById(R.id.txtTitleUser);
txtTitleLastMeasurement = overviewView.findViewById(R.id.txtTitleLastMeasurment); txtTitleLastMeasurement = overviewView.findViewById(R.id.txtTitleLastMeasurement);
pieChartLast = overviewView.findViewById(R.id.pieChartLast); pieChartLast = overviewView.findViewById(R.id.pieChartLast);
lineChartLast = overviewView.findViewById(R.id.lineChartLast); lineChartLast = overviewView.findViewById(R.id.lineChartLast);

View File

@@ -242,8 +242,6 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
private Spanned[][] stringCache; private Spanned[][] stringCache;
private ArrayList<HashMap<Integer, Spanned>> dataList;
public void setMeasurements(List<MeasurementView> visibleMeasurements, public void setMeasurements(List<MeasurementView> visibleMeasurements,
List<ScaleMeasurement> scaleMeasurements, List<ScaleMeasurement> scaleMeasurements,
int maxSize) { int maxSize) {

View File

@@ -31,8 +31,6 @@ import java.util.List;
import java.util.Set; import java.util.Set;
public class GeneralPreferences extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener { public class GeneralPreferences extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener {
private static final String PREFERENCE_KEY_APP_THEME = "app_theme";
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View File

@@ -31,16 +31,16 @@ public class TimePreferenceDialog extends DialogPreference {
private Calendar calendar; private Calendar calendar;
private TimePicker picker = null; private TimePicker picker = null;
public TimePreferenceDialog(Context ctxt) { public TimePreferenceDialog(Context context) {
this(ctxt, null); this(context, null);
} }
public TimePreferenceDialog(Context ctxt, AttributeSet attrs) { public TimePreferenceDialog(Context context, AttributeSet attrs) {
this(ctxt, attrs, android.R.attr.dialogPreferenceStyle); this(context, attrs, android.R.attr.dialogPreferenceStyle);
} }
public TimePreferenceDialog(Context ctxt, AttributeSet attrs, int defStyle) { public TimePreferenceDialog(Context context, AttributeSet attrs, int defStyle) {
super(ctxt, attrs, defStyle); super(context, attrs, defStyle);
setPositiveButtonText(R.string.label_ok); setPositiveButtonText(R.string.label_ok);
setNegativeButtonText(R.string.label_cancel); setNegativeButtonText(R.string.label_cancel);

View File

@@ -75,7 +75,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/label_title_last_measurement" android:text="@string/label_title_last_measurement"
android:id="@+id/txtTitleLastMeasurment" android:id="@+id/txtTitleLastMeasurement"
android:autoText="false" android:autoText="false"
android:textSize="20dp" android:textSize="20dp"
android:typeface="monospace" /> android:typeface="monospace" />

View File

@@ -163,6 +163,7 @@
android:id="@+id/lblBirthday" android:id="@+id/lblBirthday"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:labelFor="@id/txtBirthday"
android:text="@string/label_birthday" /> android:text="@string/label_birthday" />
<EditText <EditText
@@ -225,6 +226,7 @@
android:id="@+id/lblGoalDate" android:id="@+id/lblGoalDate"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:labelFor="@id/txtGoalDate"
android:text="@string/label_goal_date" /> android:text="@string/label_goal_date" />
<EditText <EditText

View File

@@ -66,7 +66,7 @@
<TextView <TextView
android:id="@+id/txtTitleLastMeasurment" android:id="@+id/txtTitleLastMeasurement"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:autoText="false" android:autoText="false"

View File

@@ -156,7 +156,7 @@
<string name="label_ignoreOutOfRange">Ignore data that are out of range</string> <string name="label_ignoreOutOfRange">Ignore data that are out of range</string>
<string name="label_initial_weight">Initial weight</string> <string name="label_initial_weight">Initial weight</string>
<string name="label_regression_line">Regression weight line</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_goal_line">Goal line</string>
<string name="label_help">Help</string> <string name="label_help">Help</string>