mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-23 08:43:15 +02:00
Merge branch 'master' of github.com:oliexdev/openScale into body_measurements
This commit is contained in:
@@ -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
|
- Estimates body metrics (body fat, body water and lean body mass) based on scientic publications
|
||||||
- Support for multiple users
|
- 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 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
|
- No advertising and for free
|
||||||
- All data belongs to you (no cloud service)
|
- All data belongs to you (no cloud service)
|
||||||
|
|
||||||
|
@@ -46,34 +46,34 @@ public class ScaleMeasurement implements Cloneable {
|
|||||||
private int userId;
|
private int userId;
|
||||||
@ColumnInfo(name = "enabled")
|
@ColumnInfo(name = "enabled")
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
@CsvColumn (format = "dd.MM.yyyy HH:mm")
|
@CsvColumn(format = "dd.MM.yyyy HH:mm", mustNotBeBlank = true)
|
||||||
@ColumnInfo(name = "datetime")
|
@ColumnInfo(name = "datetime")
|
||||||
private Date dateTime;
|
private Date dateTime;
|
||||||
@CsvColumn
|
@CsvColumn(mustNotBeBlank = true)
|
||||||
@ColumnInfo(name = "weight")
|
@ColumnInfo(name = "weight")
|
||||||
private float weight;
|
private float weight;
|
||||||
@CsvColumn
|
@CsvColumn(mustBeSupplied = false)
|
||||||
@ColumnInfo(name = "fat")
|
@ColumnInfo(name = "fat")
|
||||||
private float fat;
|
private float fat;
|
||||||
@CsvColumn
|
@CsvColumn(mustBeSupplied = false)
|
||||||
@ColumnInfo(name = "water")
|
@ColumnInfo(name = "water")
|
||||||
private float water;
|
private float water;
|
||||||
@CsvColumn
|
@CsvColumn(mustBeSupplied = false)
|
||||||
@ColumnInfo(name = "muscle")
|
@ColumnInfo(name = "muscle")
|
||||||
private float muscle;
|
private float muscle;
|
||||||
@CsvColumn
|
@CsvColumn
|
||||||
@ColumnInfo(name = "visceralFat")
|
@ColumnInfo(name = "visceralFat")
|
||||||
private float visceralFat;
|
private float visceralFat;
|
||||||
@CsvColumn
|
@CsvColumn(mustBeSupplied = false)
|
||||||
@ColumnInfo(name = "lbw")
|
@ColumnInfo(name = "lbw")
|
||||||
private float lbm;
|
private float lbm;
|
||||||
@CsvColumn
|
@CsvColumn(mustBeSupplied = false)
|
||||||
@ColumnInfo(name = "waist")
|
@ColumnInfo(name = "waist")
|
||||||
private float waist;
|
private float waist;
|
||||||
@CsvColumn
|
@CsvColumn(mustBeSupplied = false)
|
||||||
@ColumnInfo(name = "hip")
|
@ColumnInfo(name = "hip")
|
||||||
private float hip;
|
private float hip;
|
||||||
@CsvColumn
|
@CsvColumn(mustBeSupplied = false)
|
||||||
@ColumnInfo(name = "bone")
|
@ColumnInfo(name = "bone")
|
||||||
private float bone;
|
private float bone;
|
||||||
@CsvColumn
|
@CsvColumn
|
||||||
@@ -97,7 +97,7 @@ public class ScaleMeasurement implements Cloneable {
|
|||||||
@CsvColumn
|
@CsvColumn
|
||||||
@ColumnInfo(name = "caliper3")
|
@ColumnInfo(name = "caliper3")
|
||||||
private float caliper3;
|
private float caliper3;
|
||||||
@CsvColumn
|
@CsvColumn(mustBeSupplied = false)
|
||||||
@ColumnInfo(name = "comment")
|
@ColumnInfo(name = "comment")
|
||||||
private String comment;
|
private String comment;
|
||||||
|
|
||||||
|
@@ -40,36 +40,29 @@ public class CsvHelper {
|
|||||||
|
|
||||||
final String[] fields = sampleLine.split(",", -1);
|
final String[] fields = sampleLine.split(",", -1);
|
||||||
|
|
||||||
// Return an array with header fields so that all the headers that actually are
|
// Return an array with header fields that match the guessed version.
|
||||||
// in the file for a given version comes first, and then the rest comes at the end.
|
|
||||||
if (fields.length == 10) {
|
if (fields.length == 10) {
|
||||||
// From version 1.6 up to 1.7
|
// From version 1.6 up to 1.7
|
||||||
return new String[]{
|
return new String[]{"dateTime", "weight", "fat", "water", "muscle", "lbm",
|
||||||
"dateTime", "weight", "fat", "water", "muscle", "lbm", "bone", "waist", "hip", "comment"};
|
"bone", "waist", "hip", "comment"};
|
||||||
}
|
}
|
||||||
else if (fields.length == 9) {
|
else if (fields.length == 9) {
|
||||||
// From version 1.5.5 (lbm unused)
|
// From version 1.5.5
|
||||||
return new String[]{
|
return new String[]{"dateTime", "weight", "fat", "water", "muscle", "bone",
|
||||||
"dateTime", "weight", "fat", "water", "muscle", "bone", "waist", "hip", "comment",
|
"waist", "hip", "comment"};
|
||||||
"lbm"};
|
|
||||||
}
|
}
|
||||||
else if (fields.length == 8) {
|
else if (fields.length == 8) {
|
||||||
// From version 1.3 (lbm and bone unused)
|
// From version 1.3
|
||||||
return new String[]{
|
return new String[]{"dateTime", "weight", "fat", "water", "muscle", "waist",
|
||||||
"dateTime", "weight", "fat", "water", "muscle", "waist", "hip", "comment",
|
"hip", "comment"};
|
||||||
"lbm", "bone"};
|
|
||||||
}
|
}
|
||||||
else if (fields.length == 6) {
|
else if (fields.length == 6) {
|
||||||
// From version 1.2 (lbm, bone, waist and hip unused)
|
// From version 1.2
|
||||||
return new String[]{
|
return new String[]{"dateTime", "weight", "fat", "water", "muscle", "comment"};
|
||||||
"dateTime", "weight", "fat", "water", "muscle", "comment",
|
|
||||||
"lbm", "bone", "waist", "hip"};
|
|
||||||
}
|
}
|
||||||
else if (fields.length == 5) {
|
else if (fields.length == 5) {
|
||||||
// From version 1.0 (lbm, bone, waist, hip and muscle unused)
|
// From version 1.0
|
||||||
return new String[]{
|
return new String[]{"dateTime", "weight", "fat", "water", "comment"};
|
||||||
"dateTime", "weight", "fat", "water", "comment",
|
|
||||||
"lbm", "bone", "waist", "hip", "muscle"};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unknown input data format
|
// Unknown input data format
|
||||||
|
@@ -39,6 +39,8 @@ import com.health.openscale.gui.views.MeasurementView;
|
|||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import timber.log.Timber;
|
||||||
|
|
||||||
public class WidgetProvider extends AppWidgetProvider {
|
public class WidgetProvider extends AppWidgetProvider {
|
||||||
List<MeasurementView> measurementViews;
|
List<MeasurementView> measurementViews;
|
||||||
|
|
||||||
@@ -55,10 +57,15 @@ public class WidgetProvider extends AppWidgetProvider {
|
|||||||
// Make sure we use the correct language
|
// Make sure we use the correct language
|
||||||
context = BaseAppCompatActivity.createBaseContext(context);
|
context = BaseAppCompatActivity.createBaseContext(context);
|
||||||
|
|
||||||
|
final int minWidth = newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH);
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
int userId = prefs.getInt(getUserIdPreferenceName(appWidgetId), -1);
|
int userId = prefs.getInt(getUserIdPreferenceName(appWidgetId), -1);
|
||||||
String key = prefs.getString(getMeasurementPreferenceName(appWidgetId), "");
|
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) {
|
if (measurementViews == null) {
|
||||||
measurementViews = MeasurementView.getMeasurementList(
|
measurementViews = MeasurementView.getMeasurementList(
|
||||||
context, MeasurementView.DateTimeOrder.NONE);
|
context, MeasurementView.DateTimeOrder.NONE);
|
||||||
@@ -79,7 +86,6 @@ public class WidgetProvider extends AppWidgetProvider {
|
|||||||
measurementView.loadFrom(latest, previous);
|
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
|
// From https://developer.android.com/guide/practices/ui_guidelines/widget_design
|
||||||
final int twoCellsMinWidth = 110;
|
final int twoCellsMinWidth = 110;
|
||||||
final int thirdCellsMinWidth = 180;
|
final int thirdCellsMinWidth = 180;
|
||||||
@@ -118,7 +124,7 @@ public class WidgetProvider extends AppWidgetProvider {
|
|||||||
views.setViewVisibility(R.id.widget_name_date_layout, View.GONE);
|
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));
|
views.setTextViewText(R.id.widget_value, measurementView.getValueAsString(true));
|
||||||
SpannableStringBuilder delta = new SpannableStringBuilder();
|
SpannableStringBuilder delta = new SpannableStringBuilder();
|
||||||
measurementView.appendDiffValue(delta, false);
|
measurementView.appendDiffValue(delta, false);
|
||||||
|
@@ -60,15 +60,15 @@
|
|||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/widget_icon_vertical"
|
android:id="@+id/widget_icon_vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="4dp" />
|
android:paddingStart="4dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/widget_value"
|
android:id="@+id/widget_value"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="right"
|
android:gravity="center_horizontal"
|
||||||
android:lines="1"
|
android:maxLines="2"
|
||||||
android:textColor="@color/widgetTextColor"
|
android:textColor="@color/widgetTextColor"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
android:id="@+id/widget_delta"
|
android:id="@+id/widget_delta"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="right"
|
android:gravity="center_horizontal"
|
||||||
android:lines="1"
|
android:lines="1"
|
||||||
android:textColor="@color/widgetTextColor" />
|
android:textColor="@color/widgetTextColor" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
<item>Dutch (Nederlands)</item>
|
<item>Dutch (Nederlands)</item>
|
||||||
<item>English</item>
|
<item>English</item>
|
||||||
<item>French (français)</item>
|
<item>French (français)</item>
|
||||||
|
<item>Galician (Galego)</item>
|
||||||
<item>German (Deutsch)</item>
|
<item>German (Deutsch)</item>
|
||||||
<item>Greek (ελληνικά)</item>
|
<item>Greek (ελληνικά)</item>
|
||||||
<item>Italian (Italiano)</item>
|
<item>Italian (Italiano)</item>
|
||||||
@@ -33,6 +34,7 @@
|
|||||||
<item>nl</item>
|
<item>nl</item>
|
||||||
<item>en</item>
|
<item>en</item>
|
||||||
<item>fr</item>
|
<item>fr</item>
|
||||||
|
<item>gl</item>
|
||||||
<item>de</item>
|
<item>de</item>
|
||||||
<item>el</item>
|
<item>el</item>
|
||||||
<item>it</item>
|
<item>it</item>
|
||||||
|
Reference in New Issue
Block a user