diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java index 7f05ff16c..36e08a700 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSettingsPreferenceConst.java @@ -192,6 +192,7 @@ public class DeviceSettingsPreferenceConst { public static final String PREF_INACTIVITY_DND = "inactivity_warnings_dnd"; public static final String PREF_INACTIVITY_DND_START = "inactivity_warnings_dnd_start"; public static final String PREF_INACTIVITY_DND_END = "inactivity_warnings_dnd_end"; + public static final String PREF_INACTIVITY_STEPS = "inactivity_warnings_steps"; public static final String PREF_HEARTRATE_USE_FOR_SLEEP_DETECTION = "heartrate_sleep_detection"; public static final String PREF_HEARTRATE_MEASUREMENT_INTERVAL = "heartrate_measurement_interval"; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/moyoung/AbstractMoyoungDeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/moyoung/AbstractMoyoungDeviceCoordinator.java index 534df1491..fa1ee45c8 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/moyoung/AbstractMoyoungDeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/moyoung/AbstractMoyoungDeviceCoordinator.java @@ -211,7 +211,7 @@ public abstract class AbstractMoyoungDeviceCoordinator extends AbstractBLEDevice generic.add(R.xml.devicesettings_sync_calendar); final List health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH); health.add(R.xml.devicesettings_heartrate_interval); - health.add(R.xml.devicesettings_moyoung_sedentary_reminder); + health.add(R.xml.devicesettings_inactivity_with_steps); return deviceSpecificSettings; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/moyoung/MoyoungConstants.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/moyoung/MoyoungConstants.java index 8527f786d..26542ef69 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/moyoung/MoyoungConstants.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/moyoung/MoyoungConstants.java @@ -432,9 +432,4 @@ public class MoyoungConstants { public static final String PREF_LANGUAGE = "moyoung_language"; public static final String PREF_LANGUAGE_SUPPORT = "moyoung_language_supported"; public static final String PREF_MOYOUNG_DEVICE_VERSION = "moyoung_device_version"; - public static final String PREF_SEDENTARY_REMINDER = "sedentary_reminder"; - public static final String PREF_SEDENTARY_REMINDER_PERIOD = "sedentary_reminder_period"; - public static final String PREF_SEDENTARY_REMINDER_STEPS = "sedentary_reminder_steps"; - public static final String PREF_SEDENTARY_REMINDER_START = "sedentary_reminder_start"; - public static final String PREF_SEDENTARY_REMINDER_END = "sedentary_reminder_end"; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/moyoung/MoyoungDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/moyoung/MoyoungDeviceSupport.java index 9f6f091d8..984ef7eb1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/moyoung/MoyoungDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/moyoung/MoyoungDeviceSupport.java @@ -1683,20 +1683,19 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport { sendSetting(getSetting("POWER_SAVING"), powerSavingPref); break; - case MoyoungConstants.PREF_SEDENTARY_REMINDER: - String sedentaryReminderPref = prefs.getString(MoyoungConstants.PREF_SEDENTARY_REMINDER, "off"); - boolean sedentaryReminderEnabled = !sedentaryReminderPref.equals("off"); + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_ENABLE: + boolean sedentaryReminderEnabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_ENABLE, false); sendSetting(getSetting("SEDENTARY_REMINDER"), sedentaryReminderEnabled); break; - case MoyoungConstants.PREF_SEDENTARY_REMINDER_PERIOD: - case MoyoungConstants.PREF_SEDENTARY_REMINDER_STEPS: - case MoyoungConstants.PREF_SEDENTARY_REMINDER_START: - case MoyoungConstants.PREF_SEDENTARY_REMINDER_END: - byte sedentaryPeriod = (byte) prefs.getInt(MoyoungConstants.PREF_SEDENTARY_REMINDER_PERIOD, 30); - byte sedentarySteps = (byte) prefs.getInt(MoyoungConstants.PREF_SEDENTARY_REMINDER_STEPS, 100); - byte sedentaryStart = (byte) prefs.getInt(MoyoungConstants.PREF_SEDENTARY_REMINDER_START, 10); - byte sedentaryEnd = (byte) prefs.getInt(MoyoungConstants.PREF_SEDENTARY_REMINDER_END, 22); + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_START: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_END: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_STEPS: + byte sedentaryPeriod = (byte) prefs.getInt(DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD, 30); + byte sedentarySteps = (byte) prefs.getInt(DeviceSettingsPreferenceConst.PREF_INACTIVITY_STEPS, 100); + byte sedentaryStart = (byte) prefs.getInt(DeviceSettingsPreferenceConst.PREF_INACTIVITY_START, 10); + byte sedentaryEnd = (byte) prefs.getInt(DeviceSettingsPreferenceConst.PREF_INACTIVITY_END, 22); sendSetting(getSetting("REMINDERS_TO_MOVE_PERIOD"), new MoyoungSettingRemindersToMove.RemindersToMove(sedentaryPeriod, sedentarySteps, sedentaryStart, sedentaryEnd)); break; @@ -1765,14 +1764,14 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport { // querySetting(getSetting("QUICK_VIEW_TIME")); // break; - case MoyoungConstants.PREF_SEDENTARY_REMINDER: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_ENABLE: querySetting(getSetting("SEDENTARY_REMINDER")); break; - case MoyoungConstants.PREF_SEDENTARY_REMINDER_PERIOD: - case MoyoungConstants.PREF_SEDENTARY_REMINDER_STEPS: - case MoyoungConstants.PREF_SEDENTARY_REMINDER_START: - case MoyoungConstants.PREF_SEDENTARY_REMINDER_END: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD_EXTENDED: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_START: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_END: querySetting(getSetting("REMINDERS_TO_MOVE_PERIOD")); break; default: diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 04fd7c66b..e4384bcb6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -438,11 +438,6 @@ Enable if your device no longer connects after a firmware upgrade Watch face Device version - Sedentary reminder - Time period (minutes) - Minimum steps - Start time (hour) - End time (hour) Units Time format diff --git a/app/src/main/res/xml/devicesettings_inactivity_with_steps.xml b/app/src/main/res/xml/devicesettings_inactivity_with_steps.xml new file mode 100644 index 000000000..957941b98 --- /dev/null +++ b/app/src/main/res/xml/devicesettings_inactivity_with_steps.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + diff --git a/app/src/main/res/xml/devicesettings_moyoung_language.xml b/app/src/main/res/xml/devicesettings_moyoung_language.xml deleted file mode 100644 index e4c18b756..000000000 --- a/app/src/main/res/xml/devicesettings_moyoung_language.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/xml/devicesettings_moyoung_sedentary_reminder.xml b/app/src/main/res/xml/devicesettings_moyoung_sedentary_reminder.xml deleted file mode 100644 index 717c36640..000000000 --- a/app/src/main/res/xml/devicesettings_moyoung_sedentary_reminder.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - -