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 582bc9ffa..5c5029afb 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 @@ -79,6 +79,13 @@ public class DeviceSettingsPreferenceConst { public static final String PREF_DO_NOT_DISTURB_NOAUTO = "do_not_disturb_no_auto"; public static final String PREF_DO_NOT_DISTURB_NOAUTO_START = "do_not_disturb_no_auto_start"; public static final String PREF_DO_NOT_DISTURB_NOAUTO_END = "do_not_disturb_no_auto_end"; + public static final String PREF_DO_NOT_DISTURB = "do_not_disturb"; + public static final String PREF_DO_NOT_DISTURB_START = "do_not_disturb_start"; + public static final String PREF_DO_NOT_DISTURB_END = "do_not_disturb_end"; + public static final String PREF_DO_NOT_DISTURB_LIFT_WRIST = "do_not_disturb_lift_wrist"; + public static final String PREF_DO_NOT_DISTURB_OFF = "off"; + public static final String PREF_DO_NOT_DISTURB_AUTOMATIC = "automatic"; + public static final String PREF_DO_NOT_DISTURB_SCHEDULED = "scheduled"; public static final String PREF_FIND_PHONE_ENABLED = "prefs_find_phone"; public static final String PREF_AUTOLIGHT = "autolight"; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java index 7a884c319..8c9ed2367 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/devicesettings/DeviceSpecificSettingsFragment.java @@ -76,12 +76,6 @@ import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_EXPOSE_HR_THIRDPARTY; import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_SHORTCUTS; import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_SHORTCUTS_SORTABLE; -import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_DO_NOT_DISTURB; -import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_DO_NOT_DISTURB_END; -import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_DO_NOT_DISTURB_LIFT_WRIST; -import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_DO_NOT_DISTURB_OFF; -import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_DO_NOT_DISTURB_SCHEDULED; -import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_DO_NOT_DISTURB_START; import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MI2_DATEFORMAT; import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MI2_ROTATE_WRIST_TO_SWITCH_INFO; import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_NIGHT_MODE; @@ -298,7 +292,7 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat imp } - String doNotDisturbState = prefs.getString(MiBandConst.PREF_DO_NOT_DISTURB, PREF_DO_NOT_DISTURB_OFF); + String doNotDisturbState = prefs.getString(PREF_DO_NOT_DISTURB, PREF_DO_NOT_DISTURB_OFF); boolean doNotDisturbScheduled = doNotDisturbState.equals(PREF_DO_NOT_DISTURB_SCHEDULED); final Preference doNotDisturbStart = findPreference(PREF_DO_NOT_DISTURB_START); @@ -383,6 +377,9 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat imp addPreferenceHandlerFor(PREF_DO_NOT_DISTURB_NOAUTO); addPreferenceHandlerFor(PREF_DO_NOT_DISTURB_NOAUTO_START); addPreferenceHandlerFor(PREF_DO_NOT_DISTURB_NOAUTO_END); + addPreferenceHandlerFor(PREF_DO_NOT_DISTURB); + addPreferenceHandlerFor(PREF_DO_NOT_DISTURB_START); + addPreferenceHandlerFor(PREF_DO_NOT_DISTURB_END); addPreferenceHandlerFor(PREF_DO_NOT_DISTURB_LIFT_WRIST); addPreferenceHandlerFor(PREF_FIND_PHONE_ENABLED); addPreferenceHandlerFor(PREF_AUTOLIGHT); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiCoordinator.java index 7e726b2d4..dc7f0dd8d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiCoordinator.java @@ -239,11 +239,11 @@ public abstract class HuamiCoordinator extends AbstractDeviceCoordinator { } public static Date getDoNotDisturbStart(String deviceAddress) { - return getTimePreference(MiBandConst.PREF_DO_NOT_DISTURB_START, "01:00", deviceAddress); + return getTimePreference(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_START, "01:00", deviceAddress); } public static Date getDoNotDisturbEnd(String deviceAddress) { - return getTimePreference(MiBandConst.PREF_DO_NOT_DISTURB_END, "06:00", deviceAddress); + return getTimePreference(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_END, "06:00", deviceAddress); } public static boolean getBandScreenUnlock(String deviceAddress) { @@ -298,11 +298,11 @@ public abstract class HuamiCoordinator extends AbstractDeviceCoordinator { public static DoNotDisturb getDoNotDisturb(String deviceAddress) { SharedPreferences prefs = GBApplication.getDeviceSpecificSharedPrefs(deviceAddress); - String pref = prefs.getString(MiBandConst.PREF_DO_NOT_DISTURB, MiBandConst.PREF_DO_NOT_DISTURB_OFF); + String pref = prefs.getString(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB, DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_OFF); - if (MiBandConst.PREF_DO_NOT_DISTURB_AUTOMATIC.equals(pref)) { + if (DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_AUTOMATIC.equals(pref)) { return DoNotDisturb.AUTOMATIC; - } else if (MiBandConst.PREF_DO_NOT_DISTURB_SCHEDULED.equals(pref)) { + } else if (DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_SCHEDULED.equals(pref)) { return DoNotDisturb.SCHEDULED; } @@ -312,7 +312,7 @@ public abstract class HuamiCoordinator extends AbstractDeviceCoordinator { public static boolean getDoNotDisturbLiftWrist(String deviceAddress) { SharedPreferences prefs = GBApplication.getDeviceSpecificSharedPrefs(deviceAddress); - return prefs.getBoolean(MiBandConst.PREF_DO_NOT_DISTURB_LIFT_WRIST, false); + return prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_LIFT_WRIST, false); } @Override diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lenovo/watchxplus/WatchXPlusConstants.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lenovo/watchxplus/WatchXPlusConstants.java index f0f7abd84..21d16c85a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lenovo/watchxplus/WatchXPlusConstants.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lenovo/watchxplus/WatchXPlusConstants.java @@ -46,10 +46,6 @@ public final class WatchXPlusConstants extends LenovoWatchConstants { public static final String PREF_BP_CAL_LOW = "pref_sensors_bp_calibration_low"; public static final String PREF_BP_CAL_HIGH = "pref_sensors_bp_calibration_high"; - public static final String PREF_DO_NOT_DISTURB = "do_not_disturb_no_auto"; - public static final String PREF_DO_NOT_DISTURB_START = "do_not_disturb_no_auto_start"; - public static final String PREF_DO_NOT_DISTURB_END = "do_not_disturb_no_auto_end"; - public static final String PREF_LONGSIT_START = "pref_longsit_start"; public static final String PREF_LONGSIT_END = "pref_longsit_end"; public static final String PREF_SHOW_RAW_GRAPH = "show_raw_graph"; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lenovo/watchxplus/WatchXPlusDeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lenovo/watchxplus/WatchXPlusDeviceCoordinator.java index 30017ef7c..013cfc9c2 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lenovo/watchxplus/WatchXPlusDeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lenovo/watchxplus/WatchXPlusDeviceCoordinator.java @@ -241,7 +241,7 @@ public class WatchXPlusDeviceCoordinator extends AbstractDeviceCoordinator { */ public static boolean getDNDHours(String deviceAddress, Calendar startOut, Calendar endOut) { SharedPreferences prefs = GBApplication.getDeviceSpecificSharedPrefs(deviceAddress); - String doNotDisturb = prefs.getString(WatchXPlusConstants.PREF_DO_NOT_DISTURB, getContext().getString(R.string.p_off)); + String doNotDisturb = prefs.getString(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_NOAUTO, getContext().getString(R.string.p_off)); assert doNotDisturb != null; if (doNotDisturb.equals(getContext().getString(R.string.p_off))) { @@ -249,8 +249,8 @@ public class WatchXPlusDeviceCoordinator extends AbstractDeviceCoordinator { return false; } else { - String start = prefs.getString(WatchXPlusConstants.PREF_DO_NOT_DISTURB_START, "01:00"); - String end = prefs.getString(WatchXPlusConstants.PREF_DO_NOT_DISTURB_END, "06:00"); + String start = prefs.getString(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_NOAUTO_START, "01:00"); + String end = prefs.getString(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_NOAUTO_END, "06:00"); DateFormat df = new SimpleDateFormat("HH:mm"); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/makibeshr3/MakibesHR3Constants.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/makibeshr3/MakibesHR3Constants.java index ff6d656ca..06ed8594c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/makibeshr3/MakibesHR3Constants.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/makibeshr3/MakibesHR3Constants.java @@ -24,9 +24,6 @@ public final class MakibesHR3Constants { // TODO: breaking someone else's device support. public static final String PREF_HEADS_UP_SCREEN = "activate_display_on_lift_wrist"; public static final String PREF_LOST_REMINDER = "disconnect_notification"; - public static final String PREF_DO_NOT_DISTURB = "do_not_disturb_no_auto"; - public static final String PREF_DO_NOT_DISTURB_START = "do_not_disturb_no_auto_start"; - public static final String PREF_DO_NOT_DISTURB_END = "do_not_disturb_no_auto_end"; public static final String PREF_FIND_PHONE = "prefs_find_phone"; public static final String PREF_FIND_PHONE_DURATION = "prefs_find_phone_duration"; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/makibeshr3/MakibesHR3Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/makibeshr3/MakibesHR3Coordinator.java index c513dd3eb..38af7b9a6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/makibeshr3/MakibesHR3Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/makibeshr3/MakibesHR3Coordinator.java @@ -95,13 +95,13 @@ public class MakibesHR3Coordinator extends AbstractDeviceCoordinator { * @return True if quite hours are enabled. */ public static boolean getQuiteHours(SharedPreferences sharedPrefs, Calendar startOut, Calendar endOut) { - String doNotDisturb = sharedPrefs.getString(MakibesHR3Constants.PREF_DO_NOT_DISTURB, getContext().getString(R.string.p_off)); + String doNotDisturb = sharedPrefs.getString(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_NOAUTO, getContext().getString(R.string.p_off)); if (doNotDisturb.equals(getContext().getString(R.string.p_off))) { return false; } else { - String start = sharedPrefs.getString(MakibesHR3Constants.PREF_DO_NOT_DISTURB_START, "00:00"); - String end = sharedPrefs.getString(MakibesHR3Constants.PREF_DO_NOT_DISTURB_END, "00:00"); + String start = sharedPrefs.getString(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_NOAUTO_START, "00:00"); + String end = sharedPrefs.getString(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_NOAUTO_END, "00:00"); DateFormat df = new SimpleDateFormat("HH:mm"); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandConst.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandConst.java index 95f0e506e..e6e79ef1d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandConst.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandConst.java @@ -36,13 +36,6 @@ public final class MiBandConst { public static final String PREF_MI2_DISPLAY_ITEM_BATTERY = "battery"; public static final String PREF_MI2_ROTATE_WRIST_TO_SWITCH_INFO = "rotate_wrist_to_cycle_info"; public static final String PREF_MI2_ENABLE_TEXT_NOTIFICATIONS = "mi2_enable_text_notifications"; - public static final String PREF_DO_NOT_DISTURB = "do_not_disturb"; - public static final String PREF_DO_NOT_DISTURB_LIFT_WRIST = "do_not_disturb_lift_wrist"; - public static final String PREF_DO_NOT_DISTURB_OFF = "off"; - public static final String PREF_DO_NOT_DISTURB_AUTOMATIC = "automatic"; - public static final String PREF_DO_NOT_DISTURB_SCHEDULED = "scheduled"; - public static final String PREF_DO_NOT_DISTURB_START = "do_not_disturb_start"; - public static final String PREF_DO_NOT_DISTURB_END = "do_not_disturb_end"; public static final String PREF_MI2_INACTIVITY_WARNINGS = "mi2_inactivity_warnings"; public static final String PREF_MI2_INACTIVITY_WARNINGS_THRESHOLD = "mi2_inactivity_warnings_threshold"; public static final String PREF_MI2_INACTIVITY_WARNINGS_START = "mi2_inactivity_warnings_start"; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/zetime/ZeTimeConstants.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/zetime/ZeTimeConstants.java index 5f2ec9c39..e23eefaef 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/zetime/ZeTimeConstants.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/zetime/ZeTimeConstants.java @@ -135,10 +135,6 @@ public class ZeTimeConstants { public static final String PREF_ZETIME_MIN_HEARTRATE = "alarm_min_heart_rate"; public static final String PREF_ZETIME_HEARTRATE_INTERVAL = "heartrate_measurement_interval"; - public static final String PREF_DO_NOT_DISTURB = "zetime_do_not_disturb"; - public static final String PREF_DO_NOT_DISTURB_START = "zetime_do_not_disturb_start"; - public static final String PREF_DO_NOT_DISTURB_END = "zetime_do_not_disturb_end"; - public static final String PREF_INACTIVITY_KEY = "zetime_inactivity_warning_key"; public static final String PREF_INACTIVITY_ENABLE = "zetime_inactivity_warnings"; public static final String PREF_INACTIVITY_START = "zetime_inactivity_warnings_start"; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/zetime/ZeTimePreferenceActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/zetime/ZeTimePreferenceActivity.java index 9aa70641b..d466cb593 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/zetime/ZeTimePreferenceActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/zetime/ZeTimePreferenceActivity.java @@ -49,10 +49,6 @@ public class ZeTimePreferenceActivity extends AbstractSettingsActivity { addPreferenceHandlerFor(ZeTimeConstants.PREF_HANDMOVE_DISPLAY); - addPreferenceHandlerFor(ZeTimeConstants.PREF_DO_NOT_DISTURB); - addPreferenceHandlerFor(ZeTimeConstants.PREF_DO_NOT_DISTURB_START); - addPreferenceHandlerFor(ZeTimeConstants.PREF_DO_NOT_DISTURB_END); - addPreferenceHandlerFor(ZeTimeConstants.PREF_CALORIES_TYPE); addPreferenceHandlerFor(ZeTimeConstants.PREF_DATE_FORMAT); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java index 313ac3b1b..2f3cb0ea3 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/HuamiSupport.java @@ -150,6 +150,10 @@ import nodomain.freeyourgadget.gadgetbridge.util.Version; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_ALLOW_HIGH_MTU; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_BT_CONNECTED_ADVERTISEMENT; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DATEFORMAT; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_START; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_END; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_LIFT_WRIST; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_LANGUAGE; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_RESERVER_ALARMS_CALENDAR; import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_RESERVER_REMINDERS_CALENDAR; @@ -2232,10 +2236,10 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport { case ActivityUser.PREF_USER_STEPS_GOAL: setFitnessGoal(builder); break; - case MiBandConst.PREF_DO_NOT_DISTURB: - case MiBandConst.PREF_DO_NOT_DISTURB_START: - case MiBandConst.PREF_DO_NOT_DISTURB_END: - case MiBandConst.PREF_DO_NOT_DISTURB_LIFT_WRIST: + case PREF_DO_NOT_DISTURB: + case PREF_DO_NOT_DISTURB_START: + case PREF_DO_NOT_DISTURB_END: + case PREF_DO_NOT_DISTURB_LIFT_WRIST: setDoNotDisturb(builder); break; case MiBandConst.PREF_MI2_INACTIVITY_WARNINGS: diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lenovo/watchxplus/WatchXPlusDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lenovo/watchxplus/WatchXPlusDeviceSupport.java index cb0e3938f..defb7dc67 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lenovo/watchxplus/WatchXPlusDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lenovo/watchxplus/WatchXPlusDeviceSupport.java @@ -986,7 +986,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport { case DeviceSettingsPreferenceConst.PREF_TIMEFORMAT: setLanguageAndTimeFormat(builder); break; - case WatchXPlusConstants.PREF_DO_NOT_DISTURB: + case DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_NOAUTO: setDNDHours(builder); break; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/makibeshr3/MakibesHR3DeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/makibeshr3/MakibesHR3DeviceSupport.java index 201e72d12..63cee958a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/makibeshr3/MakibesHR3DeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/makibeshr3/MakibesHR3DeviceSupport.java @@ -559,9 +559,9 @@ public class MakibesHR3DeviceSupport extends AbstractBTLEDeviceSupport implement this.setHeadsUpScreen(transactionBuilder, sharedPreferences); } else if (key.equals(MakibesHR3Constants.PREF_LOST_REMINDER)) { this.setLostReminder(transactionBuilder, sharedPreferences); - } else if (key.equals(MakibesHR3Constants.PREF_DO_NOT_DISTURB) || - key.equals(MakibesHR3Constants.PREF_DO_NOT_DISTURB_START) || - key.equals(MakibesHR3Constants.PREF_DO_NOT_DISTURB_END)) { + } else if (key.equals(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_NOAUTO) || + key.equals(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_NOAUTO_START) || + key.equals(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_NOAUTO_END)) { this.setQuiteHours(transactionBuilder, sharedPreferences); } else if (key.equals(MakibesHR3Constants.PREF_FIND_PHONE) || key.equals(MakibesHR3Constants.PREF_FIND_PHONE_DURATION)) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java index 33385e3b1..91102fdc5 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/zetime/ZeTimeDeviceSupport.java @@ -169,9 +169,9 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport { case ZeTimeConstants.PREF_HANDMOVE_DISPLAY: setDisplayOnMovement(builder); break; - case ZeTimeConstants.PREF_DO_NOT_DISTURB: - case ZeTimeConstants.PREF_DO_NOT_DISTURB_START: - case ZeTimeConstants.PREF_DO_NOT_DISTURB_END: + case DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB: + case DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_START: + case DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_END: setDoNotDisturb(builder); break; case ZeTimeConstants.PREF_CALORIES_TYPE: @@ -1713,10 +1713,10 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport { private void setDoNotDisturb(TransactionBuilder builder) { Prefs prefs = GBApplication.getPrefs(); - String scheduled = prefs.getString(ZeTimeConstants.PREF_DO_NOT_DISTURB, "off"); + String scheduled = prefs.getString(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB, "off"); String dndScheduled = getContext().getString(R.string.p_scheduled); - String start = prefs.getString(ZeTimeConstants.PREF_DO_NOT_DISTURB_START, "22:00"); - String end = prefs.getString(ZeTimeConstants.PREF_DO_NOT_DISTURB_END, "07:00"); + String start = prefs.getString(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_START, "22:00"); + String end = prefs.getString(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_END, "07:00"); DateFormat df_start = new SimpleDateFormat("HH:mm"); DateFormat df_end = new SimpleDateFormat("HH:mm"); Calendar calendar = GregorianCalendar.getInstance(); @@ -2086,12 +2086,12 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport { String endtime = String.format("%02d:%02d", msg[8], msg[9]); if (0x1 == msg[5]) { - prefs.putString(ZeTimeConstants.PREF_DO_NOT_DISTURB, "scheduled"); + prefs.putString(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB, "scheduled"); } else { - prefs.putString(ZeTimeConstants.PREF_DO_NOT_DISTURB, "off"); + prefs.putString(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB, "off"); } - prefs.putString(ZeTimeConstants.PREF_DO_NOT_DISTURB_START, starttime); - prefs.putString(ZeTimeConstants.PREF_DO_NOT_DISTURB_END, endtime); + prefs.putString(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_START, starttime); + prefs.putString(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_END, endtime); prefs.apply(); } diff --git a/app/src/main/res/xml/zetime_preferences.xml b/app/src/main/res/xml/zetime_preferences.xml index 6058df64c..263962f36 100644 --- a/app/src/main/res/xml/zetime_preferences.xml +++ b/app/src/main/res/xml/zetime_preferences.xml @@ -173,18 +173,18 @@ android:defaultValue="@string/p_off" android:entries="@array/zetime_do_not_disturb" android:entryValues="@array/zetime_do_not_disturb_values" - android:key="zetime_do_not_disturb" + android:key="do_not_disturb" android:title="@string/mi2_prefs_do_not_disturb" android:summary="%s" />