1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-27 20:36:51 +01:00

Fossil HR: raw activity dateien optional speichern

This commit is contained in:
Daniel Dakhno 2020-04-22 01:27:06 +02:00
parent 89a6981e01
commit 18eec6b863
6 changed files with 20 additions and 1 deletions

View File

@ -33,4 +33,5 @@ public class DeviceSettingsPreferenceConst {
public static final String PREF_HYBRID_HR_FORCE_WHITE_COLOR = "force_white_color_scheme"; public static final String PREF_HYBRID_HR_FORCE_WHITE_COLOR = "force_white_color_scheme";
public static final String PREF_HYBRID_HR_DRAW_WIDGET_CIRCLES = "widget_draw_circles"; public static final String PREF_HYBRID_HR_DRAW_WIDGET_CIRCLES = "widget_draw_circles";
public static final String PREF_HYBRID_HR_SAVE_RAW_ACTIVITY_FILES = "save_raw_activity_files";
} }

View File

@ -45,6 +45,7 @@ import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.Dev
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DATEFORMAT; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DATEFORMAT;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HYBRID_HR_DRAW_WIDGET_CIRCLES; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HYBRID_HR_DRAW_WIDGET_CIRCLES;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HYBRID_HR_FORCE_WHITE_COLOR; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HYBRID_HR_FORCE_WHITE_COLOR;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HYBRID_HR_SAVE_RAW_ACTIVITY_FILES;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SCREEN_ORIENTATION; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_SCREEN_ORIENTATION;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_TIMEFORMAT; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_TIMEFORMAT;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_VIBRATION_STRENGH_PERCENTAGE; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_VIBRATION_STRENGH_PERCENTAGE;
@ -326,6 +327,7 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat {
addPreferenceHandlerFor(PREF_HYBRID_HR_DRAW_WIDGET_CIRCLES); addPreferenceHandlerFor(PREF_HYBRID_HR_DRAW_WIDGET_CIRCLES);
addPreferenceHandlerFor(PREF_HYBRID_HR_FORCE_WHITE_COLOR); addPreferenceHandlerFor(PREF_HYBRID_HR_FORCE_WHITE_COLOR);
addPreferenceHandlerFor(PREF_HYBRID_HR_SAVE_RAW_ACTIVITY_FILES);
String displayOnLiftState = prefs.getString(PREF_ACTIVATE_DISPLAY_ON_LIFT, PREF_DO_NOT_DISTURB_OFF); String displayOnLiftState = prefs.getString(PREF_ACTIVATE_DISPLAY_ON_LIFT, PREF_DO_NOT_DISTURB_OFF);
boolean displayOnLiftScheduled = displayOnLiftState.equals(PREF_DO_NOT_DISTURB_SCHEDULED); boolean displayOnLiftScheduled = displayOnLiftState.equals(PREF_DO_NOT_DISTURB_SCHEDULED);

View File

@ -111,8 +111,12 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
super(deviceSupport); super(deviceSupport);
} }
private boolean saveRawActivityFiles = false;
@Override @Override
public void initialize() { public void initialize() {
saveRawActivityFiles = getDeviceSpecificPreferences().getBoolean("save_raw_activity_files", false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
queueWrite(new RequestMtuRequest(512)); queueWrite(new RequestMtuRequest(512));
} }
@ -520,7 +524,9 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
provider.addGBActivitySamples(samples); provider.addGBActivitySamples(samples);
if(saveRawActivityFiles) {
writeFile(String.valueOf(System.currentTimeMillis()), fileData); writeFile(String.valueOf(System.currentTimeMillis()), fileData);
}
queueWrite(new FileDeleteRequest(fileHandle)); queueWrite(new FileDeleteRequest(fileHandle));
GB.toast("synced activity data", Toast.LENGTH_SHORT, GB.INFO); GB.toast("synced activity data", Toast.LENGTH_SHORT, GB.INFO);
} catch (Exception ex) { } catch (Exception ex) {
@ -858,6 +864,10 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
renderWidgets(); renderWidgets();
break; break;
} }
case DeviceSettingsPreferenceConst.PREF_HYBRID_HR_SAVE_RAW_ACTIVITY_FILES: {
saveRawActivityFiles = getDeviceSpecificPreferences().getBoolean("save_raw_activity_files", false);
break;
}
} }
} }

View File

@ -862,4 +862,5 @@
<string name="pref_title_relax_firmware_checks">Aktiviere das flashen von Firmware, die nicht für dieses Gerät bestimmt ist (auf eigenes Risiko)</string> <string name="pref_title_relax_firmware_checks">Aktiviere das flashen von Firmware, die nicht für dieses Gerät bestimmt ist (auf eigenes Risiko)</string>
<string name="pref_qhybrid_title_widget_draw_circles">Widget-Kreise zeichnen</string> <string name="pref_qhybrid_title_widget_draw_circles">Widget-Kreise zeichnen</string>
<string name="pref_header_auto_fetch">Automatischer Abruf</string> <string name="pref_header_auto_fetch">Automatischer Abruf</string>
<string name="pref_qhybrid_save_raw_activity_files">Raw Activity Dateien speichern</string>
</resources> </resources>

View File

@ -816,6 +816,7 @@
<string name="error_no_location_access">Location access must be granted and enabled for scanning to work properly</string> <string name="error_no_location_access">Location access must be granted and enabled for scanning to work properly</string>
<string name="pref_qhybrid_title_widget_draw_circles">Draw widget circles</string> <string name="pref_qhybrid_title_widget_draw_circles">Draw widget circles</string>
<string name="pref_qhybrid_save_raw_activity_files">Save raw activity files</string>
<plurals name="widget_alarm_target_hours"> <plurals name="widget_alarm_target_hours">
<item quantity="one">%d hour</item> <item quantity="one">%d hour</item>

View File

@ -31,6 +31,10 @@
android:defaultValue="false" android:defaultValue="false"
android:key="widget_draw_circles" android:key="widget_draw_circles"
android:title="@string/pref_qhybrid_title_widget_draw_circles" /> android:title="@string/pref_qhybrid_title_widget_draw_circles" />
<SwitchPreference
android:defaultValue="false"
android:key="save_raw_activity_files"
android:title="@string/pref_qhybrid_save_raw_activity_files" />
<SeekBarPreference <SeekBarPreference
android:defaultValue="2" android:defaultValue="2"