mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 12:56:49 +01:00
[Huawei] Add enable SpO2 force option
This commit is contained in:
parent
93bb8bdc08
commit
10cd4e09b1
@ -419,6 +419,7 @@ public class DeviceSettingsPreferenceConst {
|
||||
public static final String PREF_FORCE_ENABLE_WEAR_LOCATION = "pref_force_enable_wear_location";
|
||||
public static final String PREF_FORCE_DND_SUPPORT = "pref_force_dnd_support";
|
||||
public static final String PREF_FORCE_ENABLE_HEARTRATE_SUPPORT = "pref_force_enable_heartrate_support";
|
||||
public static final String PREF_FORCE_ENABLE_SPO2_SUPPORT = "pref_force_enable_spo2_support";
|
||||
public static final String PREF_IGNORE_WAKEUP_STATUS_START = "pref_force_ignore_wakeup_status_start";
|
||||
public static final String PREF_IGNORE_WAKEUP_STATUS_END = "pref_force_ignore_wakeup_status_end";
|
||||
|
||||
|
@ -334,6 +334,10 @@ public class HuaweiCoordinator {
|
||||
return supportsCommandForService(0x07, 0x24);
|
||||
}
|
||||
|
||||
public boolean supportsSPo2(GBDevice gbDevice) {
|
||||
return supportsSPo2() || getForceOption(gbDevice, PREF_FORCE_ENABLE_SPO2_SUPPORT);
|
||||
}
|
||||
|
||||
public boolean supportsFitnessThresholdValue() {
|
||||
return supportsCommandForService(0x07, 0x29);
|
||||
}
|
||||
|
@ -103,6 +103,11 @@ public class HuaweiSettingsCustomizer implements DeviceSpecificSettingsCustomize
|
||||
if (this.coordinator.supportsHeartRate(handler.getDevice())) {
|
||||
heartRate.setVisible(true);
|
||||
}
|
||||
final ListPreference spo2 = handler.findPreference(PREF_SPO_AUTOMATIC_ENABLE);
|
||||
spo2.setVisible(false);
|
||||
if (this.coordinator.supportsSPo2(handler.getDevice())) {
|
||||
spo2.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,6 +119,7 @@ public class HuaweiSettingsCustomizer implements DeviceSpecificSettingsCustomize
|
||||
handler.addPreferenceHandlerFor(PREF_FORCE_ENABLE_WEAR_LOCATION);
|
||||
handler.addPreferenceHandlerFor(PREF_FORCE_DND_SUPPORT);
|
||||
handler.addPreferenceHandlerFor(PREF_FORCE_ENABLE_HEARTRATE_SUPPORT);
|
||||
handler.addPreferenceHandlerFor(PREF_FORCE_ENABLE_SPO2_SUPPORT);
|
||||
|
||||
handler.addPreferenceHandlerFor(PREF_HUAWEI_WORKMODE);
|
||||
handler.addPreferenceHandlerFor(PREF_HUAWEI_TRUSLEEP);
|
||||
@ -125,7 +131,8 @@ public class HuaweiSettingsCustomizer implements DeviceSpecificSettingsCustomize
|
||||
boolean supportsSmartAlarm = this.coordinator.supportsSmartAlarm();
|
||||
boolean supportsWearLocation = this.coordinator.supportsWearLocation();
|
||||
boolean supportsHeartRate = this.coordinator.supportsHeartRate();
|
||||
if (!supportsSmartAlarm || !supportsWearLocation || !supportsHeartRate) {
|
||||
boolean supportsSpO2 = this.coordinator.supportsSPo2();
|
||||
if (!supportsSmartAlarm || !supportsWearLocation || !supportsHeartRate || !supportsSpO2) {
|
||||
forceOptions.setVisible(true);
|
||||
final SwitchPreferenceCompat forceSmartAlarm = handler.findPreference(PREF_FORCE_ENABLE_SMART_ALARM);
|
||||
forceSmartAlarm.setVisible(false);
|
||||
@ -142,6 +149,11 @@ public class HuaweiSettingsCustomizer implements DeviceSpecificSettingsCustomize
|
||||
if (!supportsHeartRate) {
|
||||
forceHeartRate.setVisible(true);
|
||||
}
|
||||
final SwitchPreferenceCompat forceSpO2 = handler.findPreference(PREF_FORCE_ENABLE_SPO2_SUPPORT);
|
||||
forceSpO2.setVisible(false);
|
||||
if (!supportsSpO2) {
|
||||
forceSpO2.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2408,6 +2408,8 @@
|
||||
<string name="pref_force_dnd_support_summary">Force Do Not Disturb support.\nUSE AT YOUR OWN RISK</string>
|
||||
<string name="pref_force_enable_heartrate_support">Force heart rate support</string>
|
||||
<string name="pref_force_enable_heartrate_support_summary">Force enable heart rate support.\nUSE AT YOUR OWN RISK</string>
|
||||
<string name="pref_force_enable_spo2_support">Force SpO2 support</string>
|
||||
<string name="pref_force_enable_spo2_support_summary">Force enable SpO2 support.\nUSE AT YOUR OWN RISK</string>
|
||||
<string name="huawei_ignore_wakeup_status_start">Ignore wakeup start status</string>
|
||||
<string name="huawei_ignore_wakeup_status_start_description">May help with proper sleep detection. Visible immediately in the daily activities view.</string>
|
||||
<string name="huawei_ignore_wakeup_status_end">Ignore wakeup end status</string>
|
||||
|
@ -55,6 +55,14 @@
|
||||
android:title="@string/pref_force_enable_heartrate_support"
|
||||
android:summary="@string/pref_force_enable_heartrate_support_summary" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:icon="@drawable/ic_heart"
|
||||
android:defaultValue="false"
|
||||
android:key="pref_force_enable_spo2_support"
|
||||
android:layout="@layout/preference_checkbox"
|
||||
android:title="@string/pref_force_enable_spo2_support"
|
||||
android:summary="@string/pref_force_enable_spo2_support_summary" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:icon="@drawable/ic_activity_sleep"
|
||||
android:defaultValue="false"
|
||||
|
Loading…
Reference in New Issue
Block a user