1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-23 00:33:09 +02:00

Merge branch 'master' of github.com:oliexdev/openScale into body_measurements

This commit is contained in:
Erik Johansson
2018-05-13 22:34:46 +02:00
6 changed files with 38 additions and 37 deletions

View File

@@ -22,7 +22,7 @@ Install [openScale-dev-build.apk](https://github.com/oliexdev/openScale/releases
- Estimates body metrics (body fat, body water and lean body mass) based on scientic publications
- Support for multiple users
- Partially or full support for custom made Bluetooth scale, Xiaomi Mi scale v1/v2, Sanitas SBF70, Medisana BS444, Digoo DG-S038H, Yunmai Mini, Excelvan CF369BLE, Yunmai SE, MGB, Exingtech Y1, Beurer BF700/710/800, Silvercrest SBF75, Runtastic Libra (see [openScale wiki](https://github.com/oliexdev/openScale/wiki/Supported-scales-in-openScale) for details)
- Partially or full translated into Brazilian Portuguese, Catalan, Chinese (traditional), Czech, Dutch, English, French, German, Greek, Italian, Japanese, Norwegian Bokmål, Polish, Romanian, Slovak, Spanish, Swedish, Turkish
- Partially or full translated into Brazilian Portuguese, Catalan, Chinese (traditional), Czech, Dutch, English, French, Galician, German, Greek, Italian, Japanese, Norwegian Bokmål, Polish, Romanian, Slovak, Spanish, Swedish, Turkish
- No advertising and for free
- All data belongs to you (no cloud service)

View File

@@ -46,34 +46,34 @@ public class ScaleMeasurement implements Cloneable {
private int userId;
@ColumnInfo(name = "enabled")
private boolean enabled;
@CsvColumn (format = "dd.MM.yyyy HH:mm")
@CsvColumn(format = "dd.MM.yyyy HH:mm", mustNotBeBlank = true)
@ColumnInfo(name = "datetime")
private Date dateTime;
@CsvColumn
@CsvColumn(mustNotBeBlank = true)
@ColumnInfo(name = "weight")
private float weight;
@CsvColumn
@CsvColumn(mustBeSupplied = false)
@ColumnInfo(name = "fat")
private float fat;
@CsvColumn
@CsvColumn(mustBeSupplied = false)
@ColumnInfo(name = "water")
private float water;
@CsvColumn
@CsvColumn(mustBeSupplied = false)
@ColumnInfo(name = "muscle")
private float muscle;
@CsvColumn
@ColumnInfo(name = "visceralFat")
private float visceralFat;
@CsvColumn
@CsvColumn(mustBeSupplied = false)
@ColumnInfo(name = "lbw")
private float lbm;
@CsvColumn
@CsvColumn(mustBeSupplied = false)
@ColumnInfo(name = "waist")
private float waist;
@CsvColumn
@CsvColumn(mustBeSupplied = false)
@ColumnInfo(name = "hip")
private float hip;
@CsvColumn
@CsvColumn(mustBeSupplied = false)
@ColumnInfo(name = "bone")
private float bone;
@CsvColumn
@@ -97,7 +97,7 @@ public class ScaleMeasurement implements Cloneable {
@CsvColumn
@ColumnInfo(name = "caliper3")
private float caliper3;
@CsvColumn
@CsvColumn(mustBeSupplied = false)
@ColumnInfo(name = "comment")
private String comment;

View File

@@ -40,36 +40,29 @@ public class CsvHelper {
final String[] fields = sampleLine.split(",", -1);
// Return an array with header fields so that all the headers that actually are
// in the file for a given version comes first, and then the rest comes at the end.
// Return an array with header fields that match the guessed version.
if (fields.length == 10) {
// From version 1.6 up to 1.7
return new String[]{
"dateTime", "weight", "fat", "water", "muscle", "lbm", "bone", "waist", "hip", "comment"};
return new String[]{"dateTime", "weight", "fat", "water", "muscle", "lbm",
"bone", "waist", "hip", "comment"};
}
else if (fields.length == 9) {
// From version 1.5.5 (lbm unused)
return new String[]{
"dateTime", "weight", "fat", "water", "muscle", "bone", "waist", "hip", "comment",
"lbm"};
// From version 1.5.5
return new String[]{"dateTime", "weight", "fat", "water", "muscle", "bone",
"waist", "hip", "comment"};
}
else if (fields.length == 8) {
// From version 1.3 (lbm and bone unused)
return new String[]{
"dateTime", "weight", "fat", "water", "muscle", "waist", "hip", "comment",
"lbm", "bone"};
// From version 1.3
return new String[]{"dateTime", "weight", "fat", "water", "muscle", "waist",
"hip", "comment"};
}
else if (fields.length == 6) {
// From version 1.2 (lbm, bone, waist and hip unused)
return new String[]{
"dateTime", "weight", "fat", "water", "muscle", "comment",
"lbm", "bone", "waist", "hip"};
// From version 1.2
return new String[]{"dateTime", "weight", "fat", "water", "muscle", "comment"};
}
else if (fields.length == 5) {
// From version 1.0 (lbm, bone, waist, hip and muscle unused)
return new String[]{
"dateTime", "weight", "fat", "water", "comment",
"lbm", "bone", "waist", "hip", "muscle"};
// From version 1.0
return new String[]{"dateTime", "weight", "fat", "water", "comment"};
}
// Unknown input data format

View File

@@ -39,6 +39,8 @@ import com.health.openscale.gui.views.MeasurementView;
import java.text.DateFormat;
import java.util.List;
import timber.log.Timber;
public class WidgetProvider extends AppWidgetProvider {
List<MeasurementView> measurementViews;
@@ -55,10 +57,15 @@ public class WidgetProvider extends AppWidgetProvider {
// Make sure we use the correct language
context = BaseAppCompatActivity.createBaseContext(context);
final int minWidth = newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
int userId = prefs.getInt(getUserIdPreferenceName(appWidgetId), -1);
String key = prefs.getString(getMeasurementPreferenceName(appWidgetId), "");
Timber.d("Update widget %d (%s) for user %d, min width %ddp",
appWidgetId, key, userId, minWidth);
if (measurementViews == null) {
measurementViews = MeasurementView.getMeasurementList(
context, MeasurementView.DateTimeOrder.NONE);
@@ -79,7 +86,6 @@ public class WidgetProvider extends AppWidgetProvider {
measurementView.loadFrom(latest, previous);
}
final int minWidth = newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH);
// From https://developer.android.com/guide/practices/ui_guidelines/widget_design
final int twoCellsMinWidth = 110;
final int thirdCellsMinWidth = 180;
@@ -118,7 +124,7 @@ public class WidgetProvider extends AppWidgetProvider {
views.setViewVisibility(R.id.widget_name_date_layout, View.GONE);
}
// Always show value, but use smaller font in once cell mode
// Always show value and delta, but adjust font size
views.setTextViewText(R.id.widget_value, measurementView.getValueAsString(true));
SpannableStringBuilder delta = new SpannableStringBuilder();
measurementView.appendDiffValue(delta, false);

View File

@@ -60,15 +60,15 @@
<ImageView
android:id="@+id/widget_icon_vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:paddingStart="4dp" />
<TextView
android:id="@+id/widget_value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:lines="1"
android:gravity="center_horizontal"
android:maxLines="2"
android:textColor="@color/widgetTextColor"
android:textStyle="bold" />
@@ -76,7 +76,7 @@
android:id="@+id/widget_delta"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:gravity="center_horizontal"
android:lines="1"
android:textColor="@color/widgetTextColor" />
</LinearLayout>

View File

@@ -10,6 +10,7 @@
<item>Dutch (Nederlands)</item>
<item>English</item>
<item>French (français)</item>
<item>Galician (Galego)</item>
<item>German (Deutsch)</item>
<item>Greek (ελληνικά)</item>
<item>Italian (Italiano)</item>
@@ -33,6 +34,7 @@
<item>nl</item>
<item>en</item>
<item>fr</item>
<item>gl</item>
<item>de</item>
<item>el</item>
<item>it</item>