Remove redundant constants
This commit is contained in:
parent
619780977c
commit
02e790dd00
|
@ -98,7 +98,8 @@ public class DeviceSettingsPreferenceConst {
|
|||
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_FIND_PHONE = "prefs_find_phone";
|
||||
public static final String PREF_FIND_PHONE_DURATION = "prefs_find_phone_duration";
|
||||
public static final String PREF_AUTOLIGHT = "autolight";
|
||||
public static final String PREF_AUTOREMOVE_MESSAGE = "autoremove_message";
|
||||
public static final String PREF_AUTOREMOVE_NOTIFICATIONS = "autoremove_notifications";
|
||||
|
|
|
@ -57,7 +57,6 @@ import nodomain.freeyourgadget.gadgetbridge.util.XTimePreference;
|
|||
import nodomain.freeyourgadget.gadgetbridge.util.XTimePreferenceFragment;
|
||||
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.*;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_ACTIVATE_DISPLAY_ON_LIFT;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_FELL_SLEEP_BROADCAST;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_FELL_SLEEP_SELECTION;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DEVICE_ACTION_SELECTION_BROADCAST;
|
||||
|
@ -71,8 +70,6 @@ import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF
|
|||
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_DISPLAY_ON_LIFT_END;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISPLAY_ON_LIFT_START;
|
||||
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;
|
||||
|
@ -391,7 +388,8 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat imp
|
|||
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_FIND_PHONE);
|
||||
addPreferenceHandlerFor(PREF_FIND_PHONE_DURATION);
|
||||
addPreferenceHandlerFor(PREF_AUTOLIGHT);
|
||||
addPreferenceHandlerFor(PREF_AUTOREMOVE_MESSAGE);
|
||||
addPreferenceHandlerFor(PREF_AUTOREMOVE_NOTIFICATIONS);
|
||||
|
@ -596,7 +594,7 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat imp
|
|||
setInputTypeFor(HuamiConst.PREF_BUTTON_ACTION_PRESS_MAX_INTERVAL, InputType.TYPE_CLASS_NUMBER);
|
||||
setInputTypeFor(HuamiConst.PREF_BUTTON_ACTION_PRESS_COUNT, InputType.TYPE_CLASS_NUMBER);
|
||||
setInputTypeFor(MiBandConst.PREF_MIBAND_DEVICE_TIME_OFFSET_HOURS, InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED);
|
||||
setInputTypeFor(MakibesHR3Constants.PREF_FIND_PHONE_DURATION, InputType.TYPE_CLASS_NUMBER);
|
||||
setInputTypeFor(DeviceSettingsPreferenceConst.PREF_FIND_PHONE_DURATION, InputType.TYPE_CLASS_NUMBER);
|
||||
setInputTypeFor(DeviceSettingsPreferenceConst.PREF_RESERVER_ALARMS_CALENDAR, InputType.TYPE_CLASS_NUMBER);
|
||||
setInputTypeFor(DeviceSettingsPreferenceConst.PREF_RESERVER_REMINDERS_CALENDAR, InputType.TYPE_CLASS_NUMBER);
|
||||
|
||||
|
|
|
@ -57,10 +57,6 @@ public class HuamiConst {
|
|||
public static final String AMAZFIT_X = "Amazfit X";
|
||||
|
||||
|
||||
public static final String PREF_ACTIVATE_DISPLAY_ON_LIFT = "activate_display_on_lift_wrist";
|
||||
public static final String PREF_DISPLAY_ON_LIFT_START = "display_on_lift_start";
|
||||
public static final String PREF_DISPLAY_ON_LIFT_END = "display_on_lift_end";
|
||||
|
||||
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";
|
||||
|
|
|
@ -147,7 +147,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_ACTIVATE_DISPLAY_ON_LIFT, liftOff);
|
||||
String pref = prefs.getString(DeviceSettingsPreferenceConst.PREF_ACTIVATE_DISPLAY_ON_LIFT, liftOff);
|
||||
|
||||
if (liftOn.equals(pref)) {
|
||||
return ActivateDisplayOnLift.ON;
|
||||
|
@ -159,11 +159,11 @@ public abstract class HuamiCoordinator extends AbstractDeviceCoordinator {
|
|||
}
|
||||
|
||||
public static Date getDisplayOnLiftStart(String deviceAddress) {
|
||||
return getTimePreference(HuamiConst.PREF_DISPLAY_ON_LIFT_START, "00:00", deviceAddress);
|
||||
return getTimePreference(DeviceSettingsPreferenceConst.PREF_DISPLAY_ON_LIFT_START, "00:00", deviceAddress);
|
||||
}
|
||||
|
||||
public static Date getDisplayOnLiftEnd(String deviceAddress) {
|
||||
return getTimePreference(HuamiConst.PREF_DISPLAY_ON_LIFT_END, "00:00", deviceAddress);
|
||||
return getTimePreference(DeviceSettingsPreferenceConst.PREF_DISPLAY_ON_LIFT_END, "00:00", deviceAddress);
|
||||
}
|
||||
|
||||
public static DisconnectNotificationSetting getDisconnectNotificationSetting(Context context, String deviceAddress) {
|
||||
|
|
|
@ -31,10 +31,6 @@ public final class WatchXPlusConstants extends LenovoWatchConstants {
|
|||
public static final UUID UUID_CHARACTERISTIC_UNKNOWN_4 = UUID.fromString("0000a804-0000-1000-8000-00805f9b34fb");
|
||||
|
||||
|
||||
|
||||
public static final String PREF_FIND_PHONE = "prefs_find_phone";
|
||||
public static final String PREF_FIND_PHONE_DURATION = "prefs_find_phone_duration";
|
||||
|
||||
// new
|
||||
public static final String PREF_CONTINIOUS_RING = "notification_enable_continious_ring";
|
||||
public static final String PREF_REPEAT_RING = "notification_repeat_ring";
|
||||
|
@ -47,8 +43,6 @@ public final class WatchXPlusConstants extends LenovoWatchConstants {
|
|||
public static final String PREF_BP_CAL_HIGH = "pref_sensors_bp_calibration_high";
|
||||
|
||||
public static final String PREF_SHOW_RAW_GRAPH = "show_raw_graph";
|
||||
// moved to gear icon (per device settings)
|
||||
public static final String PREF_LANGUAGE = "language";
|
||||
|
||||
// time format constants
|
||||
public static final byte ARG_SET_TIMEMODE_24H = 0x00;
|
||||
|
|
|
@ -206,7 +206,7 @@ public class WatchXPlusDeviceCoordinator extends AbstractDeviceCoordinator {
|
|||
* @return {@link #FindPhone_OFF}, {@link #FindPhone_ON}, or the duration
|
||||
*/
|
||||
public static int getFindPhone(SharedPreferences sharedPrefs) {
|
||||
String findPhone = sharedPrefs.getString(WatchXPlusConstants.PREF_FIND_PHONE, getContext().getString(R.string.p_off));
|
||||
String findPhone = sharedPrefs.getString(DeviceSettingsPreferenceConst.PREF_FIND_PHONE, getContext().getString(R.string.p_off));
|
||||
|
||||
assert findPhone != null;
|
||||
if (findPhone.equals(getContext().getString(R.string.p_off))) {
|
||||
|
@ -214,7 +214,7 @@ public class WatchXPlusDeviceCoordinator extends AbstractDeviceCoordinator {
|
|||
} else if (findPhone.equals(getContext().getString(R.string.p_on))) {
|
||||
return FindPhone_ON;
|
||||
} else { // Duration
|
||||
String duration = sharedPrefs.getString(WatchXPlusConstants.PREF_FIND_PHONE_DURATION, "0");
|
||||
String duration = sharedPrefs.getString(DeviceSettingsPreferenceConst.PREF_FIND_PHONE_DURATION, "0");
|
||||
|
||||
try {
|
||||
int iDuration;
|
||||
|
|
|
@ -22,10 +22,7 @@ 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_HEADS_UP_SCREEN = "activate_display_on_lift_wrist";
|
||||
public static final String PREF_LOST_REMINDER = "disconnect_notification";
|
||||
public static final String PREF_FIND_PHONE = "prefs_find_phone";
|
||||
public static final String PREF_FIND_PHONE_DURATION = "prefs_find_phone_duration";
|
||||
|
||||
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");
|
||||
|
|
|
@ -64,7 +64,7 @@ public class MakibesHR3Coordinator extends AbstractDeviceCoordinator {
|
|||
|
||||
|
||||
public static boolean shouldEnableHeadsUpScreen(SharedPreferences sharedPrefs) {
|
||||
String liftMode = sharedPrefs.getString(MakibesHR3Constants.PREF_HEADS_UP_SCREEN, getContext().getString(R.string.p_on));
|
||||
String liftMode = sharedPrefs.getString(DeviceSettingsPreferenceConst.PREF_ACTIVATE_DISPLAY_ON_LIFT, getContext().getString(R.string.p_on));
|
||||
|
||||
// Makibes HR3 doesn't support scheduled intervals. Treat it as "on".
|
||||
return !liftMode.equals(getContext().getString(R.string.p_off));
|
||||
|
@ -121,14 +121,14 @@ public class MakibesHR3Coordinator extends AbstractDeviceCoordinator {
|
|||
* @return {@link #FindPhone_OFF}, {@link #FindPhone_ON}, or the duration
|
||||
*/
|
||||
public static int getFindPhone(SharedPreferences sharedPrefs) {
|
||||
String findPhone = sharedPrefs.getString(MakibesHR3Constants.PREF_FIND_PHONE, getContext().getString(R.string.p_off));
|
||||
String findPhone = sharedPrefs.getString(DeviceSettingsPreferenceConst.PREF_FIND_PHONE, getContext().getString(R.string.p_off));
|
||||
|
||||
if (findPhone.equals(getContext().getString(R.string.p_off))) {
|
||||
return FindPhone_OFF;
|
||||
} else if (findPhone.equals(getContext().getString(R.string.p_on))) {
|
||||
return FindPhone_ON;
|
||||
} else { // Duration
|
||||
String duration = sharedPrefs.getString(MakibesHR3Constants.PREF_FIND_PHONE_DURATION, "0");
|
||||
String duration = sharedPrefs.getString(DeviceSettingsPreferenceConst.PREF_FIND_PHONE_DURATION, "0");
|
||||
|
||||
try {
|
||||
int iDuration;
|
||||
|
|
|
@ -70,7 +70,8 @@ import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
|||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_AUTOLIGHT;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_AUTOREMOVE_MESSAGE;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_FAKE_RING_DURATION;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_FIND_PHONE_ENABLED;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_FIND_PHONE;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_FIND_PHONE_DURATION;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_KEY_VIBRATION;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_OPERATING_SOUNDS;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_TIMEFORMAT;
|
||||
|
@ -381,7 +382,7 @@ public class CasioGBX100DeviceSupport extends CasioSupport implements SharedPref
|
|||
if (start) {
|
||||
SharedPreferences sharedPreferences = GBApplication.getDeviceSpecificSharedPrefs(getDevice().getAddress());
|
||||
|
||||
String findPhone = sharedPreferences.getString(PREF_FIND_PHONE_ENABLED, getContext().getString(R.string.p_off));
|
||||
String findPhone = sharedPreferences.getString(PREF_FIND_PHONE, getContext().getString(R.string.p_off));
|
||||
|
||||
if(findPhone.equals(getContext().getString(R.string.p_off)))
|
||||
return;
|
||||
|
@ -391,7 +392,7 @@ public class CasioGBX100DeviceSupport extends CasioSupport implements SharedPref
|
|||
evaluateGBDeviceEvent(findPhoneEvent);
|
||||
|
||||
if(!findPhone.equals(getContext().getString(R.string.p_on))) {
|
||||
String duration = sharedPreferences.getString(MakibesHR3Constants.PREF_FIND_PHONE_DURATION, "0");
|
||||
String duration = sharedPreferences.getString(PREF_FIND_PHONE_DURATION, "0");
|
||||
|
||||
try {
|
||||
int iDuration;
|
||||
|
@ -620,8 +621,8 @@ public class CasioGBX100DeviceSupport extends CasioSupport implements SharedPref
|
|||
new SetConfigurationOperation(this, CasioConstants.ConfigurationOption.OPTION_OPERATING_SOUNDS).perform();
|
||||
break;
|
||||
case PREF_FAKE_RING_DURATION:
|
||||
case PREF_FIND_PHONE_ENABLED:
|
||||
case MakibesHR3Constants.PREF_FIND_PHONE_DURATION:
|
||||
case PREF_FIND_PHONE:
|
||||
case PREF_FIND_PHONE_DURATION:
|
||||
// No action, we check the shared preferences when the device tries to ring the phone.
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -147,9 +147,12 @@ import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
|||
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.Version;
|
||||
|
||||
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_ACTIVATE_DISPLAY_ON_LIFT;
|
||||
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_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_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;
|
||||
|
@ -2219,9 +2222,9 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
|
|||
case MiBandConst.PREF_MI2_GOAL_NOTIFICATION:
|
||||
setGoalNotification(builder);
|
||||
break;
|
||||
case HuamiConst.PREF_ACTIVATE_DISPLAY_ON_LIFT:
|
||||
case HuamiConst.PREF_DISPLAY_ON_LIFT_START:
|
||||
case HuamiConst.PREF_DISPLAY_ON_LIFT_END:
|
||||
case PREF_ACTIVATE_DISPLAY_ON_LIFT:
|
||||
case PREF_DISPLAY_ON_LIFT_START:
|
||||
case PREF_DISPLAY_ON_LIFT_END:
|
||||
setActivateDisplayOnLiftWrist(builder);
|
||||
break;
|
||||
case HuamiConst.PREF_DISCONNECT_NOTIFICATION:
|
||||
|
|
|
@ -960,7 +960,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||
case DeviceSettingsPreferenceConst.PREF_POWER_MODE:
|
||||
setPowerMode();
|
||||
break;
|
||||
case WatchXPlusConstants.PREF_LANGUAGE:
|
||||
case DeviceSettingsPreferenceConst.PREF_LANGUAGE:
|
||||
setLanguageAndTimeFormat(builder);
|
||||
break;
|
||||
|
||||
|
@ -2128,7 +2128,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||
// set time format
|
||||
private void setLanguageAndTimeFormat(TransactionBuilder transactionBuilder) {
|
||||
byte setLanguage, setTimeMode;
|
||||
String languageString = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString(WatchXPlusConstants.PREF_LANGUAGE, "1");
|
||||
String languageString = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString(DeviceSettingsPreferenceConst.PREF_LANGUAGE, "1");
|
||||
if (languageString == null || languageString.equals("1")) {
|
||||
setLanguage = 0x01;
|
||||
} else {
|
||||
|
|
|
@ -555,7 +555,7 @@ public class MakibesHR3DeviceSupport extends AbstractBTLEDeviceSupport implement
|
|||
|
||||
if (key.equals(DeviceSettingsPreferenceConst.PREF_TIMEFORMAT)) {
|
||||
this.setTimeMode(transactionBuilder, sharedPreferences);
|
||||
} else if (key.equals(MakibesHR3Constants.PREF_HEADS_UP_SCREEN)) {
|
||||
} else if (key.equals(DeviceSettingsPreferenceConst.PREF_ACTIVATE_DISPLAY_ON_LIFT)) {
|
||||
this.setHeadsUpScreen(transactionBuilder, sharedPreferences);
|
||||
} else if (key.equals(MakibesHR3Constants.PREF_LOST_REMINDER)) {
|
||||
this.setLostReminder(transactionBuilder, sharedPreferences);
|
||||
|
@ -563,8 +563,8 @@ public class MakibesHR3DeviceSupport extends AbstractBTLEDeviceSupport implement
|
|||
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)) {
|
||||
} else if (key.equals(DeviceSettingsPreferenceConst.PREF_FIND_PHONE) ||
|
||||
key.equals(DeviceSettingsPreferenceConst.PREF_FIND_PHONE_DURATION)) {
|
||||
// No action, we check the shared preferences when the device tries to ring the phone.
|
||||
} else {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue