mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-26 09:44:31 +02:00
added an option for merging the Bluetooth measurement with the latest measurement
This commit is contained in:
@@ -74,6 +74,7 @@ import cat.ereza.customactivityoncrash.config.CaocConfig;
|
|||||||
|
|
||||||
public class MainActivity extends AppCompatActivity
|
public class MainActivity extends AppCompatActivity
|
||||||
implements SharedPreferences.OnSharedPreferenceChangeListener{
|
implements SharedPreferences.OnSharedPreferenceChangeListener{
|
||||||
|
private SharedPreferences prefs;
|
||||||
private static boolean firstAppStart = true;
|
private static boolean firstAppStart = true;
|
||||||
private static boolean valueOfCountModified = false;
|
private static boolean valueOfCountModified = false;
|
||||||
private static int bluetoothStatusIcon = R.drawable.ic_bluetooth_disabled;
|
private static int bluetoothStatusIcon = R.drawable.ic_bluetooth_disabled;
|
||||||
@@ -91,7 +92,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
|
||||||
String app_theme = prefs.getString("app_theme", "Light");
|
String app_theme = prefs.getString("app_theme", "Light");
|
||||||
|
|
||||||
@@ -492,11 +493,13 @@ public class MainActivity extends AppCompatActivity
|
|||||||
|
|
||||||
OpenScale openScale = OpenScale.getInstance(getApplicationContext());
|
OpenScale openScale = OpenScale.getInstance(getApplicationContext());
|
||||||
|
|
||||||
List<ScaleMeasurement> scaleMeasurementList = openScale.getScaleMeasurementList();
|
if (prefs.getBoolean("mergeWithLastMeasurement", true)) {
|
||||||
|
List<ScaleMeasurement> scaleMeasurementList = openScale.getScaleMeasurementList();
|
||||||
|
|
||||||
if (!scaleMeasurementList.isEmpty()) {
|
if (!scaleMeasurementList.isEmpty()) {
|
||||||
ScaleMeasurement lastMeasurement = scaleMeasurementList.get(0);
|
ScaleMeasurement lastMeasurement = scaleMeasurementList.get(0);
|
||||||
scaleBtData.merge(lastMeasurement);
|
scaleBtData.merge(lastMeasurement);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openScale.addScaleData(scaleBtData);
|
openScale.addScaleData(scaleBtData);
|
||||||
|
@@ -180,5 +180,6 @@
|
|||||||
<string name="label_press_hold_reorder">Halten Sie die Taste gedrückt, um die Reihenfolge zu ändern</string>
|
<string name="label_press_hold_reorder">Halten Sie die Taste gedrückt, um die Reihenfolge zu ändern</string>
|
||||||
<string name="label_set_default_order">Default Reihenfolge wiederherstellen</string>
|
<string name="label_set_default_order">Default Reihenfolge wiederherstellen</string>
|
||||||
<string name="label_share_subject">openScale CSV Datenexport (%s)</string>
|
<string name="label_share_subject">openScale CSV Datenexport (%s)</string>
|
||||||
|
<string name="label_mergeWithLastMeasurement">Zusammenführen mit der letzten Messung</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -119,6 +119,7 @@
|
|||||||
|
|
||||||
<string name="label_bluetooth_title">Bluetooth</string>
|
<string name="label_bluetooth_title">Bluetooth</string>
|
||||||
<string name="label_bluetooth_enable">Search for scale on startup</string>
|
<string name="label_bluetooth_enable">Search for scale on startup</string>
|
||||||
|
<string name="label_mergeWithLastMeasurement">Merge with last measurement</string>
|
||||||
<string name="label_bluetooth_searching">Searching for Bluetooth scales</string>
|
<string name="label_bluetooth_searching">Searching for Bluetooth scales</string>
|
||||||
<string name="label_bluetooth_searching_finished">Finished searching for Bluetooth scales</string>
|
<string name="label_bluetooth_searching_finished">Finished searching for Bluetooth scales</string>
|
||||||
<string name="label_device_type">Device Type</string>
|
<string name="label_device_type">Device Type</string>
|
||||||
@@ -211,4 +212,5 @@
|
|||||||
<string name="label_press_hold_reorder">Press and hold to reorder</string>
|
<string name="label_press_hold_reorder">Press and hold to reorder</string>
|
||||||
<string name="label_set_default_order">Set default order</string>
|
<string name="label_set_default_order">Set default order</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
android:persistent="false">
|
android:persistent="false">
|
||||||
<Preference android:key="0" android:title="@string/label_device_type"/>
|
<Preference android:key="0" android:title="@string/label_device_type"/>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
<CheckBoxPreference android:title="@string/label_mergeWithLastMeasurement" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key="mergeWithLastMeasurement" android:defaultValue="true"/>
|
||||||
<CheckBoxPreference android:title="@string/label_bluetooth_enable" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key="btEnable" android:defaultValue="false"/>
|
<CheckBoxPreference android:title="@string/label_bluetooth_enable" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key="btEnable" android:defaultValue="false"/>
|
||||||
<CheckBoxPreference android:title="@string/label_smartUserAssign" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key="smartUserAssign" android:defaultValue="false"/>
|
<CheckBoxPreference android:title="@string/label_smartUserAssign" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key="smartUserAssign" android:defaultValue="false"/>
|
||||||
<CheckBoxPreference android:title="@string/label_ignoreOutOfRange" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key="ignoreOutOfRange" android:enabled="false" android:defaultValue="false"/>
|
<CheckBoxPreference android:title="@string/label_ignoreOutOfRange" android:summaryOn="@string/info_is_enable" android:summaryOff="@string/info_is_not_enable" android:key="ignoreOutOfRange" android:enabled="false" android:defaultValue="false"/>
|
||||||
|
Reference in New Issue
Block a user