diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiCoordinator.java index c6f0cd39a..5ad6d13cc 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/xiaomi/XiaomiCoordinator.java @@ -373,7 +373,13 @@ public abstract class XiaomiCoordinator extends AbstractBLEDeviceCoordinator { // Health // settings.add(R.xml.devicesettings_header_health); - settings.add(R.xml.devicesettings_heartrate_sleep_alert_activity_stress_spo2); + if (supportsStressMeasurement() && supports(device, FEAT_STRESS) && supportsSpo2() && supports(device, FEAT_SPO2)) { + settings.add(R.xml.devicesettings_heartrate_sleep_alert_activity_stress_spo2); + } else if (supportsStressMeasurement() && supports(device, FEAT_STRESS)) { + settings.add(R.xml.devicesettings_heartrate_sleep_alert_activity_stress); + } else { + settings.add(R.xml.devicesettings_heartrate_sleep_activity); + } if (supports(device, FEAT_INACTIVITY)) { settings.add(R.xml.devicesettings_inactivity_dnd_no_threshold); } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/services/XiaomiScheduleService.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/services/XiaomiScheduleService.java index 79fe583ba..ac838c6e0 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/services/XiaomiScheduleService.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/services/XiaomiScheduleService.java @@ -591,6 +591,7 @@ public class XiaomiScheduleService extends AbstractXiaomiService { final String end = XiaomiPreferences.prefFromHourMin(sleepMode.getSchedule().getEnd()); final GBDeviceEventUpdatePreferences eventUpdatePreferences = new GBDeviceEventUpdatePreferences() + .withPreference(XiaomiPreferences.FEAT_SLEEP_MODE_SCHEDULE, true) .withPreference("prefs_enable_sleep_time", null) .withPreference(DeviceSettingsPreferenceConst.PREF_SLEEP_MODE_SCHEDULE_ENABLED, sleepMode.getEnabled()) .withPreference(DeviceSettingsPreferenceConst.PREF_SLEEP_MODE_SCHEDULE_START, start)