mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-25 11:26:47 +01:00
Move disconnect_notification constant to generic
This commit is contained in:
parent
02e790dd00
commit
48890d1d34
@ -41,6 +41,10 @@ public class DeviceSettingsPreferenceConst {
|
||||
public static final String PREF_VIBRATION_STRENGH_PERCENTAGE = "vibration_strength";
|
||||
public static final String PREF_RELAX_FIRMWARE_CHECKS = "relax_firmware_checks";
|
||||
|
||||
public static final String PREF_DISCONNECT_NOTIFICATION = "disconnect_notification";
|
||||
public static final String PREF_DISCONNECT_NOTIFICATION_START = "disconnect_notification_start";
|
||||
public static final String PREF_DISCONNECT_NOTIFICATION_END = "disconnect_notification_end";
|
||||
|
||||
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_SAVE_RAW_ACTIVITY_FILES = "save_raw_activity_files";
|
||||
|
@ -65,9 +65,6 @@ import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_START_NON_WEAR_SELECTION;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_WOKE_UP_BROADCAST;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_WOKE_UP_SELECTION;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISCONNECT_NOTIFICATION;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISCONNECT_NOTIFICATION_END;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISCONNECT_NOTIFICATION_START;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISPLAY_ITEMS;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISPLAY_ITEMS_SORTABLE;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_EXPOSE_HR_THIRDPARTY;
|
||||
|
@ -57,10 +57,6 @@ public class HuamiConst {
|
||||
public static final String AMAZFIT_X = "Amazfit X";
|
||||
|
||||
|
||||
public static final String PREF_DISCONNECT_NOTIFICATION = "disconnect_notification";
|
||||
public static final String PREF_DISCONNECT_NOTIFICATION_START = "disconnect_notification_start";
|
||||
public static final String PREF_DISCONNECT_NOTIFICATION_END = "disconnect_notification_end";
|
||||
|
||||
public static final String PREF_DISPLAY_ITEMS = "display_items";
|
||||
public static final String PREF_DISPLAY_ITEMS_SORTABLE = "display_items_sortable";
|
||||
public static final String PREF_SHORTCUTS = "shortcuts";
|
||||
|
@ -173,7 +173,7 @@ public abstract class HuamiCoordinator extends AbstractDeviceCoordinator {
|
||||
String liftOn = context.getString(R.string.p_on);
|
||||
String liftScheduled = context.getString(R.string.p_scheduled);
|
||||
|
||||
String pref = prefs.getString(HuamiConst.PREF_DISCONNECT_NOTIFICATION, liftOff);
|
||||
String pref = prefs.getString(DeviceSettingsPreferenceConst.PREF_DISCONNECT_NOTIFICATION, liftOff);
|
||||
|
||||
if (liftOn.equals(pref)) {
|
||||
return DisconnectNotificationSetting.ON;
|
||||
@ -185,11 +185,11 @@ public abstract class HuamiCoordinator extends AbstractDeviceCoordinator {
|
||||
}
|
||||
|
||||
public static Date getDisconnectNotificationStart(String deviceAddress) {
|
||||
return getTimePreference(HuamiConst.PREF_DISCONNECT_NOTIFICATION_START, "00:00", deviceAddress);
|
||||
return getTimePreference(DeviceSettingsPreferenceConst.PREF_DISCONNECT_NOTIFICATION_START, "00:00", deviceAddress);
|
||||
}
|
||||
|
||||
public static Date getDisconnectNotificationEnd(String deviceAddress) {
|
||||
return getTimePreference(HuamiConst.PREF_DISCONNECT_NOTIFICATION_END, "00:00", deviceAddress);
|
||||
return getTimePreference(DeviceSettingsPreferenceConst.PREF_DISCONNECT_NOTIFICATION_END, "00:00", deviceAddress);
|
||||
}
|
||||
|
||||
public static boolean getUseCustomFont(String deviceAddress) {
|
||||
|
@ -20,10 +20,6 @@ import java.util.UUID;
|
||||
|
||||
public final class MakibesHR3Constants {
|
||||
|
||||
// TODO: This doesn't belong here, but I don't want to touch other files to avoid
|
||||
// TODO: breaking someone else's device support.
|
||||
public static final String PREF_LOST_REMINDER = "disconnect_notification";
|
||||
|
||||
public static final UUID UUID_SERVICE = UUID.fromString("6e400001-b5a3-f393-e0a9-e50e24dcca9e");
|
||||
public static final UUID UUID_CHARACTERISTIC_CONTROL = UUID.fromString("6e400002-b5a3-f393-e0a9-e50e24dcca9e");
|
||||
public static final UUID UUID_CHARACTERISTIC_REPORT = UUID.fromString("6e400003-b5a3-f393-e0a9-e50e24dcca9e");
|
||||
|
@ -71,7 +71,7 @@ public class MakibesHR3Coordinator extends AbstractDeviceCoordinator {
|
||||
}
|
||||
|
||||
public static boolean shouldEnableLostReminder(SharedPreferences sharedPrefs) {
|
||||
String lostReminder = sharedPrefs.getString(MakibesHR3Constants.PREF_LOST_REMINDER, getContext().getString(R.string.p_on));
|
||||
String lostReminder = sharedPrefs.getString(DeviceSettingsPreferenceConst.PREF_DISCONNECT_NOTIFICATION, getContext().getString(R.string.p_on));
|
||||
|
||||
// Makibes HR3 doesn't support scheduled intervals. Treat it as "on".
|
||||
return !lostReminder.equals(getContext().getString(R.string.p_off));
|
||||
|
@ -153,6 +153,9 @@ 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_DISPLAY_ON_LIFT_START;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DISPLAY_ON_LIFT_END;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DISCONNECT_NOTIFICATION;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DISCONNECT_NOTIFICATION_START;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DISCONNECT_NOTIFICATION_END;
|
||||
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;
|
||||
@ -2227,9 +2230,9 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
|
||||
case PREF_DISPLAY_ON_LIFT_END:
|
||||
setActivateDisplayOnLiftWrist(builder);
|
||||
break;
|
||||
case HuamiConst.PREF_DISCONNECT_NOTIFICATION:
|
||||
case HuamiConst.PREF_DISCONNECT_NOTIFICATION_START:
|
||||
case HuamiConst.PREF_DISCONNECT_NOTIFICATION_END:
|
||||
case PREF_DISCONNECT_NOTIFICATION:
|
||||
case PREF_DISCONNECT_NOTIFICATION_START:
|
||||
case PREF_DISCONNECT_NOTIFICATION_END:
|
||||
setDisconnectNotification(builder);
|
||||
break;
|
||||
case HuamiConst.PREF_DISPLAY_ITEMS:
|
||||
|
@ -557,7 +557,7 @@ public class MakibesHR3DeviceSupport extends AbstractBTLEDeviceSupport implement
|
||||
this.setTimeMode(transactionBuilder, sharedPreferences);
|
||||
} else if (key.equals(DeviceSettingsPreferenceConst.PREF_ACTIVATE_DISPLAY_ON_LIFT)) {
|
||||
this.setHeadsUpScreen(transactionBuilder, sharedPreferences);
|
||||
} else if (key.equals(MakibesHR3Constants.PREF_LOST_REMINDER)) {
|
||||
} else if (key.equals(DeviceSettingsPreferenceConst.PREF_DISCONNECT_NOTIFICATION)) {
|
||||
this.setLostReminder(transactionBuilder, sharedPreferences);
|
||||
} else if (key.equals(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_NOAUTO) ||
|
||||
key.equals(DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_NOAUTO_START) ||
|
||||
|
Loading…
Reference in New Issue
Block a user