From 66b8fb004e69b95b3ceb582543a323f286dfee70 Mon Sep 17 00:00:00 2001 From: Damien Gaignon Date: Sun, 6 Mar 2022 17:46:12 +0100 Subject: [PATCH 01/31] Move mi_ constants --- .../devicesettings/DeviceSettingsPreferenceConst.java | 1 + .../devicesettings/DeviceSpecificSettingsFragment.java | 1 + .../gadgetbridge/devices/zetime/ZeTimeConstants.java | 1 - .../gadgetbridge/devices/zetime/ZeTimePreferenceActivity.java | 1 - .../freeyourgadget/gadgetbridge/model/ActivityUser.java | 2 +- .../service/devices/zetime/ZeTimeDeviceSupport.java | 2 +- app/src/main/res/xml/about_user.xml | 2 +- app/src/main/res/xml/miband_preferences.xml | 2 +- app/src/main/res/xml/zetime_preferences.xml | 2 +- 9 files changed, 7 insertions(+), 7 deletions(-) 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 5bf18d994..582bc9ffa 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 @@ -158,4 +158,5 @@ public class DeviceSettingsPreferenceConst { public static final String PREF_SOUNDS = "sounds"; public static final String PREF_AUTH_KEY = "authkey"; + public static final String PREF_USER_FITNESS_GOAL = "fitness_goal"; } 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 ccdc0e024..7a884c319 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 @@ -453,6 +453,7 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat imp addPreferenceHandlerFor(PREF_SONY_CONNECT_TWO_DEVICES); addPreferenceHandlerFor(PREF_QC35_NOISE_CANCELLING_LEVEL); + addPreferenceHandlerFor(PREF_USER_FITNESS_GOAL); String sleepTimeState = prefs.getString(PREF_SLEEP_TIME, PREF_DO_NOT_DISTURB_OFF); boolean sleepTimeScheduled = sleepTimeState.equals(PREF_DO_NOT_DISTURB_SCHEDULED); 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 b9528ab2e..5f2ec9c39 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 @@ -169,7 +169,6 @@ public class ZeTimeConstants { public static final String PREF_LOW_POWER_SIGNALING = "zetime_vibration_profile_lowpower"; public static final String PREF_ANTI_LOSS_SIGNALING = "zetime_vibration_profile_antiloss"; - public static final String PREF_USER_FITNESS_GOAL = "mi_fitness_goal"; public static final String PREF_USER_SLEEP_GOAL = "activity_user_sleep_duration"; public static final String PREF_USER_CALORIES_GOAL = "activity_user_calories_burnt"; public static final String PREF_USER_DISTANCE_GOAL = "activity_user_distance_meters"; 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 bc9bbcedb..9aa70641b 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 @@ -85,7 +85,6 @@ public class ZeTimePreferenceActivity extends AbstractSettingsActivity { addPreferenceHandlerFor(ZeTimeConstants.PREF_ZETIME_MIN_HEARTRATE); - addPreferenceHandlerFor(ZeTimeConstants.PREF_USER_FITNESS_GOAL); addPreferenceHandlerFor(ZeTimeConstants.PREF_USER_SLEEP_GOAL); addPreferenceHandlerFor(ZeTimeConstants.PREF_USER_CALORIES_GOAL); addPreferenceHandlerFor(ZeTimeConstants.PREF_USER_DISTANCE_GOAL); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/ActivityUser.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/ActivityUser.java index 113738cd2..89701c0c9 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/ActivityUser.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/ActivityUser.java @@ -65,7 +65,7 @@ public class ActivityUser { public static final String PREF_USER_HEIGHT_CM = "activity_user_height_cm"; public static final String PREF_USER_WEIGHT_KG = "activity_user_weight_kg"; public static final String PREF_USER_SLEEP_DURATION = "activity_user_sleep_duration"; - public static final String PREF_USER_STEPS_GOAL = "mi_fitness_goal"; // FIXME: for compatibility + public static final String PREF_USER_STEPS_GOAL = "fitness_goal"; // FIXME: for compatibility public static final String PREF_USER_CALORIES_BURNT = "activity_user_calories_burnt"; public static final String PREF_USER_DISTANCE_METERS = "activity_user_distance_meters"; public static final String PREF_USER_ACTIVETIME_MINUTES = "activity_user_activetime_minutes"; 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 46679b981..33385e3b1 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 @@ -215,7 +215,7 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport { case ZeTimeConstants.PREF_ZETIME_MIN_HEARTRATE: setHeartRateLimits(builder); break; - case ZeTimeConstants.PREF_USER_FITNESS_GOAL: + case DeviceSettingsPreferenceConst.PREF_USER_FITNESS_GOAL: case ZeTimeConstants.PREF_USER_SLEEP_GOAL: case ZeTimeConstants.PREF_USER_CALORIES_GOAL: case ZeTimeConstants.PREF_USER_DISTANCE_GOAL: diff --git a/app/src/main/res/xml/about_user.xml b/app/src/main/res/xml/about_user.xml index 0d092738b..8a62e160f 100644 --- a/app/src/main/res/xml/about_user.xml +++ b/app/src/main/res/xml/about_user.xml @@ -40,7 +40,7 @@ diff --git a/app/src/main/res/xml/miband_preferences.xml b/app/src/main/res/xml/miband_preferences.xml index 3705fa73e..2ef12c9c4 100644 --- a/app/src/main/res/xml/miband_preferences.xml +++ b/app/src/main/res/xml/miband_preferences.xml @@ -12,7 +12,7 @@ diff --git a/app/src/main/res/xml/zetime_preferences.xml b/app/src/main/res/xml/zetime_preferences.xml index 02a85af14..6058df64c 100644 --- a/app/src/main/res/xml/zetime_preferences.xml +++ b/app/src/main/res/xml/zetime_preferences.xml @@ -20,7 +20,7 @@ From 3b75a1701acfe5b2ac75e08c8910db951acd1844 Mon Sep 17 00:00:00 2001 From: Damien Gaignon Date: Sun, 6 Mar 2022 23:48:47 +0100 Subject: [PATCH 02/31] Clean DO_NOT_DISTURB* constants --- .../DeviceSettingsPreferenceConst.java | 7 +++++++ .../DeviceSpecificSettingsFragment.java | 11 ++++------ .../devices/huami/HuamiCoordinator.java | 12 +++++------ .../watchxplus/WatchXPlusConstants.java | 4 ---- .../WatchXPlusDeviceCoordinator.java | 6 +++--- .../makibeshr3/MakibesHR3Constants.java | 3 --- .../makibeshr3/MakibesHR3Coordinator.java | 6 +++--- .../devices/miband/MiBandConst.java | 7 ------- .../devices/zetime/ZeTimeConstants.java | 4 ---- .../zetime/ZeTimePreferenceActivity.java | 4 ---- .../service/devices/huami/HuamiSupport.java | 12 +++++++---- .../watchxplus/WatchXPlusDeviceSupport.java | 2 +- .../makibeshr3/MakibesHR3DeviceSupport.java | 6 +++--- .../devices/zetime/ZeTimeDeviceSupport.java | 20 +++++++++---------- app/src/main/res/xml/zetime_preferences.xml | 6 +++--- 15 files changed, 48 insertions(+), 62 deletions(-) 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" /> From ae796c81ebeb4acb2039dd869365f8875afb4ff7 Mon Sep 17 00:00:00 2001 From: Damien Gaignon Date: Mon, 7 Mar 2022 14:33:10 +0100 Subject: [PATCH 03/31] Move zetime_inactivity* constants --- .../DeviceSettingsPreferenceConst.java | 18 +++- .../DeviceSpecificSettingsFragment.java | 11 +++ .../devices/zetime/ZeTimeConstants.java | 13 --- .../zetime/ZeTimePreferenceActivity.java | 12 --- .../devices/zetime/ZeTimeDeviceSupport.java | 82 +++++++++---------- app/src/main/res/xml/zetime_preferences.xml | 32 ++++---- 6 files changed, 83 insertions(+), 85 deletions(-) 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 5c5029afb..9282e89b3 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 @@ -63,6 +63,21 @@ public class DeviceSettingsPreferenceConst { public static final String PREF_DISCONNECTNOTIF_NOSHED = "disconnect_notification_noshed"; 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_LONGSIT_PERIOD = "pref_longsit_period"; + public static final String PREF_LONGSIT_SWITCH = "pref_longsit_switch"; + public static final String PREF_LONGSIT_SWITCH_NOSHED = "screen_longsit_noshed"; + public static final String PREF_INACTIVITY_KEY = "inactivity_warnings_key"; + public static final String PREF_INACTIVITY_ENABLE = "inactivity_warnings"; + public static final String PREF_INACTIVITY_START = "inactivity_warnings_start"; + public static final String PREF_INACTIVITY_END = "inactivity_warnings_end"; + public static final String PREF_INACTIVITY_THRESHOLD = "inactivity_warnings_threshold"; + public static final String PREF_INACTIVITY_MO = "inactivity_warnings_mo"; + public static final String PREF_INACTIVITY_TU = "inactivity_warnings_tu"; + public static final String PREF_INACTIVITY_WE = "inactivity_warnings_we"; + public static final String PREF_INACTIVITY_TH = "inactivity_warnings_th"; + public static final String PREF_INACTIVITY_FR = "inactivity_warnings_fr"; + public static final String PREF_INACTIVITY_SA = "inactivity_warnings_sa"; + public static final String PREF_INACTIVITY_SU = "inactivity_warnings_su"; public static final String PREF_AUTOHEARTRATE_SWITCH = "pref_autoheartrate_switch"; public static final String PREF_AUTOHEARTRATE_SLEEP = "pref_autoheartrate_sleep"; @@ -73,9 +88,6 @@ public class DeviceSettingsPreferenceConst { public static final String PREF_POWER_MODE = "power_mode"; public static final String PREF_BUTTON_BP_CALIBRATE = "prefs_sensors_button_bp_calibration"; public static final String PREF_ALTITUDE_CALIBRATE = "pref_sensors_altitude"; - public static final String PREF_LONGSIT_PERIOD = "pref_longsit_period"; - public static final String PREF_LONGSIT_SWITCH = "pref_longsit_switch"; - public static final String PREF_LONGSIT_SWITCH_NOSHED = "screen_longsit_noshed"; 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"; 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 8c9ed2367..87444fc02 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 @@ -369,6 +369,17 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat imp addPreferenceHandlerFor(PREF_LONGSIT_SWITCH); addPreferenceHandlerFor(PREF_LONGSIT_START); addPreferenceHandlerFor(PREF_LONGSIT_END); + addPreferenceHandlerFor(PREF_INACTIVITY_ENABLE); + addPreferenceHandlerFor(PREF_INACTIVITY_START); + addPreferenceHandlerFor(PREF_INACTIVITY_END); + addPreferenceHandlerFor(PREF_INACTIVITY_THRESHOLD); + addPreferenceHandlerFor(PREF_INACTIVITY_MO); + addPreferenceHandlerFor(PREF_INACTIVITY_TU); + addPreferenceHandlerFor(PREF_INACTIVITY_WE); + addPreferenceHandlerFor(PREF_INACTIVITY_TH); + addPreferenceHandlerFor(PREF_INACTIVITY_FR); + addPreferenceHandlerFor(PREF_INACTIVITY_SA); + addPreferenceHandlerFor(PREF_INACTIVITY_SU); addPreferenceHandlerFor(PREF_AUTOHEARTRATE_SWITCH); addPreferenceHandlerFor(PREF_AUTOHEARTRATE_SLEEP); addPreferenceHandlerFor(PREF_AUTOHEARTRATE_INTERVAL); 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 e23eefaef..1e6ce070a 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,19 +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_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"; - public static final String PREF_INACTIVITY_END = "zetime_inactivity_warnings_end"; - public static final String PREF_INACTIVITY_THRESHOLD = "zetime_inactivity_warnings_threshold"; - public static final String PREF_INACTIVITY_MO = "zetime_prefs_inactivity_repetitions_mo"; - public static final String PREF_INACTIVITY_TU = "zetime_prefs_inactivity_repetitions_tu"; - public static final String PREF_INACTIVITY_WE = "zetime_prefs_inactivity_repetitions_we"; - public static final String PREF_INACTIVITY_TH = "zetime_prefs_inactivity_repetitions_th"; - public static final String PREF_INACTIVITY_FR = "zetime_prefs_inactivity_repetitions_fr"; - public static final String PREF_INACTIVITY_SA = "zetime_prefs_inactivity_repetitions_sa"; - public static final String PREF_INACTIVITY_SU = "zetime_prefs_inactivity_repetitions_su"; - public static final String PREF_ANALOG_MODE = "zetime_analog_mode"; public static final String PREF_ACTIVITY_TRACKING = "zetime_activity_tracking"; public static final String PREF_HANDMOVE_DISPLAY = "zetime_handmove_display"; 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 d466cb593..759709717 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 @@ -53,18 +53,6 @@ public class ZeTimePreferenceActivity extends AbstractSettingsActivity { addPreferenceHandlerFor(ZeTimeConstants.PREF_DATE_FORMAT); - addPreferenceHandlerFor(ZeTimeConstants.PREF_INACTIVITY_ENABLE); - addPreferenceHandlerFor(ZeTimeConstants.PREF_INACTIVITY_START); - addPreferenceHandlerFor(ZeTimeConstants.PREF_INACTIVITY_END); - addPreferenceHandlerFor(ZeTimeConstants.PREF_INACTIVITY_THRESHOLD); - addPreferenceHandlerFor(ZeTimeConstants.PREF_INACTIVITY_MO); - addPreferenceHandlerFor(ZeTimeConstants.PREF_INACTIVITY_TU); - addPreferenceHandlerFor(ZeTimeConstants.PREF_INACTIVITY_WE); - addPreferenceHandlerFor(ZeTimeConstants.PREF_INACTIVITY_TH); - addPreferenceHandlerFor(ZeTimeConstants.PREF_INACTIVITY_FR); - addPreferenceHandlerFor(ZeTimeConstants.PREF_INACTIVITY_SA); - addPreferenceHandlerFor(ZeTimeConstants.PREF_INACTIVITY_SU); - addPreferenceHandlerFor(ZeTimeConstants.PREF_SMS_SIGNALING); addPreferenceHandlerFor(ZeTimeConstants.PREF_ANTI_LOSS_SIGNALING); addPreferenceHandlerFor(ZeTimeConstants.PREF_CALENDAR_SIGNALING); 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 91102fdc5..e47cd416f 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 @@ -183,18 +183,18 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport { case ZeTimeConstants.PREF_DATE_FORMAT: setDateFormate(builder); break; - case ZeTimeConstants.PREF_INACTIVITY_KEY: - case ZeTimeConstants.PREF_INACTIVITY_ENABLE: - case ZeTimeConstants.PREF_INACTIVITY_START: - case ZeTimeConstants.PREF_INACTIVITY_END: - case ZeTimeConstants.PREF_INACTIVITY_THRESHOLD: - case ZeTimeConstants.PREF_INACTIVITY_MO: - case ZeTimeConstants.PREF_INACTIVITY_TU: - case ZeTimeConstants.PREF_INACTIVITY_WE: - case ZeTimeConstants.PREF_INACTIVITY_TH: - case ZeTimeConstants.PREF_INACTIVITY_FR: - case ZeTimeConstants.PREF_INACTIVITY_SA: - case ZeTimeConstants.PREF_INACTIVITY_SU: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_KEY: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_ENABLE: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_START: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_END: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_MO: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_TU: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_WE: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_TH: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_FR: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_SA: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_SU: setInactivityAlert(builder); break; case ZeTimeConstants.PREF_SMS_SIGNALING: @@ -1817,8 +1817,8 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport { private void setInactivityAlert(TransactionBuilder builder) { Prefs prefs = GBApplication.getPrefs(); - boolean enabled = prefs.getBoolean(ZeTimeConstants.PREF_INACTIVITY_ENABLE, false); - int threshold = prefs.getInt(ZeTimeConstants.PREF_INACTIVITY_THRESHOLD, 60); + boolean enabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_ENABLE, false); + int threshold = prefs.getInt(DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD, 60); if (threshold > 0xff) { threshold = 0xff; @@ -1843,21 +1843,21 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport { }; if (enabled) { - String start = prefs.getString(ZeTimeConstants.PREF_INACTIVITY_START, "06:00"); - String end = prefs.getString(ZeTimeConstants.PREF_INACTIVITY_END, "22:00"); + String start = prefs.getString(DeviceSettingsPreferenceConst.PREF_INACTIVITY_START, "06:00"); + String end = prefs.getString(DeviceSettingsPreferenceConst.PREF_INACTIVITY_END, "22:00"); DateFormat df_start = new SimpleDateFormat("HH:mm"); DateFormat df_end = new SimpleDateFormat("HH:mm"); Calendar calendar = GregorianCalendar.getInstance(); Calendar calendar_end = GregorianCalendar.getInstance(); int reps = (1 << 7); // set inactivity active: set bit 7 - reps |= (prefs.getBoolean(ZeTimeConstants.PREF_INACTIVITY_MO, false) ? 1 : 0); - reps |= ((prefs.getBoolean(ZeTimeConstants.PREF_INACTIVITY_TU, false) ? 1 : 0) << 1); - reps |= ((prefs.getBoolean(ZeTimeConstants.PREF_INACTIVITY_WE, false) ? 1 : 0) << 2); - reps |= ((prefs.getBoolean(ZeTimeConstants.PREF_INACTIVITY_TH, false) ? 1 : 0) << 3); - reps |= ((prefs.getBoolean(ZeTimeConstants.PREF_INACTIVITY_FR, false) ? 1 : 0) << 4); - reps |= ((prefs.getBoolean(ZeTimeConstants.PREF_INACTIVITY_SA, false) ? 1 : 0) << 5); - reps |= ((prefs.getBoolean(ZeTimeConstants.PREF_INACTIVITY_SU, false) ? 1 : 0) << 6); + reps |= (prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_MO, false) ? 1 : 0); + reps |= ((prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_TU, false) ? 1 : 0) << 1); + reps |= ((prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_WE, false) ? 1 : 0) << 2); + reps |= ((prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_TH, false) ? 1 : 0) << 3); + reps |= ((prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_FR, false) ? 1 : 0) << 4); + reps |= ((prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_SA, false) ? 1 : 0) << 5); + reps |= ((prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_SU, false) ? 1 : 0) << 6); inactivity[5] = (byte) reps; @@ -2147,45 +2147,45 @@ public class ZeTimeDeviceSupport extends AbstractBTLEDeviceSupport { String starttime = String.format("%02d:%02d", msg[7], msg[8]); String endtime = String.format("%02d:%02d", msg[9], msg[10]); - prefs.putString(ZeTimeConstants.PREF_INACTIVITY_THRESHOLD, Integer.toString(msg[6])); + prefs.putString(DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD, Integer.toString(msg[6])); if (0 != msg[5]) { - prefs.putBoolean(ZeTimeConstants.PREF_INACTIVITY_ENABLE, true); - prefs.putString(ZeTimeConstants.PREF_INACTIVITY_START, starttime); - prefs.putString(ZeTimeConstants.PREF_INACTIVITY_END, endtime); + prefs.putBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_ENABLE, true); + prefs.putString(DeviceSettingsPreferenceConst.PREF_INACTIVITY_START, starttime); + prefs.putString(DeviceSettingsPreferenceConst.PREF_INACTIVITY_END, endtime); if (0 != (msg[5] & (1 << 0))) { - prefs.putBoolean(ZeTimeConstants.PREF_INACTIVITY_MO, true); + prefs.putBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_MO, true); } else { - prefs.putBoolean(ZeTimeConstants.PREF_INACTIVITY_MO, false); + prefs.putBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_MO, false); } if (0 != (msg[5] & (1 << 1))) { - prefs.putBoolean(ZeTimeConstants.PREF_INACTIVITY_TU, true); + prefs.putBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_TU, true); } else { - prefs.putBoolean(ZeTimeConstants.PREF_INACTIVITY_TU, false); + prefs.putBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_TU, false); } if (0 != (msg[5] & (1 << 2))) { - prefs.putBoolean(ZeTimeConstants.PREF_INACTIVITY_WE, true); + prefs.putBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_WE, true); } else { - prefs.putBoolean(ZeTimeConstants.PREF_INACTIVITY_WE, false); + prefs.putBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_WE, false); } if (0 != (msg[5] & (1 << 3))) { - prefs.putBoolean(ZeTimeConstants.PREF_INACTIVITY_TH, true); + prefs.putBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_TH, true); } else { - prefs.putBoolean(ZeTimeConstants.PREF_INACTIVITY_TH, false); + prefs.putBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_TH, false); } if (0 != (msg[5] & (1 << 4))) { - prefs.putBoolean(ZeTimeConstants.PREF_INACTIVITY_FR, true); + prefs.putBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_FR, true); } else { - prefs.putBoolean(ZeTimeConstants.PREF_INACTIVITY_FR, false); + prefs.putBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_FR, false); } if (0 != (msg[5] & (1 << 5))) { - prefs.putBoolean(ZeTimeConstants.PREF_INACTIVITY_SA, true); + prefs.putBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_SA, true); } else { - prefs.putBoolean(ZeTimeConstants.PREF_INACTIVITY_SA, false); + prefs.putBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_SA, false); } if (0 != (msg[5] & (1 << 6))) { - prefs.putBoolean(ZeTimeConstants.PREF_INACTIVITY_SU, true); + prefs.putBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_SU, true); } else { - prefs.putBoolean(ZeTimeConstants.PREF_INACTIVITY_SU, false); + prefs.putBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_SU, false); } } prefs.apply(); diff --git a/app/src/main/res/xml/zetime_preferences.xml b/app/src/main/res/xml/zetime_preferences.xml index 263962f36..2431f13d9 100644 --- a/app/src/main/res/xml/zetime_preferences.xml +++ b/app/src/main/res/xml/zetime_preferences.xml @@ -52,7 +52,7 @@ android:title="@string/activity_prefs_activetime_minutes" /> @@ -64,60 +64,60 @@ + android:dependency="inactivity_warnings"> From 46f93bd2e4a2c31a424b02663852dbb892861ce2 Mon Sep 17 00:00:00 2001 From: Damien Gaignon Date: Mon, 7 Mar 2022 15:13:23 +0100 Subject: [PATCH 04/31] Move longsit constants to inactivity --- .../DeviceSettingsPreferenceConst.java | 8 ++------ .../DeviceSpecificSettingsFragment.java | 4 ---- .../lenovo/watchxplus/WatchXPlusConstants.java | 2 -- .../watchxplus/WatchXPlusDeviceCoordinator.java | 6 +++--- .../devices/fitpro/FitProDeviceSupport.java | 16 ++++++++-------- .../devices/lefun/LefunDeviceSupport.java | 14 +++++++------- .../watchxplus/WatchXPlusDeviceSupport.java | 6 +++--- .../service/devices/tlw64/TLW64Support.java | 2 +- app/src/main/res/xml/devicesettings_longsit.xml | 10 +++++----- .../res/xml/devicesettings_longsit_extended.xml | 12 ++++++------ .../res/xml/devicesettings_longsit_noshed.xml | 2 +- app/src/main/res/xml/zetime_preferences.xml | 10 +++++----- 12 files changed, 41 insertions(+), 51 deletions(-) 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 9282e89b3..9c2343a47 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 @@ -61,13 +61,9 @@ public class DeviceSettingsPreferenceConst { public static final String PREF_LIFTWRIST_NOSHED = "activate_display_on_lift_wrist_noshed"; public static final String PREF_DISCONNECTNOTIF_NOSHED = "disconnect_notification_noshed"; - 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_LONGSIT_PERIOD = "pref_longsit_period"; - public static final String PREF_LONGSIT_SWITCH = "pref_longsit_switch"; - public static final String PREF_LONGSIT_SWITCH_NOSHED = "screen_longsit_noshed"; public static final String PREF_INACTIVITY_KEY = "inactivity_warnings_key"; - public static final String PREF_INACTIVITY_ENABLE = "inactivity_warnings"; + public static final String PREF_INACTIVITY_ENABLE = "inactivity_warnings_enable"; + public static final String PREF_INACTIVITY_ENABLE_NOSHED = "inactivity_warnings_enable_noshed"; public static final String PREF_INACTIVITY_START = "inactivity_warnings_start"; public static final String PREF_INACTIVITY_END = "inactivity_warnings_end"; public static final String PREF_INACTIVITY_THRESHOLD = "inactivity_warnings_threshold"; 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 87444fc02..796f89ebc 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 @@ -365,10 +365,6 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat imp addPreferenceHandlerFor(PREF_DISCONNECTNOTIF_NOSHED); addPreferenceHandlerFor(PREF_BUTTON_BP_CALIBRATE); addPreferenceHandlerFor(PREF_ALTITUDE_CALIBRATE); - addPreferenceHandlerFor(PREF_LONGSIT_PERIOD); - addPreferenceHandlerFor(PREF_LONGSIT_SWITCH); - addPreferenceHandlerFor(PREF_LONGSIT_START); - addPreferenceHandlerFor(PREF_LONGSIT_END); addPreferenceHandlerFor(PREF_INACTIVITY_ENABLE); addPreferenceHandlerFor(PREF_INACTIVITY_START); addPreferenceHandlerFor(PREF_INACTIVITY_END); 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 21d16c85a..b2404c2e1 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,8 +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_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"; // moved to gear icon (per device settings) public static final String PREF_LANGUAGE = "language"; 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 013cfc9c2..7611d2f94 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 @@ -272,14 +272,14 @@ public class WatchXPlusDeviceCoordinator extends AbstractDeviceCoordinator { */ public static boolean getLongSitHours(String deviceAddress, Calendar startOut, Calendar endOut) { SharedPreferences prefs = GBApplication.getDeviceSpecificSharedPrefs(deviceAddress); - boolean enabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_LONGSIT_SWITCH, false); + boolean enabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_ENABLE, false); if (!enabled) { LOG.info(" Long sit reminder is disabled "); return false; } else { - String start = prefs.getString(WatchXPlusConstants.PREF_LONGSIT_START, "06:00"); - String end = prefs.getString(WatchXPlusConstants.PREF_LONGSIT_END, "23:00"); + String start = prefs.getString(DeviceSettingsPreferenceConst.PREF_INACTIVITY_START, "06:00"); + String end = prefs.getString(DeviceSettingsPreferenceConst.PREF_INACTIVITY_END, "23:00"); DateFormat df = new SimpleDateFormat("HH:mm"); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/fitpro/FitProDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/fitpro/FitProDeviceSupport.java index 0714a14f3..63596edfa 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/fitpro/FitProDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/fitpro/FitProDeviceSupport.java @@ -543,10 +543,10 @@ public class FitProDeviceSupport extends AbstractBTLEDeviceSupport { case DeviceSettingsPreferenceConst.PREF_LANGUAGE: setLanguage(builder); break; - case DeviceSettingsPreferenceConst.PREF_LONGSIT_PERIOD: - case DeviceSettingsPreferenceConst.PREF_LONGSIT_SWITCH: - case DeviceSettingsPreferenceConst.PREF_LONGSIT_START: - case DeviceSettingsPreferenceConst.PREF_LONGSIT_END: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_ENABLE: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_START: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_END: setLongSitReminder(builder); break; case DeviceSettingsPreferenceConst.PREF_ACTIVATE_DISPLAY_ON_LIFT: @@ -1143,14 +1143,14 @@ public class FitProDeviceSupport extends AbstractBTLEDeviceSupport { public FitProDeviceSupport setLongSitReminder(TransactionBuilder builder) { LOG.debug("FitPro set inactivity warning"); - boolean prefLongsitSwitch = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getBoolean("pref_longsit_switch", false); + boolean prefLongsitSwitch = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_ENABLE, false); LOG.info("Setting long sit warning to " + prefLongsitSwitch); if (prefLongsitSwitch) { - String inactivity = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString("pref_longsit_period", "4"); - String start = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString("pref_longsit_start", "08:00"); - String end = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString("pref_longsit_end", "16:00"); + String inactivity = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString(DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD, "4"); + String start = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString(DeviceSettingsPreferenceConst.PREF_INACTIVITY_START, "08:00"); + String end = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString(DeviceSettingsPreferenceConst.PREF_INACTIVITY_END, "16:00"); Calendar startCalendar = GregorianCalendar.getInstance(); Calendar endCalendar = GregorianCalendar.getInstance(); DateFormat df = new SimpleDateFormat("HH:mm"); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lefun/LefunDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lefun/LefunDeviceSupport.java index d96d38898..c15c31584 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lefun/LefunDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lefun/LefunDeviceSupport.java @@ -405,15 +405,15 @@ public class LefunDeviceSupport extends AbstractBTLEDeviceSupport { sendEnabledFeaturesSetting(features); break; } - case DeviceSettingsPreferenceConst.PREF_LONGSIT_SWITCH: { - boolean enabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_LONGSIT_SWITCH, false); + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_ENABLE: { + boolean enabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_ENABLE, false); FeaturesCommand features = getCurrentEnabledFeatures(); features.setFeature(FeaturesCommand.FEATURE_SEDENTARY_REMINDER, enabled); sendEnabledFeaturesSetting(features); break; } - case DeviceSettingsPreferenceConst.PREF_LONGSIT_PERIOD: { - String periodStr = prefs.getString(DeviceSettingsPreferenceConst.PREF_LONGSIT_PERIOD, "60"); + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD: { + String periodStr = prefs.getString(DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD, "60"); try { int period = Integer.parseInt(periodStr); sendSedentaryReminderIntervalSetting(period); @@ -523,7 +523,7 @@ public class LefunDeviceSupport extends AbstractBTLEDeviceSupport { SharedPreferences prefs = GBApplication.getDeviceSpecificSharedPrefs(getDevice().getAddress()); boolean raiseToWakeEnabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_LIFTWRIST_NOSHED, true); boolean antilostEnabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_ANTILOST_ENABLED, true); - boolean sedentaryEnabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_LONGSIT_SWITCH, false); + boolean sedentaryEnabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_ENABLE, false); boolean hydrationEnabled = prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_HYDRATION_SWITCH, false); FeaturesCommand cmd = new FeaturesCommand(); @@ -693,7 +693,7 @@ public class LefunDeviceSupport extends AbstractBTLEDeviceSupport { prefs.edit() .putBoolean(DeviceSettingsPreferenceConst.PREF_LIFTWRIST_NOSHED, cmd.getFeature(FeaturesCommand.FEATURE_RAISE_TO_WAKE)) - .putBoolean(DeviceSettingsPreferenceConst.PREF_LONGSIT_SWITCH, + .putBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_ENABLE, cmd.getFeature(FeaturesCommand.FEATURE_SEDENTARY_REMINDER)) .putBoolean(DeviceSettingsPreferenceConst.PREF_HYDRATION_SWITCH, cmd.getFeature(FeaturesCommand.FEATURE_HYDRATION_REMINDER)) @@ -710,7 +710,7 @@ public class LefunDeviceSupport extends AbstractBTLEDeviceSupport { public void receiveSedentaryReminderIntervalSetting(int period) { SharedPreferences prefs = GBApplication.getDeviceSpecificSharedPrefs(getDevice().getAddress()); prefs.edit() - .putString(DeviceSettingsPreferenceConst.PREF_LONGSIT_PERIOD, String.valueOf(period)) + .putString(DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD, String.valueOf(period)) .apply(); } 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 defb7dc67..7eed0f97d 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 @@ -964,8 +964,8 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport { setLanguageAndTimeFormat(builder); break; - case DeviceSettingsPreferenceConst.PREF_LONGSIT_PERIOD: - case DeviceSettingsPreferenceConst.PREF_LONGSIT_SWITCH: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD: + case DeviceSettingsPreferenceConst.PREF_INACTIVITY_ENABLE: setLongSitHours(builder); break; // calibrations @@ -1049,7 +1049,7 @@ public class WatchXPlusDeviceSupport extends AbstractBTLEDeviceSupport { Calendar end = new GregorianCalendar(); boolean enable = WatchXPlusDeviceCoordinator.getLongSitHours(gbDevice.getAddress(), start, end); if (enable) { - String periodString = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString(DeviceSettingsPreferenceConst.PREF_LONGSIT_PERIOD, "60"); + String periodString = GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getString(DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD, "60"); int period = Integer.parseInt(periodString); this.setLongSitHours(builder, enable, diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/tlw64/TLW64Support.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/tlw64/TLW64Support.java index 07ba3f065..811eb4628 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/tlw64/TLW64Support.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/tlw64/TLW64Support.java @@ -548,7 +548,7 @@ public class TLW64Support extends AbstractBTLEDeviceSupport { (byte) 0x00 // unknown, sniffed by original app }; - if (GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getBoolean(DeviceSettingsPreferenceConst.PREF_LONGSIT_SWITCH_NOSHED, false)) { + if (GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_ENABLE_NOSHED, false)) { deviceBytes[1] = (byte) 0x01; } diff --git a/app/src/main/res/xml/devicesettings_longsit.xml b/app/src/main/res/xml/devicesettings_longsit.xml index 00c588f66..b25408ee2 100644 --- a/app/src/main/res/xml/devicesettings_longsit.xml +++ b/app/src/main/res/xml/devicesettings_longsit.xml @@ -2,7 +2,7 @@ @@ -12,21 +12,21 @@ diff --git a/app/src/main/res/xml/devicesettings_longsit_extended.xml b/app/src/main/res/xml/devicesettings_longsit_extended.xml index a09b7485e..966b758ec 100644 --- a/app/src/main/res/xml/devicesettings_longsit_extended.xml +++ b/app/src/main/res/xml/devicesettings_longsit_extended.xml @@ -2,7 +2,7 @@ @@ -12,26 +12,26 @@ diff --git a/app/src/main/res/xml/devicesettings_longsit_noshed.xml b/app/src/main/res/xml/devicesettings_longsit_noshed.xml index ef1471212..d10fb0d53 100644 --- a/app/src/main/res/xml/devicesettings_longsit_noshed.xml +++ b/app/src/main/res/xml/devicesettings_longsit_noshed.xml @@ -3,7 +3,7 @@ diff --git a/app/src/main/res/xml/zetime_preferences.xml b/app/src/main/res/xml/zetime_preferences.xml index 2431f13d9..43961786b 100644 --- a/app/src/main/res/xml/zetime_preferences.xml +++ b/app/src/main/res/xml/zetime_preferences.xml @@ -64,13 +64,13 @@ + android:dependency="inactivity_warnings_enable"> Date: Mon, 7 Mar 2022 15:22:17 +0100 Subject: [PATCH 05/31] Move longsit files to inactivity --- .../gadgetbridge/devices/fitpro/FitProDeviceCoordinator.java | 2 +- .../gadgetbridge/devices/lefun/LefunDeviceCoordinator.java | 2 +- .../devices/lenovo/watchxplus/WatchXPlusDeviceCoordinator.java | 2 +- .../gadgetbridge/devices/tlw64/TLW64Coordinator.java | 2 +- ...devicesettings_longsit.xml => devicesettings_inactivity.xml} | 0 ...gsit_extended.xml => devicesettings_inactivity_extended.xml} | 0 ..._longsit_noshed.xml => devicesettings_inactivity_noshed.xml} | 0 7 files changed, 4 insertions(+), 4 deletions(-) rename app/src/main/res/xml/{devicesettings_longsit.xml => devicesettings_inactivity.xml} (100%) rename app/src/main/res/xml/{devicesettings_longsit_extended.xml => devicesettings_inactivity_extended.xml} (100%) rename app/src/main/res/xml/{devicesettings_longsit_noshed.xml => devicesettings_inactivity_noshed.xml} (100%) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/fitpro/FitProDeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/fitpro/FitProDeviceCoordinator.java index 3f9a0911a..29bbdc73b 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/fitpro/FitProDeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/fitpro/FitProDeviceCoordinator.java @@ -174,7 +174,7 @@ public class FitProDeviceCoordinator extends AbstractDeviceCoordinator { public int[] getSupportedDeviceSpecificSettings(GBDevice device) { return new int[]{ R.xml.devicesettings_liftwrist_display_no_on, - R.xml.devicesettings_longsit_extended, + R.xml.devicesettings_inactivity_extended, R.xml.devicesettings_donotdisturb_no_auto, R.xml.devicesettings_sleep_time, R.xml.devicesettings_wearlocation, diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lefun/LefunDeviceCoordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lefun/LefunDeviceCoordinator.java index 2aa95a08c..d0c041ce0 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lefun/LefunDeviceCoordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/lefun/LefunDeviceCoordinator.java @@ -164,7 +164,7 @@ public class LefunDeviceCoordinator extends AbstractDeviceCoordinator { R.xml.devicesettings_liftwrist_display_noshed, R.xml.devicesettings_timeformat, R.xml.devicesettings_antilost, - R.xml.devicesettings_longsit, + R.xml.devicesettings_inactivity, R.xml.devicesettings_hydration_reminder, R.xml.devicesettings_lefun_interface_language, R.xml.devicesettings_transliteration 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 7611d2f94..8a90e82a2 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 @@ -192,7 +192,7 @@ public class WatchXPlusDeviceCoordinator extends AbstractDeviceCoordinator { R.xml.devicesettings_liftwrist_display_noshed, R.xml.devicesettings_disconnectnotification_noshed, R.xml.devicesettings_donotdisturb_no_auto, - R.xml.devicesettings_longsit, + R.xml.devicesettings_inactivity, R.xml.devicesettings_find_phone, R.xml.devicesettings_timeformat, R.xml.devicesettings_power_mode, diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/tlw64/TLW64Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/tlw64/TLW64Coordinator.java index dced711aa..b72ea0164 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/tlw64/TLW64Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/tlw64/TLW64Coordinator.java @@ -144,7 +144,7 @@ public class TLW64Coordinator extends AbstractDeviceCoordinator { public int[] getSupportedDeviceSpecificSettings(GBDevice device) { return new int[]{ R.xml.devicesettings_liftwrist_display_noshed, - R.xml.devicesettings_longsit_noshed, + R.xml.devicesettings_inactivity_noshed, R.xml.devicesettings_timeformat, R.xml.devicesettings_transliteration }; diff --git a/app/src/main/res/xml/devicesettings_longsit.xml b/app/src/main/res/xml/devicesettings_inactivity.xml similarity index 100% rename from app/src/main/res/xml/devicesettings_longsit.xml rename to app/src/main/res/xml/devicesettings_inactivity.xml diff --git a/app/src/main/res/xml/devicesettings_longsit_extended.xml b/app/src/main/res/xml/devicesettings_inactivity_extended.xml similarity index 100% rename from app/src/main/res/xml/devicesettings_longsit_extended.xml rename to app/src/main/res/xml/devicesettings_inactivity_extended.xml diff --git a/app/src/main/res/xml/devicesettings_longsit_noshed.xml b/app/src/main/res/xml/devicesettings_inactivity_noshed.xml similarity index 100% rename from app/src/main/res/xml/devicesettings_longsit_noshed.xml rename to app/src/main/res/xml/devicesettings_inactivity_noshed.xml From fd69b1a3ea9ee4454e5efd2f1ad5efb4312266fb Mon Sep 17 00:00:00 2001 From: Damien Gaignon Date: Mon, 7 Mar 2022 15:51:54 +0100 Subject: [PATCH 06/31] Move mi2_inactivity constants to inactivity --- .../DeviceSettingsPreferenceConst.java | 3 ++ .../DeviceSpecificSettingsFragment.java | 3 ++ .../devices/huami/HuamiCoordinator.java | 14 +++--- .../devices/miband/MiBandConst.java | 7 --- .../miband/MiBandPreferencesActivity.java | 44 +++++++++---------- .../service/devices/huami/HuamiSupport.java | 21 ++++++--- app/src/main/res/xml/miband_preferences.xml | 28 ++++++------ 7 files changed, 63 insertions(+), 57 deletions(-) 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 9c2343a47..592b77576 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 @@ -74,6 +74,9 @@ public class DeviceSettingsPreferenceConst { public static final String PREF_INACTIVITY_FR = "inactivity_warnings_fr"; public static final String PREF_INACTIVITY_SA = "inactivity_warnings_sa"; public static final String PREF_INACTIVITY_SU = "inactivity_warnings_su"; + 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_AUTOHEARTRATE_SWITCH = "pref_autoheartrate_switch"; public static final String PREF_AUTOHEARTRATE_SLEEP = "pref_autoheartrate_sleep"; 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 796f89ebc..85d64036e 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 @@ -376,6 +376,9 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat imp addPreferenceHandlerFor(PREF_INACTIVITY_FR); addPreferenceHandlerFor(PREF_INACTIVITY_SA); addPreferenceHandlerFor(PREF_INACTIVITY_SU); + addPreferenceHandlerFor(PREF_INACTIVITY_DND); + addPreferenceHandlerFor(PREF_INACTIVITY_DND_START); + addPreferenceHandlerFor(PREF_INACTIVITY_DND_END); addPreferenceHandlerFor(PREF_AUTOHEARTRATE_SWITCH); addPreferenceHandlerFor(PREF_AUTOHEARTRATE_SLEEP); addPreferenceHandlerFor(PREF_AUTOHEARTRATE_INTERVAL); 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 dc7f0dd8d..5c143ba67 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 @@ -209,33 +209,33 @@ public abstract class HuamiCoordinator extends AbstractDeviceCoordinator { public static boolean getInactivityWarnings() { Prefs prefs = GBApplication.getPrefs(); - return prefs.getBoolean(MiBandConst.PREF_MI2_INACTIVITY_WARNINGS, false); + return prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_ENABLE, false); } public static int getInactivityWarningsThreshold() { Prefs prefs = GBApplication.getPrefs(); - return prefs.getInt(MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_THRESHOLD, 60); + return prefs.getInt(DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD, 60); } public static boolean getInactivityWarningsDnd() { Prefs prefs = GBApplication.getPrefs(); - return prefs.getBoolean(MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_DND, false); + return prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_INACTIVITY_DND, false); } public static Date getInactivityWarningsStart() { - return getTimePreference(MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_START, "06:00"); + return getTimePreference(DeviceSettingsPreferenceConst.PREF_INACTIVITY_START, "06:00"); } public static Date getInactivityWarningsEnd() { - return getTimePreference(MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_END, "22:00"); + return getTimePreference(DeviceSettingsPreferenceConst.PREF_INACTIVITY_END, "22:00"); } public static Date getInactivityWarningsDndStart() { - return getTimePreference(MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_DND_START, "12:00"); + return getTimePreference(DeviceSettingsPreferenceConst.PREF_INACTIVITY_DND_START, "12:00"); } public static Date getInactivityWarningsDndEnd() { - return getTimePreference(MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_DND_END, "14:00"); + return getTimePreference(DeviceSettingsPreferenceConst.PREF_INACTIVITY_DND_END, "14:00"); } public static Date getDoNotDisturbStart(String deviceAddress) { 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 e6e79ef1d..83cadd3a2 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_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"; - public static final String PREF_MI2_INACTIVITY_WARNINGS_END = "mi2_inactivity_warnings_end"; - public static final String PREF_MI2_INACTIVITY_WARNINGS_DND = "mi2_inactivity_warnings_dnd"; - public static final String PREF_MI2_INACTIVITY_WARNINGS_DND_START = "mi2_inactivity_warnings_dnd_start"; - public static final String PREF_MI2_INACTIVITY_WARNINGS_DND_END = "mi2_inactivity_warnings_dnd_end"; public static final String PREF_MIBAND_SETUP_BT_PAIRING = "mi_setup_bt_pairing"; public static final String PREF_SWIPE_UNLOCK = "swipe_unlock"; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandPreferencesActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandPreferencesActivity.java index 8ccdc77f8..882cb0316 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandPreferencesActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/MiBandPreferencesActivity.java @@ -37,16 +37,16 @@ import nodomain.freeyourgadget.gadgetbridge.model.NotificationType; import nodomain.freeyourgadget.gadgetbridge.util.GB; import nodomain.freeyourgadget.gadgetbridge.util.Prefs; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_INACTIVITY_ENABLE; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_INACTIVITY_START; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_INACTIVITY_END; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_INACTIVITY_DND; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_INACTIVITY_DND_START; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_INACTIVITY_DND_END; import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.ORIGIN_ALARM_CLOCK; import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.ORIGIN_INCOMING_CALL; import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MI2_GOAL_NOTIFICATION; -import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MI2_INACTIVITY_WARNINGS; -import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_DND; -import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_DND_END; -import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_DND_START; -import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_END; -import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_START; -import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_THRESHOLD; import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MIBAND_ADDRESS; import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_MIBAND_USE_HR_FOR_SLEEP_DETECTION; import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.VIBRATION_COUNT; @@ -97,98 +97,98 @@ public class MiBandPreferencesActivity extends AbstractSettingsActivity { }); - final Preference inactivityWarnings = findPreference(PREF_MI2_INACTIVITY_WARNINGS); + final Preference inactivityWarnings = findPreference(PREF_INACTIVITY_ENABLE); inactivityWarnings.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newVal) { invokeLater(new Runnable() { @Override public void run() { - GBApplication.deviceService().onSendConfiguration(PREF_MI2_INACTIVITY_WARNINGS); + GBApplication.deviceService().onSendConfiguration(PREF_INACTIVITY_ENABLE); } }); return true; } }); - final Preference inactivityWarningsThreshold = findPreference(PREF_MI2_INACTIVITY_WARNINGS_THRESHOLD); + final Preference inactivityWarningsThreshold = findPreference(PREF_INACTIVITY_THRESHOLD); inactivityWarningsThreshold.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newVal) { invokeLater(new Runnable() { @Override public void run() { - GBApplication.deviceService().onSendConfiguration(PREF_MI2_INACTIVITY_WARNINGS_THRESHOLD); + GBApplication.deviceService().onSendConfiguration(PREF_INACTIVITY_THRESHOLD); } }); return true; } }); - final Preference inactivityWarningsStart = findPreference(PREF_MI2_INACTIVITY_WARNINGS_START); + final Preference inactivityWarningsStart = findPreference(PREF_INACTIVITY_START); inactivityWarningsStart.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newVal) { invokeLater(new Runnable() { @Override public void run() { - GBApplication.deviceService().onSendConfiguration(PREF_MI2_INACTIVITY_WARNINGS_START); + GBApplication.deviceService().onSendConfiguration(PREF_INACTIVITY_START); } }); return true; } }); - final Preference inactivityWarningsEnd = findPreference(PREF_MI2_INACTIVITY_WARNINGS_END); + final Preference inactivityWarningsEnd = findPreference(PREF_INACTIVITY_END); inactivityWarningsEnd.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newVal) { invokeLater(new Runnable() { @Override public void run() { - GBApplication.deviceService().onSendConfiguration(PREF_MI2_INACTIVITY_WARNINGS_END); + GBApplication.deviceService().onSendConfiguration(PREF_INACTIVITY_END); } }); return true; } }); - final Preference inactivityWarningsDnd = findPreference(PREF_MI2_INACTIVITY_WARNINGS_DND); + final Preference inactivityWarningsDnd = findPreference(PREF_INACTIVITY_DND); inactivityWarningsDnd.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newVal) { invokeLater(new Runnable() { @Override public void run() { - GBApplication.deviceService().onSendConfiguration(PREF_MI2_INACTIVITY_WARNINGS_DND); + GBApplication.deviceService().onSendConfiguration(PREF_INACTIVITY_DND); } }); return true; } }); - final Preference inactivityWarningsDndStart = findPreference(PREF_MI2_INACTIVITY_WARNINGS_DND_START); + final Preference inactivityWarningsDndStart = findPreference(PREF_INACTIVITY_DND_START); inactivityWarningsDndStart.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newVal) { invokeLater(new Runnable() { @Override public void run() { - GBApplication.deviceService().onSendConfiguration(PREF_MI2_INACTIVITY_WARNINGS_DND_START); + GBApplication.deviceService().onSendConfiguration(PREF_INACTIVITY_DND_START); } }); return true; } }); - final Preference inactivityWarningsDndEnd = findPreference(PREF_MI2_INACTIVITY_WARNINGS_DND_END); + final Preference inactivityWarningsDndEnd = findPreference(PREF_INACTIVITY_DND_END); inactivityWarningsDndEnd.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newVal) { invokeLater(new Runnable() { @Override public void run() { - GBApplication.deviceService().onSendConfiguration(PREF_MI2_INACTIVITY_WARNINGS_DND_END); + GBApplication.deviceService().onSendConfiguration(PREF_INACTIVITY_DND_END); } }); return true; @@ -264,7 +264,7 @@ public class MiBandPreferencesActivity extends AbstractSettingsActivity { prefKeys.add(PREF_USER_NAME); prefKeys.add(PREF_MIBAND_ADDRESS); prefKeys.add(ActivityUser.PREF_USER_STEPS_GOAL); - prefKeys.add(PREF_MI2_INACTIVITY_WARNINGS_THRESHOLD); + prefKeys.add(PREF_INACTIVITY_THRESHOLD); prefKeys.add(getNotificationPrefKey(VIBRATION_COUNT, ORIGIN_ALARM_CLOCK)); prefKeys.add(getNotificationPrefKey(VIBRATION_COUNT, ORIGIN_INCOMING_CALL)); 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 2f3cb0ea3..d70e57526 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 @@ -154,6 +154,13 @@ import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.Dev 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_INACTIVITY_ENABLE; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_INACTIVITY_START; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_INACTIVITY_END; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_INACTIVITY_THRESHOLD; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_INACTIVITY_DND; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_INACTIVITY_DND_START; +import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_INACTIVITY_DND_END; 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; @@ -2242,13 +2249,13 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport { case PREF_DO_NOT_DISTURB_LIFT_WRIST: setDoNotDisturb(builder); break; - case MiBandConst.PREF_MI2_INACTIVITY_WARNINGS: - case MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_THRESHOLD: - case MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_START: - case MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_END: - case MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_DND: - case MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_DND_START: - case MiBandConst.PREF_MI2_INACTIVITY_WARNINGS_DND_END: + case PREF_INACTIVITY_ENABLE: + case PREF_INACTIVITY_THRESHOLD: + case PREF_INACTIVITY_START: + case PREF_INACTIVITY_END: + case PREF_INACTIVITY_DND: + case PREF_INACTIVITY_DND_START: + case PREF_INACTIVITY_DND_END: setInactivityWarnings(builder); break; case SettingsActivity.PREF_MEASUREMENT_SYSTEM: diff --git a/app/src/main/res/xml/miband_preferences.xml b/app/src/main/res/xml/miband_preferences.xml index 2ef12c9c4..ca1ba6553 100644 --- a/app/src/main/res/xml/miband_preferences.xml +++ b/app/src/main/res/xml/miband_preferences.xml @@ -36,7 +36,7 @@ android:title="@string/prefs_title_heartrate_measurement_interval" /> @@ -48,47 +48,47 @@ From 619780977c3b8136fafbaa2f7789c0fcf39e1c72 Mon Sep 17 00:00:00 2001 From: Damien Gaignon Date: Mon, 7 Mar 2022 17:11:47 +0100 Subject: [PATCH 07/31] Move lefun_language constant to generic --- .../devicesettings/DeviceSettingsPreferenceConst.java | 1 - .../devicesettings/DeviceSpecificSettingsFragment.java | 1 - .../service/devices/lefun/LefunDeviceSupport.java | 4 ++-- .../main/res/xml/devicesettings_lefun_interface_language.xml | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) 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 592b77576..1a636b742 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 @@ -110,7 +110,6 @@ public class DeviceSettingsPreferenceConst { public static final String PREF_HYDRATION_SWITCH = "pref_hydration_switch"; public static final String PREF_HYDRATION_PERIOD = "pref_hydration_period"; public static final String PREF_AMPM_ENABLED = "pref_ampm_enabled"; - public static final String PREF_LEFUN_INTERFACE_LANGUAGE = "pref_lefun_interface_language"; public static final String PREF_SONYSWR12_LOW_VIBRATION = "vibration_preference"; public static final String PREF_SONYSWR12_STAMINA = "stamina_preference"; 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 85d64036e..1db2442d1 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 @@ -402,7 +402,6 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat imp addPreferenceHandlerFor(PREF_HYDRATION_SWITCH); addPreferenceHandlerFor(PREF_HYDRATION_PERIOD); addPreferenceHandlerFor(PREF_AMPM_ENABLED); - addPreferenceHandlerFor(PREF_LEFUN_INTERFACE_LANGUAGE); addPreferenceHandlerFor(PREF_SOUNDS); addPreferenceHandlerFor(PREF_HYBRID_HR_DRAW_WIDGET_CIRCLES); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lefun/LefunDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lefun/LefunDeviceSupport.java index c15c31584..74e84f36f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lefun/LefunDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/lefun/LefunDeviceSupport.java @@ -445,8 +445,8 @@ public class LefunDeviceSupport extends AbstractBTLEDeviceSupport { sendUnitsSetting(null); break; } - case DeviceSettingsPreferenceConst.PREF_LEFUN_INTERFACE_LANGUAGE: { - String value = prefs.getString(DeviceSettingsPreferenceConst.PREF_LEFUN_INTERFACE_LANGUAGE, "0"); + case DeviceSettingsPreferenceConst.PREF_LANGUAGE: { + String value = prefs.getString(DeviceSettingsPreferenceConst.PREF_LANGUAGE, "0"); int intValue = Integer.parseInt(value); sendLanguageSetting((byte) intValue); break; diff --git a/app/src/main/res/xml/devicesettings_lefun_interface_language.xml b/app/src/main/res/xml/devicesettings_lefun_interface_language.xml index b6dab3ceb..6c821baba 100644 --- a/app/src/main/res/xml/devicesettings_lefun_interface_language.xml +++ b/app/src/main/res/xml/devicesettings_lefun_interface_language.xml @@ -5,7 +5,7 @@ android:entries="@array/lefun_interface_language_names" android:entryValues="@array/lefun_interface_language_values" android:icon="@drawable/ic_language" - android:key="pref_lefun_interface_language" + android:key="language" android:summary="%s" android:title="@string/lefun_prefs_interface_language_title" /> From 02e790dd009c67f72e61e4a1a82f38d6babf1c09 Mon Sep 17 00:00:00 2001 From: Damien Gaignon Date: Mon, 7 Mar 2022 17:42:46 +0100 Subject: [PATCH 08/31] Remove redundant constants --- .../devicesettings/DeviceSettingsPreferenceConst.java | 3 ++- .../DeviceSpecificSettingsFragment.java | 8 +++----- .../gadgetbridge/devices/huami/HuamiConst.java | 4 ---- .../gadgetbridge/devices/huami/HuamiCoordinator.java | 6 +++--- .../lenovo/watchxplus/WatchXPlusConstants.java | 6 ------ .../watchxplus/WatchXPlusDeviceCoordinator.java | 4 ++-- .../devices/makibeshr3/MakibesHR3Constants.java | 3 --- .../devices/makibeshr3/MakibesHR3Coordinator.java | 6 +++--- .../devices/casio/CasioGBX100DeviceSupport.java | 11 ++++++----- .../service/devices/huami/HuamiSupport.java | 9 ++++++--- .../lenovo/watchxplus/WatchXPlusDeviceSupport.java | 4 ++-- .../devices/makibeshr3/MakibesHR3DeviceSupport.java | 6 +++--- 12 files changed, 30 insertions(+), 40 deletions(-) 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 1a636b742..53f2db5f6 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 @@ -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"; 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 1db2442d1..67b7ce277 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 @@ -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); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiConst.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiConst.java index d9cdc70b0..fee711abd 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiConst.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiConst.java @@ -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"; 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 5c143ba67..09032ff11 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 @@ -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) { 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 b2404c2e1..a05b8e7e0 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 @@ -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; 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 8a90e82a2..51695475c 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 @@ -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; 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 06ed8594c..42a55f979 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 @@ -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"); 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 38af7b9a6..0505ddfa6 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 @@ -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; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casio/CasioGBX100DeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casio/CasioGBX100DeviceSupport.java index 8ee737e4c..7331bd3b1 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casio/CasioGBX100DeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/casio/CasioGBX100DeviceSupport.java @@ -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: 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 d70e57526..ff4e00c38 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 @@ -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: 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 7eed0f97d..ca0bf28fd 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 @@ -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 { 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 63cee958a..a649275be 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 @@ -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; From 48890d1d3453d057483d215466393ccbe3b9c3ab Mon Sep 17 00:00:00 2001 From: Damien Gaignon Date: Mon, 7 Mar 2022 17:52:50 +0100 Subject: [PATCH 09/31] Move disconnect_notification constant to generic --- .../devicesettings/DeviceSettingsPreferenceConst.java | 4 ++++ .../devicesettings/DeviceSpecificSettingsFragment.java | 3 --- .../gadgetbridge/devices/huami/HuamiConst.java | 4 ---- .../gadgetbridge/devices/huami/HuamiCoordinator.java | 6 +++--- .../devices/makibeshr3/MakibesHR3Constants.java | 4 ---- .../devices/makibeshr3/MakibesHR3Coordinator.java | 2 +- .../gadgetbridge/service/devices/huami/HuamiSupport.java | 9 ++++++--- .../devices/makibeshr3/MakibesHR3DeviceSupport.java | 2 +- 8 files changed, 15 insertions(+), 19 deletions(-) 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 53f2db5f6..2903eb033 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 @@ -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"; 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 67b7ce277..373e03aee 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 @@ -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; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiConst.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiConst.java index fee711abd..f03b5c21e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiConst.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/huami/HuamiConst.java @@ -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"; 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 09032ff11..c7e63a266 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 @@ -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) { 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 42a55f979..de2838238 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 @@ -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"); 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 0505ddfa6..e555f08de 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 @@ -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)); 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 ff4e00c38..3992990d9 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 @@ -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: 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 a649275be..1edfd46b9 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 @@ -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) || From 41b28476914b0bd84389698ba03c35ef27270c04 Mon Sep 17 00:00:00 2001 From: Damien Gaignon Date: Thu, 10 Mar 2022 00:06:41 +0100 Subject: [PATCH 10/31] Finalize constants move --- .../gadgetbridge/GBApplication.java | 97 ++++++++++++++++++- 1 file changed, 96 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java index 2425b7ec7..6282ebcac 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java @@ -85,11 +85,15 @@ import nodomain.freeyourgadget.gadgetbridge.util.Prefs; import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.AMAZFITBIP; import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.AMAZFITCOR; import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.AMAZFITCOR2; +import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.FITPRO; import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.GALAXY_BUDS; +import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.LEFUN; import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.MIBAND; import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.MIBAND2; import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.MIBAND3; import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.PEBBLE; +import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.TLW64; +import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.WATCHXPLUS; import static nodomain.freeyourgadget.gadgetbridge.model.DeviceType.fromKey; import static nodomain.freeyourgadget.gadgetbridge.util.GB.NOTIFICATION_CHANNEL_HIGH_PRIORITY_ID; import static nodomain.freeyourgadget.gadgetbridge.util.GB.NOTIFICATION_ID_ERROR; @@ -111,7 +115,7 @@ public class GBApplication extends Application { private static SharedPreferences sharedPrefs; private static final String PREFS_VERSION = "shared_preferences_version"; //if preferences have to be migrated, increment the following and add the migration logic in migratePrefs below; see http://stackoverflow.com/questions/16397848/how-can-i-migrate-android-preferences-with-a-new-version - private static final int CURRENT_PREFS_VERSION = 10; + private static final int CURRENT_PREFS_VERSION = 11; private static LimitedQueue mIDSenderLookup = new LimitedQueue(16); private static Prefs prefs; @@ -977,6 +981,97 @@ public class GBApplication extends Application { Log.w(TAG, "error acquiring DB lock"); } } + if (oldVersion < 11) { + try (DBHandler db = acquireDB()) { + DaoSession daoSession = db.getDaoSession(); + List activeDevices = DBHelper.getActiveDevices(daoSession); + for (Device dbDevice : activeDevices) { + SharedPreferences deviceSharedPrefs = GBApplication.getDeviceSpecificSharedPrefs(dbDevice.getIdentifier()); + SharedPreferences.Editor deviceSharedPrefsEdit = deviceSharedPrefs.edit(); + DeviceType deviceType = fromKey(dbDevice.getType()); + if (deviceType == WATCHXPLUS || deviceType == FITPRO || deviceType == LEFUN) { + deviceSharedPrefsEdit.putBoolean("inactivity_warnings_enable", deviceSharedPrefs.getBoolean("pref_longsit_switch", false)); + deviceSharedPrefsEdit.remove("pref_longsit_switch"); + } + if (deviceType == WATCHXPLUS || deviceType == FITPRO) { + deviceSharedPrefsEdit.putString("inactivity_warnings_start", deviceSharedPrefs.getString("pref_longsit_start", "06:00")); + deviceSharedPrefsEdit.putString("inactivity_warnings_end", deviceSharedPrefs.getString("pref_longsit_end", "23:00")); + deviceSharedPrefsEdit.remove("pref_longsit_start"); + deviceSharedPrefsEdit.remove("pref_longsit_end"); + } + if (deviceType == WATCHXPLUS || deviceType == LEFUN) { + deviceSharedPrefsEdit.putString("inactivity_warnings_threshold", deviceSharedPrefs.getString("pref_longsit_period", "60")); + deviceSharedPrefsEdit.remove("pref_longsit_period"); + } + if (deviceType == TLW64) { + deviceSharedPrefsEdit.putBoolean("inactivity_warnings_enable_noshed", deviceSharedPrefs.getBoolean("screen_longsit_noshed", false)); + deviceSharedPrefsEdit.remove("screen_longsit_noshed"); + } + if (dbDevice.getManufacturer().equals("Huami")) { + editor.putBoolean("inactivity_warnings_dnd", prefs.getBoolean("mi2_inactivity_warnings_dnd", false)); + editor.putString("inactivity_warnings_dnd_start", prefs.getString("mi2_inactivity_warnings_dnd_start", "12:00")); + editor.putString("inactivity_warnings_dnd_end", prefs.getString("mi2_inactivity_warnings_dnd_end", "14:00")); + editor.putBoolean("inactivity_warnings_enable", prefs.getBoolean("mi2_inactivity_warnings", false)); + editor.putInt("inactivity_warnings_threshold", prefs.getInt("mi2_inactivity_warnings_threshold", 60)); + editor.putString("inactivity_warnings_start", prefs.getString("mi2_inactivity_warnings_start", "06:00")); + editor.putString("inactivity_warnings_end", prefs.getString("mi2_inactivity_warnings_end", "22:00")); + } + switch (deviceType) { + case LEFUN: + deviceSharedPrefsEdit.putString("language", deviceSharedPrefs.getString("pref_lefun_interface_language", "0")); + deviceSharedPrefsEdit.remove("pref_lefun_interface_language"); + break; + case FITPRO: + deviceSharedPrefsEdit.putString("inactivity_warnings_threshold", deviceSharedPrefs.getString("pref_longsit_period", "4")); + deviceSharedPrefsEdit.remove("pref_longsit_period"); + break; + case ZETIME: + editor.putString("do_not_disturb", prefs.getString("zetime_do_not_disturb", "off")); + editor.putString("do_not_disturb_start", prefs.getString("zetime_do_not_disturb_start", "22:00")); + editor.putString("do_not_disturb_end", prefs.getString("zetime_do_not_disturb_end", "07:00")); + editor.putBoolean("inactivity_warnings_enable", prefs.getBoolean("zetime_inactivity_warnings", false)); + editor.putString("inactivity_warnings_start", prefs.getString("zetime_inactivity_warnings_start", "06:00")); + editor.putString("inactivity_warnings_end", prefs.getString("zetime_inactivity_warnings_end", "22:00")); + editor.putInt("inactivity_warnings_threshold", prefs.getInt("zetime_inactivity_warnings_threshold", 60)); + editor.putBoolean("inactivity_warnings_mo", prefs.getBoolean("zetime_prefs_inactivity_repetitions_mo", false)); + editor.putBoolean("inactivity_warnings_tu", prefs.getBoolean("zetime_prefs_inactivity_repetitions_tu", false)); + editor.putBoolean("inactivity_warnings_we", prefs.getBoolean("zetime_prefs_inactivity_repetitions_we", false)); + editor.putBoolean("inactivity_warnings_th", prefs.getBoolean("zetime_prefs_inactivity_repetitions_th", false)); + editor.putBoolean("inactivity_warnings_fr", prefs.getBoolean("zetime_prefs_inactivity_repetitions_fr", false)); + editor.putBoolean("inactivity_warnings_sa", prefs.getBoolean("zetime_prefs_inactivity_repetitions_sa", false)); + editor.putBoolean("inactivity_warnings_su", prefs.getBoolean("zetime_prefs_inactivity_repetitions_su", false)); + break; + } + deviceSharedPrefsEdit.apply(); + } + editor.putInt("fitness_goal", prefs.getInt("mi_fitness_goal", 8000)); + + editor.remove("zetime_do_not_disturb"); + editor.remove("zetime_do_not_disturb_start"); + editor.remove("zetime_do_not_disturb_end"); + editor.remove("zetime_inactivity_warnings"); + editor.remove("zetime_inactivity_warnings_start"); + editor.remove("zetime_inactivity_warnings_end"); + editor.remove("zetime_inactivity_warnings_threshold"); + editor.remove("zetime_prefs_inactivity_repetitions_mo"); + editor.remove("zetime_prefs_inactivity_repetitions_tu"); + editor.remove("zetime_prefs_inactivity_repetitions_we"); + editor.remove("zetime_prefs_inactivity_repetitions_th"); + editor.remove("zetime_prefs_inactivity_repetitions_fr"); + editor.remove("zetime_prefs_inactivity_repetitions_sa"); + editor.remove("zetime_prefs_inactivity_repetitions_su"); + editor.remove("mi2_inactivity_warnings_dnd"); + editor.remove("mi2_inactivity_warnings_dnd_start"); + editor.remove("mi2_inactivity_warnings_dnd_end"); + editor.remove("mi2_inactivity_warnings"); + editor.remove("mi2_inactivity_warnings_threshold"); + editor.remove("mi2_inactivity_warnings_start"); + editor.remove("mi2_inactivity_warnings_end"); + editor.remove("mi_fitness_goal"); + } catch (Exception e) { + Log.w(TAG, "error acquiring DB lock"); + } + } editor.putString(PREFS_VERSION, Integer.toString(CURRENT_PREFS_VERSION)); editor.apply(); } From 6223336bc3a2ab5a1fb9a7f5c88d1c93c33d42e6 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Wed, 30 Mar 2022 23:08:14 +0200 Subject: [PATCH 11/31] bump gradle --- app/build.gradle | 1 - build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5d911a7b7..80fe1036d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -47,7 +47,6 @@ android { targetCompatibility JavaVersion.VERSION_1_7 } compileSdkVersion 29 - buildToolsVersion '30.0.2' defaultConfig { applicationId "nodomain.freeyourgadget.gadgetbridge" diff --git a/build.gradle b/build.gradle index 5d6773738..f0b406e7a 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { } } dependencies { - classpath 'com.android.tools.build:gradle:7.0.4' + classpath 'com.android.tools.build:gradle:7.1.2' classpath 'gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:2.0.0' classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.17' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7957c716d..393baaa07 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip From 08eb58e63b5b8c2c2f927ab99b480b6c6a523642 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Thu, 31 Mar 2022 11:07:13 +0200 Subject: [PATCH 12/31] Mi Band 6: set time on connect --- .../service/devices/huami/operations/InitOperation2021.java | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/operations/InitOperation2021.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/operations/InitOperation2021.java index e4a5b17cc..8764bb5cf 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/operations/InitOperation2021.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/operations/InitOperation2021.java @@ -131,6 +131,7 @@ public class InitOperation2021 extends InitOperation { TransactionBuilder builder = createTransactionBuilder("Authenticated, now initialize phase 2"); builder.add(new SetDeviceStateAction(getDevice(), GBDevice.State.INITIALIZING, getContext())); huamiSupport.enableFurtherNotifications(builder, true); + huamiSupport.setCurrentTimeWithService(builder); huamiSupport.requestDeviceInfo(builder); huamiSupport.phase2Initialize(builder); huamiSupport.phase3Initialize(builder); From cf703476367d569984b1fd463c3a9ae491de2b09 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Thu, 31 Mar 2022 11:25:15 +0200 Subject: [PATCH 13/31] Fix crash when calender is accessed but permissin is denied Fixes #2624 --- .../freeyourgadget/gadgetbridge/model/CalendarEvents.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/CalendarEvents.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/CalendarEvents.java index 86b4946ba..9580bfc01 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/CalendarEvents.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/CalendarEvents.java @@ -110,6 +110,9 @@ public class CalendarEvents { } } return true; + } catch (Exception e) { + LOG.error("could not query calendar, permission denied?"); + return false; } } From ebdec4bdd0dfec4254379dd57703a935feac5e05 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Thu, 31 Mar 2022 11:33:01 +0200 Subject: [PATCH 14/31] change description to include watch and fitness tracker. Fixes #2625 --- fastlane/metadata/android/en-US/full_description.txt | 3 ++- fastlane/metadata/android/en-US/short_description.txt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fastlane/metadata/android/en-US/full_description.txt b/fastlane/metadata/android/en-US/full_description.txt index a5f8851ba..22c5f51fc 100644 --- a/fastlane/metadata/android/en-US/full_description.txt +++ b/fastlane/metadata/android/en-US/full_description.txt @@ -1,4 +1,5 @@ -Use your Pebble/Mi Band/Amazfit Bip/Hplus device without the vendor's closed source application and without the need to create an account and transmit any of your data to the vendor's servers. +Use your smart watch, fitness tracker, and other bluetooth devices without the vendor's closed source application and without the need to create an account and transmit any of your data to the vendor's servers. +For a full list of supported device, please refer to our Homepage or README.md in our git repository. You can get notifications on your wrist and (depending on the device): diff --git a/fastlane/metadata/android/en-US/short_description.txt b/fastlane/metadata/android/en-US/short_description.txt index d4cf86318..ec99d8c59 100644 --- a/fastlane/metadata/android/en-US/short_description.txt +++ b/fastlane/metadata/android/en-US/short_description.txt @@ -1 +1 @@ -Use your Pebble/Bip/Miband/Hplus/[more] and keep your data private! +Use your smart watch and other bluetooth devices and keep your data private! From 2cb5844020a4df0e7eb29180b32a8d93e76fbdd8 Mon Sep 17 00:00:00 2001 From: gfwilliams Date: Thu, 31 Mar 2022 11:36:26 +0200 Subject: [PATCH 15/31] Bangle.js build flavor (#2621) This PR adds build flavors to `build.gradle`. The default is called `main`, but we also add `banglejs` which allows the building of an app called `Bangle.js Gadgetbridge`. This will have internet connectivity, allowing Bangle.js watches to request data directly from the internet - and it's named so as hopefully not to be confused with the normal offline Gadgetbridge, while still giving credit. Eventually the plan is to put this on the Google Play store, and to have additions in it which are good for Bangle.js users but would otherwise negatively impact normal Gadgetbridge users (a build flavor is used so we can keep the same codebase and not fork). About naming - I'd mentioned `Gadgetbridge for Bangle` to @ashimokawa but thinking about how it would appear in the app store and Android apps list, it probably makes sense to call it `Bangle.js Gadgetbridge` so it's listed under `B...`. Happy to change or use something else if you have strong opinions though. **Note:** adding build flavors seems to add the flavor name to existing builds. As a result, *all other builds will now have `main` in the name*. Unfortunately I didn't see another way around this, but hopefully it won't break anything. Co-authored-by: Gordon Williams Reviewed-on: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/2621 Co-authored-by: gfwilliams Co-committed-by: gfwilliams --- README.md | 1 + app/build.gradle | 23 ++++++ app/src/banglejs/AndroidManifest.xml | 5 ++ .../res/drawable/ic_launcher_foreground.xml | 72 +++++++++++++++++++ app/src/banglejs/res/values/strings.xml | 8 +++ .../activities/ControlCenterv2.java | 7 ++ .../banglejs/BangleJSDeviceSupport.java | 69 +++++++++++++++--- 7 files changed, 176 insertions(+), 9 deletions(-) create mode 100644 app/src/banglejs/AndroidManifest.xml create mode 100644 app/src/banglejs/res/drawable/ic_launcher_foreground.xml create mode 100644 app/src/banglejs/res/values/strings.xml diff --git a/README.md b/README.md index 3eb5905e6..a264f89d8 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ vendor's servers. - T-Rex [**\[!\]**](#special-pairing-procedures) - Verge Lite [**\[!\]**](#special-pairing-procedures) - [X ](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Mi-Band-5) [**\[!\]**](#special-pairing-procedures) +- [Bangle.js](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Bangle.js) - BFH-16 - [Casio](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Casio) - Casio GB-X6900B diff --git a/app/build.gradle b/app/build.gradle index 80fe1036d..ee4ef5613 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -60,6 +60,7 @@ android { vectorDrawables.useSupportLibrary = true multiDexEnabled true buildConfigField "String", "GIT_HASH_SHORT", "\"${getGitHashShort()}\"" + buildConfigField "boolean", "INTERNET_ACCESS", "false" resValue "string", "pebble_content_provider", "com.getpebble.android.provider" } signingConfigs { @@ -121,6 +122,27 @@ android { } + flavorDimensions "device_type" + productFlavors { + main { + // Ensure that when starting from scratch, 'main' is selected, not 'banglejs' + getIsDefault().set(true) + // the default build product flavor + dimension "device_type" + //applicationIdSuffix "" + //versionNameSuffix "" + } + banglejs { + dimension "device_type" + applicationId "com.espruino.gadgetbridge" + applicationIdSuffix ".banglejs" + versionNameSuffix "-banglejs" + buildConfigField "boolean", "INTERNET_ACCESS", "true" + // Disable pebble provider to allow Bangle.js Gadgetbridge to coexist with Gadgetbridge + resValue "string", "pebble_content_provider", "com.getpebble.android.nopebble.provider" + } + } + lintOptions { abortOnError ABORT_ON_CHECK_FAILURE lintConfig file("${project.rootDir}/config/lint/lint.xml") @@ -195,6 +217,7 @@ dependencies { implementation 'com.github.wax911:android-emojify:0.1.7' implementation 'com.google.protobuf:protobuf-lite:3.0.1' implementation "androidx.multidex:multidex:2.0.1" + implementation 'com.android.volley:volley:1.2.1' } preBuild.dependsOn(":GBDaoGenerator:genSources") diff --git a/app/src/banglejs/AndroidManifest.xml b/app/src/banglejs/AndroidManifest.xml new file mode 100644 index 000000000..8478e0e63 --- /dev/null +++ b/app/src/banglejs/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/banglejs/res/drawable/ic_launcher_foreground.xml b/app/src/banglejs/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 000000000..92a455296 --- /dev/null +++ b/app/src/banglejs/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/banglejs/res/values/strings.xml b/app/src/banglejs/res/values/strings.xml new file mode 100644 index 000000000..e965e9764 --- /dev/null +++ b/app/src/banglejs/res/values/strings.xml @@ -0,0 +1,8 @@ + + + Bangle.js Gadgetbridge + Bangle.js Gadgetbridge + About Bangle.js Gadgetbridge + Android companion app for Bangle.js built on top of the Gadgetbridge project, with added Internet Access. + Bangle.js running + diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java index 2b2e82205..e63c4d23e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java @@ -65,6 +65,7 @@ import java.util.Set; import de.cketti.library.changelog.ChangeLog; import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.R; +import nodomain.freeyourgadget.gadgetbridge.BuildConfig; import nodomain.freeyourgadget.gadgetbridge.adapter.GBDeviceAdapterv2; import nodomain.freeyourgadget.gadgetbridge.database.DBAccess; import nodomain.freeyourgadget.gadgetbridge.database.DBHandler; @@ -438,6 +439,12 @@ public class ControlCenterv2 extends AppCompatActivity } } + if (BuildConfig.INTERNET_ACCESS) { + if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.INTERNET) == PackageManager.PERMISSION_DENIED) { + wantedPermissions.add(Manifest.permission.INTERNET); + } + } + if (!wantedPermissions.isEmpty()) { Prefs prefs = GBApplication.getPrefs(); // If this is not the first run, we can rely on diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java index 73fb64da3..e79089800 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java @@ -31,6 +31,13 @@ import android.widget.Toast; import androidx.localbroadcastmanager.content.LocalBroadcastManager; +import com.android.volley.Request; +import com.android.volley.Response; +import com.android.volley.RequestQueue; +import com.android.volley.VolleyError; +import com.android.volley.toolbox.StringRequest; +import com.android.volley.toolbox.Volley; + import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -270,6 +277,39 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport { LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent); } } break; + case "http": { + // FIXME: This should be behind a default-off option in Gadgetbridge settings + RequestQueue queue = Volley.newRequestQueue(getContext()); + String url = json.getString("url"); + // Request a string response from the provided URL. + StringRequest stringRequest = new StringRequest(Request.Method.GET, url, + new Response.Listener() { + @Override + public void onResponse(String response) { + JSONObject o = new JSONObject(); + try { + o.put("t", "http"); + o.put("resp", response); + } catch (JSONException e) { + GB.toast(getContext(), "HTTP: " + e.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR); + } + uartTxJSON("http", o); + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + JSONObject o = new JSONObject(); + try { + o.put("t", "http"); + o.put("err", error.toString()); + } catch (JSONException e) { + GB.toast(getContext(), "HTTP: " + e.getLocalizedMessage(), Toast.LENGTH_LONG, GB.ERROR); + } + uartTxJSON("http", o); + } + }); + queue.add(stringRequest); + } break; } } @@ -628,23 +668,34 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport { /** Convert a drawable to a bitmap, for use with bitmapToEspruino */ public static Bitmap drawableToBitmap(Drawable drawable) { + final int maxWidth = 32; + final int maxHeight = 32; + /* Return bitmap directly but only if it's small enough. It could be + we have a bitmap but it's just too big to send direct to the bangle */ if (drawable instanceof BitmapDrawable) { BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable; - if (bitmapDrawable.getBitmap() != null) { - return bitmapDrawable.getBitmap(); - } + Bitmap bmp = bitmapDrawable.getBitmap(); + if (bmp != null && bmp.getWidth()<=maxWidth && bmp.getHeight()<=maxHeight) + return bmp; } - int w = 24; - int h = 24; + /* Otherwise render this to a bitmap ourselves.. work out size */ + int w = maxWidth; + int h = maxHeight; if (drawable.getIntrinsicWidth() > 0 && drawable.getIntrinsicHeight() > 0) { w = drawable.getIntrinsicWidth(); h = drawable.getIntrinsicHeight(); - // don't allocate anything too big - if (w>24) w=24; - if (h>24) h=24; + // don't allocate anything too big, but keep the ratio + if (w>maxWidth) { + h = h * maxWidth / w; + w = maxWidth; + } + if (h>maxHeight) { + w = w * maxHeight / h; + h = maxHeight; + } } + /* render */ Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); // Single color bitmap will be created of 1x1 pixel - Canvas canvas = new Canvas(bitmap); drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); drawable.draw(canvas); From 3b9e13cfc5edf37f1497c2f29ee31264894f25fb Mon Sep 17 00:00:00 2001 From: vanous Date: Sat, 2 Apr 2022 12:09:05 +0200 Subject: [PATCH 16/31] bump cmake to 3.18.1 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index ee4ef5613..b7264498e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -161,7 +161,7 @@ android { externalNativeBuild { cmake { path "src/main/c/CMakeLists.txt" - version "3.10.2" + version "3.18.1" } } sourceSets { From a9030f1c00bcf53e7e755f228a916ebecd3a5599 Mon Sep 17 00:00:00 2001 From: vanous Date: Mon, 4 Apr 2022 18:57:47 +0200 Subject: [PATCH 17/31] remove filter from ci, allow branches to build --- .woodpecker/can_master_build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.woodpecker/can_master_build.yml b/.woodpecker/can_master_build.yml index c5136d7bb..695e39658 100644 --- a/.woodpecker/can_master_build.yml +++ b/.woodpecker/can_master_build.yml @@ -5,9 +5,9 @@ pipeline: - pwd #bump - ./gradlew assembleDebug --stacktrace - when: - repo: Freeyourgadget/Gadgetbridge - branch: master +#when: +#repo: Freeyourgadget/Gadgetbridge +#branch: master #this doesn't work yet: #https://github.com/woodpecker-ci/woodpecker/issues/687 From 20e97bc04828f623d7f384bd55d2da9c0906b9b4 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Thu, 7 Apr 2022 21:55:04 +0200 Subject: [PATCH 18/31] bump android gradle plugin --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index f0b406e7a..e09271d1c 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { } } dependencies { - classpath 'com.android.tools.build:gradle:7.1.2' + classpath 'com.android.tools.build:gradle:7.1.3' classpath 'gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:2.0.0' classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.17' From 8510cdbb3f58a131009c2216ccbc4ecfe6590c70 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Thu, 7 Apr 2022 22:54:24 +0200 Subject: [PATCH 19/31] Amazfit Neo: Allow to disable beeps for email notifications Fixes #2607 --- .../gadgetbridge/service/devices/huami/HuamiSupport.java | 4 ++-- .../service/devices/huami/amazfitneo/AmazfitNeoSupport.java | 2 -- app/src/main/res/values/arrays.xml | 2 ++ app/src/main/res/values/strings.xml | 1 + app/src/main/res/values/values.xml | 1 + 5 files changed, 6 insertions(+), 4 deletions(-) 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 3992990d9..6851f2bea 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 @@ -2817,8 +2817,8 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport { if (sounds != null) { - final String[] soundOrder = new String[]{"button", "calls", "alarm", "notifications", "inactivity_warning", "sms", "goal"}; - byte[] command = new byte[]{0x3c, 0, 0, 0, 1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 0, 5, 0, 0, 7, 0, 0}; + final String[] soundOrder = new String[]{"button", "calls", "alarm", "notifications", "inactivity_warning", "sms", "email", "goal"}; + byte[] command = new byte[]{0x3c, 0, 0, 0, 1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 0, 5, 0, 0, 6, 0, 0, 7, 0, 0}; int i = 3; for (String sound : soundOrder) { if (sounds.contains(sound)) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitneo/AmazfitNeoSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitneo/AmazfitNeoSupport.java index 51ccc3e2b..d381cf9ff 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitneo/AmazfitNeoSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/huami/amazfitneo/AmazfitNeoSupport.java @@ -32,9 +32,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband5.MiBand5Support; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.operations.UpdateFirmwareOperation; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.operations.UpdateFirmwareOperation2020; -import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.operations.UpdateFirmwareOperationNew; -//import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitneo.AmazfitBand5FWHelper; public class AmazfitNeoSupport extends MiBand5Support { private static final Logger LOG = LoggerFactory.getLogger(AmazfitNeoSupport.class); diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 36387bf1f..e71a0eaaf 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -1818,6 +1818,7 @@ @string/menuitem_notifications @string/mi2_prefs_inactivity_warnings @string/pref_title_notifications_sms + @string/menuitem_email @string/menuitem_goal @@ -1828,6 +1829,7 @@ @string/p_menuitem_notifications @string/p_menuitem_inactivity_warning @string/p_menuitem_sms + @string/p_menuitem_email @string/p_menuitem_goal diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c6d82b9f3..8d65c4df6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -994,6 +994,7 @@ Temperature Barometer Flashlight + E-mail Minutes: Hours: Seconds: diff --git a/app/src/main/res/values/values.xml b/app/src/main/res/values/values.xml index d8343afb7..7380f9f1c 100644 --- a/app/src/main/res/values/values.xml +++ b/app/src/main/res/values/values.xml @@ -61,6 +61,7 @@ calls inactivity_warning sms + email off on From 80edd065b64d442ff3834a92d5cdd2e7b51144cd Mon Sep 17 00:00:00 2001 From: BobIsMyManager Date: Fri, 8 Apr 2022 00:02:31 +0200 Subject: [PATCH 20/31] Switch to matrix.to So the url should work with all supported clients --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a264f89d8..76fe04b61 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ Translations can be contributed via https://hosted.weblate.org/projects/freeyour ## Community If you would like to get in touch with other Gadgetbridge users and developers outside of Codeberg, you can do so via: -* Matrix: `#gadgetbridge:matrix.org` ([web access via Element.io](https://app.element.io/#/room/#gadgetbridge:matrix.org)) +* Matrix: [`#gadgetbridge:matrix.org`](https://matrix.to/#/#gadgetbridge:matrix.org) ## Do you have further questions or feedback? From 9ab9186e58e5235cd396f918ece998c03cf4b723 Mon Sep 17 00:00:00 2001 From: Daniel Dakhno Date: Fri, 15 Apr 2022 01:21:26 +0200 Subject: [PATCH 21/31] UM25: added reset option to current accumulation --- .../gadgetbridge/devices/um25/Activity/DataActivity.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/um25/Activity/DataActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/um25/Activity/DataActivity.java index 485398cdf..2f0a11f62 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/um25/Activity/DataActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/um25/Activity/DataActivity.java @@ -56,6 +56,7 @@ public class DataActivity extends AbstractGBActivity { chargeDurationTextView = findViewById(R.id.um25_text_charge_duration); TextView wattHoursTextView = findViewById(R.id.um25_text_wattage_sum); + TextView currentAccumulatedTextView = findViewById(R.id.um25_text_current_sum); View.OnLongClickListener longClickListener = new View.OnLongClickListener() { @Override @@ -70,6 +71,7 @@ public class DataActivity extends AbstractGBActivity { chargeDurationTextView.setOnLongClickListener(longClickListener); wattHoursTextView.setOnLongClickListener(longClickListener); + currentAccumulatedTextView.setOnLongClickListener(longClickListener); } @Override From bba5452f571dd188eeec587440038999cdf13924 Mon Sep 17 00:00:00 2001 From: Daniel Dakhno Date: Fri, 15 Apr 2022 01:27:00 +0200 Subject: [PATCH 22/31] QC35: fixed typo --- app/src/main/res/xml/devicesettings_qc35.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/xml/devicesettings_qc35.xml b/app/src/main/res/xml/devicesettings_qc35.xml index 4d1899c10..e220130f8 100644 --- a/app/src/main/res/xml/devicesettings_qc35.xml +++ b/app/src/main/res/xml/devicesettings_qc35.xml @@ -2,7 +2,7 @@ From bf4e948c3578da2731eaaf47b86771f34e74f12a Mon Sep 17 00:00:00 2001 From: Daniel Dakhno Date: Fri, 15 Apr 2022 02:08:51 +0200 Subject: [PATCH 23/31] UM25: added notification on below current threshold --- .../DeviceSettingsPreferenceConst.java | 3 + .../DeviceSpecificSettingsFragment.java | 3 + .../um25/Coordinator/UM25Coordinator.java | 8 +++ .../devices/um25/Support/UM25Support.java | 71 ++++++++++++++++++- app/src/main/res/xml/devicesettings_um25.xml | 11 +++ 5 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/xml/devicesettings_um25.xml 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 2903eb033..7e461dfd1 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 @@ -178,6 +178,9 @@ public class DeviceSettingsPreferenceConst { public static final String PREFS_ACTIVITY_IN_DEVICE_CARD_DISTANCE = "prefs_activity_in_device_card_distance"; public static final String PREFS_DEVICE_CHARTS_TABS = "charts_tabs"; + public static final String PREF_UM25_SHOW_THRESHOLD_NOTIFICATION = "um25_current_threshold_notify"; + public static final String PREF_UM25_SHOW_THRESHOLD = "um25_current_threshold"; + public static final String PREF_SOUNDS = "sounds"; public static final String PREF_AUTH_KEY = "authkey"; public static final String PREF_USER_FITNESS_GOAL = "fitness_goal"; 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 373e03aee..260a64ea8 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 @@ -456,6 +456,9 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat imp addPreferenceHandlerFor(PREF_QC35_NOISE_CANCELLING_LEVEL); addPreferenceHandlerFor(PREF_USER_FITNESS_GOAL); + addPreferenceHandlerFor(PREF_UM25_SHOW_THRESHOLD_NOTIFICATION); + addPreferenceHandlerFor(PREF_UM25_SHOW_THRESHOLD); + String sleepTimeState = prefs.getString(PREF_SLEEP_TIME, PREF_DO_NOT_DISTURB_OFF); boolean sleepTimeScheduled = sleepTimeState.equals(PREF_DO_NOT_DISTURB_SCHEDULED); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/um25/Coordinator/UM25Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/um25/Coordinator/UM25Coordinator.java index efe70c99a..65c312caf 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/um25/Coordinator/UM25Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/um25/Coordinator/UM25Coordinator.java @@ -16,6 +16,7 @@ import java.util.Collections; import cyanogenmod.app.CustomTile; import nodomain.freeyourgadget.gadgetbridge.GBException; +import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; @@ -55,6 +56,13 @@ public class UM25Coordinator extends AbstractDeviceCoordinator { return DeviceType.UNKNOWN; } + @Override + public int[] getSupportedDeviceSpecificSettings(GBDevice device) { + return new int[]{ + R.xml.devicesettings_um25 + }; + } + @Override public DeviceType getDeviceType() { return DeviceType.UM25; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/um25/Support/UM25Support.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/um25/Support/UM25Support.java index 7a728c375..8a6c8b19d 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/um25/Support/UM25Support.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/um25/Support/UM25Support.java @@ -1,12 +1,15 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.um25.Support; +import android.app.Notification; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.SharedPreferences; +import androidx.core.app.NotificationCompat; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import org.slf4j.Logger; @@ -19,12 +22,16 @@ import java.util.UUID; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import nodomain.freeyourgadget.gadgetbridge.GBApplication; +import nodomain.freeyourgadget.gadgetbridge.R; +import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.service.btle.BtLEAction; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; import nodomain.freeyourgadget.gadgetbridge.service.btle.actions.SetDeviceStateAction; import nodomain.freeyourgadget.gadgetbridge.service.devices.um25.Data.CaptureGroup; import nodomain.freeyourgadget.gadgetbridge.service.devices.um25.Data.MeasurementData; +import nodomain.freeyourgadget.gadgetbridge.util.GB; import nodomain.freeyourgadget.gadgetbridge.util.StringUtils; public class UM25Support extends UM25BaseSupport { @@ -44,6 +51,12 @@ public class UM25Support extends UM25BaseSupport { private static final Logger logger = LoggerFactory.getLogger(UM25Support.class); + SharedPreferences preferences; + + private boolean notifyOnCurrentThreshold; + private int notificationCurrentThreshold; + private boolean wasOverNotificationCurrent = false; + private long lastOverThresholdTimestamp = 0; public UM25Support() { super(logger); @@ -63,8 +76,22 @@ public class UM25Support extends UM25BaseSupport { } }; + void readPreferences(){ + notifyOnCurrentThreshold = preferences.getBoolean(DeviceSettingsPreferenceConst.PREF_UM25_SHOW_THRESHOLD_NOTIFICATION, false); + notificationCurrentThreshold = Integer.parseInt(preferences.getString(DeviceSettingsPreferenceConst.PREF_UM25_SHOW_THRESHOLD, "100")); + } + + @Override + public void onSendConfiguration(String config) { + readPreferences(); + } + @Override protected TransactionBuilder initializeDevice(TransactionBuilder builder) { + preferences = GBApplication.getDeviceSpecificSharedPrefs(getDevice().getAddress()); + + readPreferences(); + return builder .add(new SetDeviceStateAction(getDevice(), GBDevice.State.INITIALIZING, getContext())) .notify(getCharacteristic(UUID.fromString(UUID_CHAR)), true) @@ -132,6 +159,46 @@ public class UM25Support extends UM25BaseSupport { return true; } + private void handleCurrentNotification(int currentMa){ + logger.debug("current: " + currentMa); + + if(!notifyOnCurrentThreshold){ + return; + } + + boolean isOverNotificationCurrent = currentMa > notificationCurrentThreshold; + + long now = System.currentTimeMillis(); + + if(isOverNotificationCurrent){ + lastOverThresholdTimestamp = now; + wasOverNotificationCurrent = true; + return; + } + long deltaSinceOverThreshold = now - lastOverThresholdTimestamp; + + if(deltaSinceOverThreshold < 5000){ + // must be below threshold for over certain time before triggering notification + return; + } + + if(wasOverNotificationCurrent){ + // handle change from over threshold to below threshold + wasOverNotificationCurrent = false; + Notification notification = new NotificationCompat.Builder(getContext(), GB.NOTIFICATION_CHANNEL_HIGH_PRIORITY_ID) + .setSmallIcon(R.drawable.ic_notification_low_battery) + .setContentTitle("USB current") + .setContentText("USB current below threshold") + .build(); + + GB.notify( + GB.NOTIFICATION_ID_LOW_BATTERY, + notification, + getContext() + ); + } + } + private void handlePayload(ByteBuffer payload){ String payloadString = StringUtils.bytesToHex(payload.array()); payloadString = payloadString.replaceAll("(..)", "$1 "); @@ -163,8 +230,6 @@ public class UM25Support extends UM25BaseSupport { int chargingSeconds = payload.getInt(112); int cableResistance = payload.getInt(122); - logger.debug("variable: " + chargedCurrent); - MeasurementData data = new MeasurementData( voltage, current, @@ -185,6 +250,8 @@ public class UM25Support extends UM25BaseSupport { measurementIntent.putExtra(EXTRA_KEY_MEASUREMENT_DATA, data); + handleCurrentNotification(current / 10); + LocalBroadcastManager.getInstance(getContext()) .sendBroadcast(measurementIntent); } diff --git a/app/src/main/res/xml/devicesettings_um25.xml b/app/src/main/res/xml/devicesettings_um25.xml new file mode 100644 index 000000000..ebc0cb7fb --- /dev/null +++ b/app/src/main/res/xml/devicesettings_um25.xml @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file From 3fc53ef6b38f4377a816724ef4397dc00377ab99 Mon Sep 17 00:00:00 2001 From: Daniel Dakhno Date: Fri, 15 Apr 2022 02:12:36 +0200 Subject: [PATCH 24/31] UM25: added click listener to notification --- .../service/devices/um25/Support/UM25Support.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/um25/Support/UM25Support.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/um25/Support/UM25Support.java index 8a6c8b19d..48a57ea3a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/um25/Support/UM25Support.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/um25/Support/UM25Support.java @@ -1,6 +1,7 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.um25.Support; import android.app.Notification; +import android.app.PendingIntent; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; import android.content.BroadcastReceiver; @@ -25,6 +26,7 @@ import java.util.concurrent.TimeUnit; import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst; +import nodomain.freeyourgadget.gadgetbridge.devices.um25.Activity.DataActivity; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.service.btle.BtLEAction; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; @@ -185,10 +187,12 @@ public class UM25Support extends UM25BaseSupport { if(wasOverNotificationCurrent){ // handle change from over threshold to below threshold wasOverNotificationCurrent = false; + Intent activityIntent = new Intent(getContext(), DataActivity.class); Notification notification = new NotificationCompat.Builder(getContext(), GB.NOTIFICATION_CHANNEL_HIGH_PRIORITY_ID) .setSmallIcon(R.drawable.ic_notification_low_battery) .setContentTitle("USB current") .setContentText("USB current below threshold") + .setContentIntent(PendingIntent.getActivity(getContext(), 0, activityIntent, PendingIntent.FLAG_CANCEL_CURRENT)) .build(); GB.notify( From 367ad19205739c2a4f197b6b7f8b49510b70729e Mon Sep 17 00:00:00 2001 From: Daniel Dakhno Date: Fri, 15 Apr 2022 02:37:53 +0200 Subject: [PATCH 25/31] UM25: optimized imports, added pref summary --- .../devices/um25/Coordinator/UM25Coordinator.java | 4 ---- app/src/main/res/xml/devicesettings_um25.xml | 7 +++++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/um25/Coordinator/UM25Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/um25/Coordinator/UM25Coordinator.java index 65c312caf..4acf35b94 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/um25/Coordinator/UM25Coordinator.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/um25/Coordinator/UM25Coordinator.java @@ -9,16 +9,12 @@ import android.os.ParcelUuid; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import cyanogenmod.app.CustomTile; import nodomain.freeyourgadget.gadgetbridge.GBException; import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator; -import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider; import nodomain.freeyourgadget.gadgetbridge.devices.um25.Activity.DataActivity; diff --git a/app/src/main/res/xml/devicesettings_um25.xml b/app/src/main/res/xml/devicesettings_um25.xml index ebc0cb7fb..b005f48a2 100644 --- a/app/src/main/res/xml/devicesettings_um25.xml +++ b/app/src/main/res/xml/devicesettings_um25.xml @@ -1,5 +1,7 @@ - + @@ -7,5 +9,6 @@ android:title="Current threshold im mA" android:key="um25_current_threshold" android:inputType="number" - android:defaultValue="100"/> + android:defaultValue="100" + app:useSimpleSummaryProvider="true" />/> \ No newline at end of file From 04a8d242c7ad306b2c182a2a98bf1f97eff4d469 Mon Sep 17 00:00:00 2001 From: vanous Date: Sat, 2 Apr 2022 16:49:09 +0200 Subject: [PATCH 26/31] provide app strings based on variants via code --- app/src/banglejs/res/values/strings.xml | 8 ------ .../gadgetbridge/GBApplication.java | 21 ++++++++++++++++ .../activities/AboutActivity.java | 13 ++++++++++ .../activities/AbstractGBActivity.java | 2 ++ .../activities/ControlCenterv2.java | 1 + .../service/DeviceCommunicationService.java | 2 +- app/src/main/res/layout/activity_about.xml | 2 +- app/src/main/res/values/strings.xml | 25 ++++++++++++++++--- app/src/nightly/res/values/strings.xml | 2 +- app/src/nopebble/res/values/strings.xml | 2 +- 10 files changed, 63 insertions(+), 15 deletions(-) delete mode 100644 app/src/banglejs/res/values/strings.xml diff --git a/app/src/banglejs/res/values/strings.xml b/app/src/banglejs/res/values/strings.xml deleted file mode 100644 index e965e9764..000000000 --- a/app/src/banglejs/res/values/strings.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - Bangle.js Gadgetbridge - Bangle.js Gadgetbridge - About Bangle.js Gadgetbridge - Android companion app for Bangle.js built on top of the Gadgetbridge project, with added Internet Access. - Bangle.js running - diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java index 6282ebcac..7556e2468 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java @@ -1218,4 +1218,25 @@ public class GBApplication extends Application { public void setAutoExportScheduledTimestamp(long autoExportScheduledTimestamp) { this.autoExportScheduledTimestamp = autoExportScheduledTimestamp; } + /** + * Provides either a string resource based on current variant + * (main_debug, main_nightly...): "about_description_main_debug" + * or just a universal string resource for "about_description" + * + * @param resString + * @return string + */ + public String getStringResourceByVariantName(String resString) { + String packageName = getPackageName(); + String variation = BuildConfig.FLAVOR + "_" + BuildConfig.BUILD_TYPE; + int resIdVariation = getResources().getIdentifier(resString + "_" + variation, "string", packageName); + int resIdNormal = getResources().getIdentifier(resString, "string", packageName); + + if (resIdVariation == 0) { + //LOG.warn("Missing variation string: " + aString + "_" + variation); + return getString(resIdNormal); + } else { + return getString(resIdVariation); + } + } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AboutActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AboutActivity.java index 56a7ae3b9..18ba47446 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AboutActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AboutActivity.java @@ -20,17 +20,30 @@ package nodomain.freeyourgadget.gadgetbridge.activities; import android.os.Bundle; import android.text.method.LinkMovementMethod; import android.widget.TextView; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import nodomain.freeyourgadget.gadgetbridge.BuildConfig; +import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.R; public class AboutActivity extends AbstractGBActivity { + private static final Logger LOG = LoggerFactory.getLogger(ConfigureAlarms.class); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); TextView about_version = findViewById(R.id.about_version); + TextView about_title = findViewById(R.id.about_title); + TextView about_description = findViewById(R.id.about_description); + + setTitle(GBApplication.app().getStringResourceByVariantName("about_activity_title")); + about_title.setText(GBApplication.app().getStringResourceByVariantName("about_activity_title")); + about_description.setText(GBApplication.app().getStringResourceByVariantName("about_description")); + TextView about_hash = findViewById(R.id.about_hash); String versionName = BuildConfig.VERSION_NAME; String versionHASH = BuildConfig.GIT_HASH_SHORT; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractGBActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractGBActivity.java index 8d0ea2d51..ba96aaa15 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractGBActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractGBActivity.java @@ -28,6 +28,8 @@ import java.util.Locale; import androidx.appcompat.app.AppCompatActivity; import androidx.localbroadcastmanager.content.LocalBroadcastManager; + +import nodomain.freeyourgadget.gadgetbridge.BuildConfig; import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.util.AndroidUtils; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java index e63c4d23e..893813238 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java @@ -151,6 +151,7 @@ public class ControlCenterv2 extends AppCompatActivity setContentView(R.layout.activity_controlcenterv2); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); + setTitle(GBApplication.app().getStringResourceByVariantName("title_activity_controlcenter")); DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java index a9f7ddfa6..260f8e803 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java @@ -666,7 +666,7 @@ public class DeviceCommunicationService extends Service implements SharedPrefere private void start() { if (!mStarted) { GB.createNotificationChannels(this); - startForeground(GB.NOTIFICATION_ID, GB.createNotification(getString(R.string.gadgetbridge_running), this)); + startForeground(GB.NOTIFICATION_ID, GB.createNotification(GBApplication.app().getStringResourceByVariantName("gadgetbridge_running"), this)); mStarted = true; } } diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index a0817758e..769ce31ee 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -44,7 +44,7 @@ android:paddingRight="@dimen/about_margin"> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8d65c4df6..5b8247005 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2,6 +2,28 @@ Gadgetbridge Gadgetbridge + About Gadgetbridge + Cloudless copylefted libre replacement for closed source Android gadget apps from vendors. + Gadgetbridge running + + Bangle.js Gadgetbridge + Bangle.js Gadgetbridge + About Bangle.js Gadgetbridge + Android companion app for Bangle.js built on top of the Gadgetbridge project, with added Internet Access. + Bangle.js running + + Gadgetbridge (Nightly) + Gadgetbridge Nightly + About Gadgetbridge Nightly + Cloudless copylefted libre replacement for closed source Android gadget apps from vendors. Nightly releases of Gadgetbridge. It cannot be installed if you already have either the Gadgetbridge or the Pebble app installed, due to a conflict in the Pebble provider. + Nightly GB running + + Gadgetbridge (Nightly, No Pebble provider) + Gadgetbridge Nightly No Pebble + About Gadgetbridge Nightly No Pebble + Cloudless copylefted libre replacement for closed source Android gadget apps from vendors. Nightly releases of Gadgetbridge. This version has the Pebble provider renamed to prevent conflicts, so some Pebble related integrations will not work, but it can be installed alongside existing Gadgetbridge installation. + Nightly NoPebble GB running + Settings Debug Quit @@ -368,7 +390,6 @@ Tap connected device for vibration Tap a device to connect Cannot connect. Bluetooth address invalid? - Gadgetbridge running Installing binary %1$d/%2$d Installation failed Installed @@ -1096,11 +1117,9 @@ About Version %s Commit %s - About Gadgetbridge GPX Receiver Gadgetbridge GPX file(s) received: Some file(s) already exist. Overwrite? - Cloudless copylefted libre replacement for closed source Android gadget apps from vendors. Core Team (in order of first code contribution) Contributors Andreas Shimokawa\nCarsten Pfeiffer\nDaniele Gobbetti diff --git a/app/src/nightly/res/values/strings.xml b/app/src/nightly/res/values/strings.xml index c4e5885c9..e9a80b725 100644 --- a/app/src/nightly/res/values/strings.xml +++ b/app/src/nightly/res/values/strings.xml @@ -1,4 +1,4 @@ - Gadgetbridge (Nightly) + diff --git a/app/src/nopebble/res/values/strings.xml b/app/src/nopebble/res/values/strings.xml index 090f10a24..e9a80b725 100644 --- a/app/src/nopebble/res/values/strings.xml +++ b/app/src/nopebble/res/values/strings.xml @@ -1,4 +1,4 @@ - Gadgetbridge (Nightly, No Pebble provider) + From 38b9a8f80ec10ee5daea0423fe84fdb295f93d11 Mon Sep 17 00:00:00 2001 From: vanous Date: Sat, 2 Apr 2022 19:35:10 +0200 Subject: [PATCH 27/31] add logging --- .../nodomain/freeyourgadget/gadgetbridge/GBApplication.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java index 7556e2468..070b0b74f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java @@ -1233,7 +1233,8 @@ public class GBApplication extends Application { int resIdNormal = getResources().getIdentifier(resString, "string", packageName); if (resIdVariation == 0) { - //LOG.warn("Missing variation string: " + aString + "_" + variation); + // Since this class must not log to slf4j, we use plain android.util.Log + Log.i(TAG, "Missing variation string: " + resString + "_" + variation); return getString(resIdNormal); } else { return getString(resIdVariation); From ffeba878acaa0907b1a0b882b2fcbeb7ff7b5434 Mon Sep 17 00:00:00 2001 From: vanous Date: Sat, 2 Apr 2022 19:35:39 +0200 Subject: [PATCH 28/31] make Bangle strings working --- app/src/main/res/values/strings.xml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5b8247005..4b5d55d2f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -6,11 +6,17 @@ Cloudless copylefted libre replacement for closed source Android gadget apps from vendors. Gadgetbridge running - Bangle.js Gadgetbridge - Bangle.js Gadgetbridge - About Bangle.js Gadgetbridge - Android companion app for Bangle.js built on top of the Gadgetbridge project, with added Internet Access. - Bangle.js running + Bangle.js Gadgetbridge + Bangle.js Gadgetbridge + About Bangle.js Gadgetbridge + Android companion app for Bangle.js built on top of the Gadgetbridge project, with added Internet Access. + Bangle.js running + + Bangle.js Gadgetbridge + Bangle.js Gadgetbridge + About Bangle.js Gadgetbridge + Android companion app for Bangle.js built on top of the Gadgetbridge project, with added Internet Access. + Bangle.js running Gadgetbridge (Nightly) Gadgetbridge Nightly From dfd659301709939a9086404baed93a165224970d Mon Sep 17 00:00:00 2001 From: vanous Date: Sun, 3 Apr 2022 12:10:10 +0200 Subject: [PATCH 29/31] modify app_name in gradle --- app/build.gradle | 4 ++++ app/src/main/AndroidManifest.xml | 3 ++- app/src/main/res/values/strings.xml | 10 +++++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b7264498e..c4e4d1d23 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -62,6 +62,7 @@ android { buildConfigField "String", "GIT_HASH_SHORT", "\"${getGitHashShort()}\"" buildConfigField "boolean", "INTERNET_ACCESS", "false" resValue "string", "pebble_content_provider", "com.getpebble.android.provider" + resValue "string", "app_name", "@string/application_name" } signingConfigs { nightly { @@ -91,6 +92,7 @@ android { } proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" resValue "string", "pebble_content_provider", "com.getpebble.android.provider" + resValue "string", "app_name", "@string/application_name_main_nightly" debuggable true } nopebble { @@ -104,6 +106,7 @@ android { } proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" resValue "string", "pebble_content_provider", "com.getpebble.android.nopebble.provider" + resValue "string", "app_name", "@string/application_name_main_nopebble" debuggable true } @@ -140,6 +143,7 @@ android { buildConfigField "boolean", "INTERNET_ACCESS", "true" // Disable pebble provider to allow Bangle.js Gadgetbridge to coexist with Gadgetbridge resValue "string", "pebble_content_provider", "com.getpebble.android.nopebble.provider" + resValue "string", "app_name", "@string/application_name_banglejs_main" } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index edf7b965e..a2078b549 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -69,7 +69,8 @@ android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:requestLegacyExternalStorage="true" - android:theme="@style/GadgetbridgeTheme"> + android:theme="@style/GadgetbridgeTheme" + tools:replace="android:label"> - Gadgetbridge + Gadgetbridge Gadgetbridge About Gadgetbridge Cloudless copylefted libre replacement for closed source Android gadget apps from vendors. Gadgetbridge running - Bangle.js Gadgetbridge + Bangle.js Gadgetbridge Bangle.js Gadgetbridge About Bangle.js Gadgetbridge Android companion app for Bangle.js built on top of the Gadgetbridge project, with added Internet Access. Bangle.js running - Bangle.js Gadgetbridge + Bangle.js Gadgetbridge Bangle.js Gadgetbridge About Bangle.js Gadgetbridge Android companion app for Bangle.js built on top of the Gadgetbridge project, with added Internet Access. Bangle.js running - Gadgetbridge (Nightly) + Gadgetbridge (Nightly) Gadgetbridge Nightly About Gadgetbridge Nightly Cloudless copylefted libre replacement for closed source Android gadget apps from vendors. Nightly releases of Gadgetbridge. It cannot be installed if you already have either the Gadgetbridge or the Pebble app installed, due to a conflict in the Pebble provider. Nightly GB running - Gadgetbridge (Nightly, No Pebble provider) + Gadgetbridge (Nightly, No Pebble provider) Gadgetbridge Nightly No Pebble About Gadgetbridge Nightly No Pebble Cloudless copylefted libre replacement for closed source Android gadget apps from vendors. Nightly releases of Gadgetbridge. This version has the Pebble provider renamed to prevent conflicts, so some Pebble related integrations will not work, but it can be installed alongside existing Gadgetbridge installation. From 1516033955ad8ecd3a950230c617de388f4991bc Mon Sep 17 00:00:00 2001 From: vanous Date: Sat, 23 Apr 2022 07:29:54 +0200 Subject: [PATCH 30/31] make string resources to be customazibe via gradle only, no code --- app/build.gradle | 18 ++++++++++++++- .../gadgetbridge/GBApplication.java | 22 ------------------- .../activities/AboutActivity.java | 13 ----------- .../activities/AbstractGBActivity.java | 2 -- .../activities/ControlCenterv2.java | 1 - .../service/DeviceCommunicationService.java | 2 +- app/src/main/res/values/strings.xml | 10 ++++----- 7 files changed, 23 insertions(+), 45 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c4e4d1d23..85eeb0121 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -62,7 +62,11 @@ android { buildConfigField "String", "GIT_HASH_SHORT", "\"${getGitHashShort()}\"" buildConfigField "boolean", "INTERNET_ACCESS", "false" resValue "string", "pebble_content_provider", "com.getpebble.android.provider" - resValue "string", "app_name", "@string/application_name" + resValue "string", "app_name", "@string/application_name_generic" + resValue "string", "title_activity_controlcenter", "@string/title_activity_controlcenter_generic" + resValue "string", "about_activity_title", "@string/about_activity_title_generic" + resValue "string", "about_description", "@string/about_description_generic" + resValue "string", "gadgetbridge_running", "@string/gadgetbridge_running_generic" } signingConfigs { nightly { @@ -93,6 +97,10 @@ android { proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" resValue "string", "pebble_content_provider", "com.getpebble.android.provider" resValue "string", "app_name", "@string/application_name_main_nightly" + resValue "string", "title_activity_controlcenter", "@string/title_activity_controlcenter_main_nightly" + resValue "string", "about_activity_title", "@string/about_activity_title_main_nightly" + resValue "string", "about_description", "@string/about_description_main_nightly" + resValue "string", "gadgetbridge_running", "@string/gadgetbridge_running_main_nightly" debuggable true } nopebble { @@ -107,6 +115,10 @@ android { proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" resValue "string", "pebble_content_provider", "com.getpebble.android.nopebble.provider" resValue "string", "app_name", "@string/application_name_main_nopebble" + resValue "string", "title_activity_controlcenter", "@string/title_activity_controlcenter_main_nopebble" + resValue "string", "about_activity_title", "@string/about_activity_title_main_nopebble" + resValue "string", "about_description", "@string/about_description_main_nopebble" + resValue "string", "gadgetbridge_running", "@string/gadgetbridge_running_main_nopebble" debuggable true } @@ -144,6 +156,10 @@ android { // Disable pebble provider to allow Bangle.js Gadgetbridge to coexist with Gadgetbridge resValue "string", "pebble_content_provider", "com.getpebble.android.nopebble.provider" resValue "string", "app_name", "@string/application_name_banglejs_main" + resValue "string", "title_activity_controlcenter", "@string/title_activity_controlcenter_banglejs_main" + resValue "string", "about_activity_title", "@string/about_activity_title_banglejs_main" + resValue "string", "about_description", "@string/about_description_banglejs_main" + resValue "string", "gadgetbridge_running", "@string/gadgetbridge_running_banglejs_main" } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java index 070b0b74f..6282ebcac 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/GBApplication.java @@ -1218,26 +1218,4 @@ public class GBApplication extends Application { public void setAutoExportScheduledTimestamp(long autoExportScheduledTimestamp) { this.autoExportScheduledTimestamp = autoExportScheduledTimestamp; } - /** - * Provides either a string resource based on current variant - * (main_debug, main_nightly...): "about_description_main_debug" - * or just a universal string resource for "about_description" - * - * @param resString - * @return string - */ - public String getStringResourceByVariantName(String resString) { - String packageName = getPackageName(); - String variation = BuildConfig.FLAVOR + "_" + BuildConfig.BUILD_TYPE; - int resIdVariation = getResources().getIdentifier(resString + "_" + variation, "string", packageName); - int resIdNormal = getResources().getIdentifier(resString, "string", packageName); - - if (resIdVariation == 0) { - // Since this class must not log to slf4j, we use plain android.util.Log - Log.i(TAG, "Missing variation string: " + resString + "_" + variation); - return getString(resIdNormal); - } else { - return getString(resIdVariation); - } - } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AboutActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AboutActivity.java index 18ba47446..56a7ae3b9 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AboutActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AboutActivity.java @@ -20,30 +20,17 @@ package nodomain.freeyourgadget.gadgetbridge.activities; import android.os.Bundle; import android.text.method.LinkMovementMethod; import android.widget.TextView; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import nodomain.freeyourgadget.gadgetbridge.BuildConfig; -import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.R; public class AboutActivity extends AbstractGBActivity { - private static final Logger LOG = LoggerFactory.getLogger(ConfigureAlarms.class); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); TextView about_version = findViewById(R.id.about_version); - TextView about_title = findViewById(R.id.about_title); - TextView about_description = findViewById(R.id.about_description); - - setTitle(GBApplication.app().getStringResourceByVariantName("about_activity_title")); - about_title.setText(GBApplication.app().getStringResourceByVariantName("about_activity_title")); - about_description.setText(GBApplication.app().getStringResourceByVariantName("about_description")); - TextView about_hash = findViewById(R.id.about_hash); String versionName = BuildConfig.VERSION_NAME; String versionHASH = BuildConfig.GIT_HASH_SHORT; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractGBActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractGBActivity.java index ba96aaa15..8d0ea2d51 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractGBActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractGBActivity.java @@ -28,8 +28,6 @@ import java.util.Locale; import androidx.appcompat.app.AppCompatActivity; import androidx.localbroadcastmanager.content.LocalBroadcastManager; - -import nodomain.freeyourgadget.gadgetbridge.BuildConfig; import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.util.AndroidUtils; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java index 893813238..e63c4d23e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/ControlCenterv2.java @@ -151,7 +151,6 @@ public class ControlCenterv2 extends AppCompatActivity setContentView(R.layout.activity_controlcenterv2); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); - setTitle(GBApplication.app().getStringResourceByVariantName("title_activity_controlcenter")); DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java index 260f8e803..a9f7ddfa6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java @@ -666,7 +666,7 @@ public class DeviceCommunicationService extends Service implements SharedPrefere private void start() { if (!mStarted) { GB.createNotificationChannels(this); - startForeground(GB.NOTIFICATION_ID, GB.createNotification(GBApplication.app().getStringResourceByVariantName("gadgetbridge_running"), this)); + startForeground(GB.NOTIFICATION_ID, GB.createNotification(getString(R.string.gadgetbridge_running), this)); mStarted = true; } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9bebbd325..b4c78e916 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,10 +1,10 @@ - Gadgetbridge - Gadgetbridge - About Gadgetbridge - Cloudless copylefted libre replacement for closed source Android gadget apps from vendors. - Gadgetbridge running + Gadgetbridge + Gadgetbridge + About Gadgetbridge + Cloudless copylefted libre replacement for closed source Android gadget apps from vendors. + Gadgetbridge running Bangle.js Gadgetbridge Bangle.js Gadgetbridge From 8a2a03ecd34b8c7134706fb780367d65ebf6d879 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Tue, 26 Apr 2022 15:29:05 +0100 Subject: [PATCH 31/31] Update strings for app_name/etc to '_generic' values to allow differently named apps - https://codeberg.org/Freeyourgadget/Gadgetbridge/issues/2627 --- app/src/main/res/values-bg/strings.xml | 6 +++--- app/src/main/res/values-ca/strings.xml | 10 +++++----- app/src/main/res/values-cs/strings.xml | 10 +++++----- app/src/main/res/values-de/strings.xml | 10 +++++----- app/src/main/res/values-el/strings.xml | 10 +++++----- app/src/main/res/values-en-rGB/strings.xml | 10 +++++----- app/src/main/res/values-es/strings.xml | 10 +++++----- app/src/main/res/values-et/strings.xml | 10 +++++----- app/src/main/res/values-fa/strings.xml | 4 ++-- app/src/main/res/values-fi/strings.xml | 6 +++--- app/src/main/res/values-fr-rCA/strings.xml | 6 +++--- app/src/main/res/values-fr/strings.xml | 10 +++++----- app/src/main/res/values-gl/strings.xml | 6 +++--- app/src/main/res/values-he/strings.xml | 10 +++++----- app/src/main/res/values-hr/strings.xml | 10 +++++----- app/src/main/res/values-hu/strings.xml | 6 +++--- app/src/main/res/values-id/strings.xml | 6 +++--- app/src/main/res/values-it/strings.xml | 10 +++++----- app/src/main/res/values-ja/strings.xml | 8 ++++---- app/src/main/res/values-ka/strings.xml | 4 ++-- app/src/main/res/values-ko/strings.xml | 6 +++--- app/src/main/res/values-lt/strings.xml | 6 +++--- app/src/main/res/values-ml/strings.xml | 4 ++-- app/src/main/res/values-my/strings.xml | 4 ++-- app/src/main/res/values-nb-rNO/strings.xml | 10 +++++----- app/src/main/res/values-nl/strings.xml | 10 +++++----- app/src/main/res/values-pl/strings.xml | 10 +++++----- app/src/main/res/values-pt-rBR/strings.xml | 10 +++++----- app/src/main/res/values-pt/strings.xml | 10 +++++----- app/src/main/res/values-ro/strings.xml | 4 ++-- app/src/main/res/values-ru/strings.xml | 10 +++++----- app/src/main/res/values-sk/strings.xml | 6 +++--- app/src/main/res/values-sv/strings.xml | 4 ++-- app/src/main/res/values-tr/strings.xml | 10 +++++----- app/src/main/res/values-uk/strings.xml | 10 +++++----- app/src/main/res/values-vi/strings.xml | 6 +++--- app/src/main/res/values-zh-rCN/strings.xml | 10 +++++----- app/src/main/res/values-zh-rTW/strings.xml | 10 +++++----- 38 files changed, 151 insertions(+), 151 deletions(-) diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index e74f26fca..2976c5371 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -17,8 +17,8 @@ Обхват на Графиката Обхвата е Месец Обхвата е Седмица - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Настройки Дебъгване Изход @@ -228,7 +228,7 @@ Докоснете свързаното устройство за вибрации Докоснете устройство за свързване Не може да се установи връзка. Грешен Bluetooth адрес\? - Gadgetbridge работи + Gadgetbridge работи Инсталиране на двоичен файл %1$d/%2$d Инсталацията пропадна Инсталирано diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index dfd01fa43..242f20e44 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Configuració Depuració Surt @@ -174,7 +174,7 @@ Toca l\'aparell per fer-lo vibrar Toca un aparell per connectar-hi No es pot connectar. Potser la direcció Bluetooth és incorrecta\? - El Gadgetbridge està funcionant + El Gadgetbridge està funcionant S\'està instal·lant el binari %1$d/%2$d La instal·lació ha fallat Instal·lat @@ -908,7 +908,7 @@ Support d\'aparell addicional Col·laboradors Equip principal (en ordre de primera contribució de codi) - Substitut lliure, copyleft i sense núvol per a les aplicacions Android de codi tancat dels fabricants dels aparells. + Substitut lliure, copyleft i sense núvol per a les aplicacions Android de codi tancat dels fabricants dels aparells. No molestis SpO2 PAI @@ -995,7 +995,7 @@ ES REQUEREIX CLAU La ubicació ha d\'estar activada Enllaços - Quant a Gadgetbridge + Quant a Gadgetbridge Versió %s Quant a Última notificació diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 507730638..4b382a539 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Nastavení Ladění Ukončit @@ -154,7 +154,7 @@ Dotkněte se zařízení pro vibrace Dotkněte se zařízení pro připojení Nelze připojit. Je BT adresa v pořádku? - Gadgetbridge běží + Gadgetbridge běží Instaluji soubor %1$d/%2$d Instalace selhala Instalace úspěšná @@ -915,8 +915,8 @@ Podpora dalších zařízení Přispěvatelé Centrální tým (v pořadí příspěvku prvního kódu) - Svobodná a lokální náhrada za uzavřenou aplikaci vašich hodinek/náramku. - O aplikaci Gadgetbridge + Svobodná a lokální náhrada za uzavřenou aplikaci vašich hodinek/náramku. + O aplikaci Gadgetbridge O aplikaci Světový Čas Použito s poskytovatelem počasí LineageOS. Ostatní verze Androidu vyžadují \"Weather Notification\" app. Více informací naleznete na Gadgetbridge wiki. diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index c7a592dad..bf3117e66 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Einstellungen Debug Beenden @@ -161,7 +161,7 @@ Tippe auf das verbundene Gerät, um es vibrieren zu lassen Tippe auf ein Gerät, um eine Verbindung herzustellen Keine Verbindung möglich. Bluetooth-Adresse ungültig\? - Gadgetbridge läuft + Gadgetbridge läuft Binärdatei %1$d/%2$d wird installiert Installation fehlgeschlagen Installiert @@ -923,8 +923,8 @@ Unterstützung zusätzlicher Geräte Beitragende Kernteam (Reihenfolge der ersten Mitwirkung am Code) - Cloudloser freier Ersatz für proprietäre Android-Gadget-Apps der Hersteller. - Über Gadgetbridge + Cloudloser freier Ersatz für proprietäre Android-Gadget-Apps der Hersteller. + Über Gadgetbridge Über Wird für den LineageOS Wetterdienst genutzt, andere Android-Versionen müssen eine Anwendung wie Weather notification nutzen. Mehr Informationen gibt es im Gadgetbride-Wiki. Weltzeituhr diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index cd82ac718..e4c50f513 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Ρυθμίσεις Αποσφαλμάτωση Έξοδος @@ -174,7 +174,7 @@ Πατήστε τη συνδεδεμένη συσκευή για δόνηση Πατήστε μία συσκευή για να συνδεθεί Δεν μπορεί να γίνει σύνδεση. Μήπως δεν είναι έγκυρη η διεύθυνση Bluetooth; - Το Gadgetbridge εκτελείται + Το Gadgetbridge εκτελείται Γίνεται εγκατάσταση των βιβλιοθηκών %1$d/%2$d Η εγκατάσταση απέτυχε Εγκατεστημένο @@ -901,8 +901,8 @@ Πρόσθετη υποστήριξη συσκευών Συντελεστές Βασική ομάδα (κατά σειρά μεγαλύτερης συνεισφοράς κώδικα) - Μια δωρεάν, ελεύθερου κώδικα και χωρίς πρόσβαση στο διαδίκτυο εφαρμογή Android για να αντικαταστήσει τις υπάρχουσες εφαρμογές κλειστού κώδικα των κατασκευαστών του smartwatch σας. - Σχετικά με το Gadgetbridge + Μια δωρεάν, ελεύθερου κώδικα και χωρίς πρόσβαση στο διαδίκτυο εφαρμογή Android για να αντικαταστήσει τις υπάρχουσες εφαρμογές κλειστού κώδικα των κατασκευαστών του smartwatch σας. + Σχετικά με το Gadgetbridge Σχετικά Παγκόσμιο Ρολόι Amazfit T-Rex diff --git a/app/src/main/res/values-en-rGB/strings.xml b/app/src/main/res/values-en-rGB/strings.xml index 401143723..953d8f9e2 100644 --- a/app/src/main/res/values-en-rGB/strings.xml +++ b/app/src/main/res/values-en-rGB/strings.xml @@ -684,7 +684,7 @@ Installed Installation failed Installing binary %1$d/%2$d - Gadgetbridge running + Gadgetbridge running Cannot connect. Bluetooth address invalid\? Tap a device to connect Tap connected device for vibration @@ -853,8 +853,8 @@ Quit Debug Settings - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Save raw activity files Workout Event Reminder @@ -1124,7 +1124,7 @@ Statistics Upper Button short Upper Button double - About Gadgetbridge + About Gadgetbridge GPX file(s) received: Some file(s) already exist. Overwrite\? Many thanks to all unlisted contributors for contributing code, translations, support, ideas, motivation, bug reports, money… ✊ @@ -1276,7 +1276,7 @@ Temperature Version %s About - Cloudless copylefted libre replacement for closed source Android gadget apps from vendors. + Cloudless copylefted libre replacement for closed source Android gadget apps from vendors. 30 days Time period Already bonded diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 3cba4fce6..f0f86007f 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Configuración Depuración Salir @@ -161,7 +161,7 @@ Toque el dispositivo conectado para la vibración Toca un dispositivo para conectarlo No se puede conectar. ¿Dirección BT incorrecta? - Gadgetbridge funcionando + Gadgetbridge funcionando Instalando binario %1$d/%2$d Instalación fallida Instalado @@ -1093,8 +1093,8 @@ Soporte de dispositivos adicionales Colaboradores Equipo principal (por orden de primera contribución de código) - Sustitución sin nube y con copyleft de las aplicaciones de código cerrado para Android de los proveedores. - Acerca de Gadgetbridge + Sustitución sin nube y con copyleft de las aplicaciones de código cerrado para Android de los proveedores. + Acerca de Gadgetbridge Versión %s Acerca de Última notificación diff --git a/app/src/main/res/values-et/strings.xml b/app/src/main/res/values-et/strings.xml index c1dcfc880..d271cdd78 100644 --- a/app/src/main/res/values-et/strings.xml +++ b/app/src/main/res/values-et/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Seaded Silumine Välju @@ -243,7 +243,7 @@ Puuduta ühendatud seadet värina tekitamiseks Puuduta seadet, et ühendada Ei saa ühendust. Vigane bluetooth aadress\? - Gadgetbridge töötab + Gadgetbridge töötab Binaarfaili %1$d/%2$d paigaldamine Paigaldamine nurjus Paigaldatud @@ -746,8 +746,8 @@ Täiendavate seadmete tugi Kaasaaitajad Tuumiktiim (järjestatud esimese koodirea kuupäeva järgi) - Tasuta ja pilvevaba asendus teie kantavate nutiseadmete tootjate rakendustele. - Gadgetbridge\'ist + Tasuta ja pilvevaba asendus teie kantavate nutiseadmete tootjate rakendustele. + Gadgetbridge\'ist Rakendusest Alumine nupp Keskmine nupp diff --git a/app/src/main/res/values-fa/strings.xml b/app/src/main/res/values-fa/strings.xml index 6c9da732f..2fcd9211d 100644 --- a/app/src/main/res/values-fa/strings.xml +++ b/app/src/main/res/values-fa/strings.xml @@ -1,7 +1,7 @@ - گجت‌بریج - گجت‌بریج + گجت‌بریج + گجت‌بریج تنظیمات اشکال‌زدایی خروج diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index f2c7af838..820f5adff 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -3,8 +3,8 @@ Asetukset Synkronoi Löydä kadonnut laite - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Lopeta Lahjoita Ota ruutukaappaus @@ -447,7 +447,7 @@ Askeleiden historia Kokonaisaskeleet Tietoja - Tietoja Gadgetbridgestä + Tietoja Gadgetbridgestä Alkaen Päättyen Vastaamatta jääneen puhelun ilmoitus diff --git a/app/src/main/res/values-fr-rCA/strings.xml b/app/src/main/res/values-fr-rCA/strings.xml index b93cfdd6c..d588a524f 100644 --- a/app/src/main/res/values-fr-rCA/strings.xml +++ b/app/src/main/res/values-fr-rCA/strings.xml @@ -129,8 +129,8 @@ Calories Vibration Long - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge %d heure %d heures @@ -697,7 +697,7 @@ Installé Échec de l\'installation Installation du binaire %1$d/%2$d - Gadgetbridge est en fonctionnement + Gadgetbridge est en fonctionnement Tapez sur le périphérique pour le connecter Cliquez sur connecter pour envoyer une vibration Cliquez sur l\'appareil pour ouvrir le gestionnaire d’activité diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 6e3c5c682..1eeb6039f 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Paramètres Déboguer Quitter @@ -161,7 +161,7 @@ Cliquez sur connecter pour envoyer une vibration Tapez sur le périphérique pour le connecter Connexion impossible. L’adresse Bluetooth est-elle valide ? - Gadgetbridge est en fonctionnement + Gadgetbridge est en fonctionnement Installation du binaire %1$d/%2$d Échec de l\'installation Installé @@ -1017,8 +1017,8 @@ Temps de sommeil préféré en heures Support d\'appareil supplémentaire Contributeurs Équipe principal (dans l\'ordre de la première contribution au code) - Un remplaçant libre et sans cloud aux applications Android propriétaires des fabricants de vos bracelets. - A propos de Gadgetbridge + Un remplaçant libre et sans cloud aux applications Android propriétaires des fabricants de vos bracelets. + A propos de Gadgetbridge A propos Horloge mondiale Stress diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 2947c1049..ae765d3aa 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Axustes Depuración Saír @@ -143,7 +143,7 @@ Toque nun dispositivo conectado para facelo Vibrar Toque nun dispositivo para conectar Non foi posíbel conectar. Enderezo Bluetooth inválido? - Gadgetbridge en execución + Gadgetbridge en execución Instalando binario %1$d/%2$d Fallou a instalación Instalado diff --git a/app/src/main/res/values-he/strings.xml b/app/src/main/res/values-he/strings.xml index 9fe7ad229..b6c614675 100644 --- a/app/src/main/res/values-he/strings.xml +++ b/app/src/main/res/values-he/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge הגדרות ניפוי שגיאות יציאה @@ -147,7 +147,7 @@ נקישה על ההתקן המחובר לרטט יש לגעת בהתקן כדי להתחבר לא ניתן להתחבר. כתובת ה־Bluetooth שגויה? - Gadgetbridge פעיל + Gadgetbridge פעיל התקנת הבינרי %1$d/%2$d ההתקנה נכשלה ההתקנה הצליחה @@ -913,8 +913,8 @@ תמיכה במכשירים נוספים תורמים צוות הליבה (מסודרים לפי מועד תרומת הקוד הראשונה) - חלופה חופשית ונטולת ענן ליישומוני ה־Android לחפיצים עם הקוד הסגור של היצרנים. - על אודות Gadgetbridge + חלופה חופשית ונטולת ענן ליישומוני ה־Android לחפיצים עם הקוד הסגור של היצרנים. + על אודות Gadgetbridge על אודות משמש לספק מזג האוויר של LineageOS, גרסאות אחרות של Android צריכות להשתמש ביישומונים כמו „התראות מזג אוויר”. אפשר למצוא מידע נוסף בוויקי של Gadgetbridge. שעון עולמי diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 711a0edb3..09e10ad4f 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -1,6 +1,6 @@ - Gadgetbridge + Gadgetbridge Muško Žensko Ostalo @@ -28,7 +28,7 @@ Postavi pseudonim Izlaz Debug - Gadgetbridge + Gadgetbridge Stvarno izbrisati staru bazu podataka aktivnosti\? Podaci aktivnosti koji nisu uvezeni će se izgubiti. Izbrisati staru bazu podataka aktivnosti\? Podaci izbrisani. @@ -1268,8 +1268,8 @@ Dodaj widget Postavljanje alarma za %1$02d:%2$02d Verzija %s - O Gadgetbridge - Zamjena za libre bez oblaka bez kopiranja za zatvorene aplikacije za Android gadgete od dobavljača. + O Gadgetbridge + Zamjena za libre bez oblaka bez kopiranja za zatvorene aplikacije za Android gadgete od dobavljača. Osnovni tim (po redoslijedu doprinosa prvog koda) Konfiguracija izgleda sata Promjena pozadinske slike @@ -1358,7 +1358,7 @@ \n \n \n Ovaj firmware je za HW reviziju: %s - Gadgetbridge je pokrenut + Gadgetbridge je pokrenut Dodirnite uređaj za povezivanje Test Nije povezano diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index d9cf5a1f6..36b660a49 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Beállítások Hibakeresés Kilépés @@ -157,7 +157,7 @@ Koppints az eszközre a rezgetéshez. Koppints az eszközre a csatlakozáshoz Nem lehet csatlakozni. Rossz Bluetooth cím? - A Gadgetbridge fut + A Gadgetbridge fut %1$d/%2$d bináris telepítése Sikertelen telepítés Telepítve diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index dd7f06e40..2f9a12290 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Pengaturan Keluar Donasi @@ -175,7 +175,7 @@ Kalori Penerima GPX Gadgetbridge Lokasi harus diaktifkan - Tentang Gadgetbridge + Tentang Gadgetbridge Versi %s Tentang Tautan diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index f6ab2f1c9..d7877fe9e 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Impostazioni Debug Esci @@ -158,7 +158,7 @@ Tocca il dispositivo connesso per la vibrazione tocca il dispositivo a cui connettersi Impossibile connettersi. Indirizzo Bluetooth non valido? - Gadgetbridge in esecuzione + Gadgetbridge in esecuzione Installazione del binario %1$d/%2$d Installazione fallita Installazione conclusa con successo @@ -884,8 +884,8 @@ Supporto a dispositivi aggiuntivi Contributori Team principale (ordinati in base al primo contributo di codice) - Un\'alternativa gratuita, libera e senza cloud alle applicazioni Android a sorgente chiusa del tuo dispositivo. - Su Gadgetbridge + Un\'alternativa gratuita, libera e senza cloud alle applicazioni Android a sorgente chiusa del tuo dispositivo. + Su Gadgetbridge Informazioni Ultima notifica Salva i dati raw (grezzi) delle attività diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 90f5245de..2e8deca6e 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -1,7 +1,7 @@ - ガジェットブリッジ - ガジェットブリッジ + ガジェットブリッジ + ガジェットブリッジ 設定 デバッグ 終了 @@ -161,7 +161,7 @@ バイブレーションの接続されたデバイスをタップ 接続するデバイスをタップ 接続できません。 Bluetoothアドレスが無効ですか\? - ガジェットブリッジは実行中 + ガジェットブリッジは実行中 バイナリーのインストール中 %1$d/%2$d インストールに失敗しました インストールに成功しました @@ -708,7 +708,7 @@ 距離 キーが必要です 貢献者 - Gadgetbridgeについて + Gadgetbridgeについて について 最終通知 通勤 diff --git a/app/src/main/res/values-ka/strings.xml b/app/src/main/res/values-ka/strings.xml index b55601dd1..43984c98e 100644 --- a/app/src/main/res/values-ka/strings.xml +++ b/app/src/main/res/values-ka/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge პარამეტრები შეწყვეტა დონაცია diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 35e2abd47..7afd8b2d9 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -1,7 +1,7 @@ - 가젯브릿지 - 가젯브릿지 + 가젯브릿지 + 가젯브릿지 설정 디버그 종료 @@ -77,7 +77,7 @@ 연결된 기기를 선택해 앱 관리자 실행 기기를 선택해 연결 연결할 수 없습니다. 블루투스 주소가 올바르지 않은 것 같습니다\? - 가젯브릿지 실행중 + 가젯브릿지 실행중 바이너리 설치중: %1$d/%2$d 설치 실패 설치됨 diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index f466c9a57..3180dafc8 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Nustatymai Šalinti riktus Išeiti @@ -167,7 +167,7 @@ Bluetooth nepalaikomas. Bluetooth išjungtas. Bagstelėkite įrenginį, kad prisijungtumėte - Gadgetbridge paleistas + Gadgetbridge paleistas Instaluota Įrenginio paieška Stabdyti skenavimą diff --git a/app/src/main/res/values-ml/strings.xml b/app/src/main/res/values-ml/strings.xml index 692c26523..7e0dca922 100644 --- a/app/src/main/res/values-ml/strings.xml +++ b/app/src/main/res/values-ml/strings.xml @@ -78,8 +78,8 @@ പുറത്തു കടക്കുക തെറ്റുകൾ തിരുത്തുക ക്രമീകരണങ്ങൾ - ഗാഡ്ജക്‌റ്റ് ബ്രിഡ്ജ് - ഗാഡ്ജക്‌റ്റ് ബ്രിഡ്ജ് + ഗാഡ്ജക്‌റ്റ് ബ്രിഡ്ജ് + ഗാഡ്ജക്‌റ്റ് ബ്രിഡ്ജ് ബാൻഡിൽ വൈബ്രേഷന്റെ കുറഞ്ഞ തീവ്രത പ്രവർത്തനക്ഷമമാക്കുക പവർ സേവിംഗ് മോഡ് ഹൃദയമിടിപ്പിന്റെ ആനുകാലിക യാന്ത്രിക അളവ് ഓഫുചെയ്യുന്നത് പ്രവർത്തന സമയം വർദ്ധിപ്പിക്കുന്നു ഇൻസ്റ്റാൾ ചെയ്ത അലാറത്തിന് മുമ്പുള്ള ഇടവേളയാണ് സ്മാർട്ട് അലാറം ഇടവേള. ഈ ഇടവേള ഉപകരണം ഉപയോക്താവിനെ ഉണർത്താൻ ഉറക്കത്തിന്റെ ഭാരം കുറഞ്ഞ ഘട്ടം കണ്ടെത്താൻ ശ്രമിക്കുന്നു diff --git a/app/src/main/res/values-my/strings.xml b/app/src/main/res/values-my/strings.xml index 4caf4bc91..6b15aa624 100644 --- a/app/src/main/res/values-my/strings.xml +++ b/app/src/main/res/values-my/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge ခ်ိန္ညွိရန္ ျပစ္ခ်က္ ထြက္မည္ diff --git a/app/src/main/res/values-nb-rNO/strings.xml b/app/src/main/res/values-nb-rNO/strings.xml index 89b097f23..f035c80c7 100644 --- a/app/src/main/res/values-nb-rNO/strings.xml +++ b/app/src/main/res/values-nb-rNO/strings.xml @@ -39,8 +39,8 @@ Svartelistede kalendere Fastvare-/program-installerer Du er i ferd med å installere %s. - Gadgetbru - Gadgetbru + Gadgetbru + Gadgetbru Dette vil slette enheten og all tilknyttet data! Du er i ferd med å installere %s-fastvaren på din Amazfit Bip. \n @@ -165,7 +165,7 @@ Trykk på tilkoblet enhet for vibrasjon Trykk på en enhet for å koble til Kan ikke koble til. Ugyldig Blåtannsadresse? - Gadgetbro kjører + Gadgetbro kjører Installerer binærfil %1$d/%2$d Installasjon mislyktes Installert @@ -902,7 +902,7 @@ Klarte ikke å starte bakgrunnstjeneste Ytterligere enhetsstøtte Bidragsytere - Om Gadgetbridge + Om Gadgetbridge Om Verdensklokke Stress @@ -1034,7 +1034,7 @@ Aktiver lav vibrasjonsintensitet på båndet Strømsparingsmodus slår av periodisk automatisk måling av hjertefrekvensen og øker dermed arbeidstiden Smart alarmintervall er intervall før installert alarm. I dette intervallet prøver enheten å oppdage den letteste søvnfasen for å våkne brukeren - Skyfri, gemenhetslig fri erstatning for den lukkede motsatsen for dine Android-slaveenheter. + Skyfri, gemenhetslig fri erstatning for den lukkede motsatsen for dine Android-slaveenheter. Sjekk og forespør tilganger selv om de ikke trengs umiddelbart. Skru av dette kun hvis enhetene dine ikke støtter noen av disse funksjonene. Å ikke innvilge tilganger kan forårsake problemer! Skrur på slaveenhets-API (funker kun på Android 8 og høyere, og tilknytningen må settes opp på ny med Gadgetbro), noe som øker påliteligheten hvis tjenester må startes på ny i bakgrunnen Advarsel: Kunne ikke sjekke versjonsinfo! Du bør ikke fortsette og versjonsnavnet «%s» ble sett. diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 7acb91769..0867fe1a0 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Instellingen Debug Sluit af @@ -185,7 +185,7 @@ Tap op het verbonden apparaat voor vibratie Tap op een apparaat om te verbinden Kan niet verbinden. Is het Bluetooth adres ongeldig? - Gadgetbridge loopt + Gadgetbridge loopt Binary installeren %1$d/%2$d Installatie gefaald Geïnstalleerd @@ -914,8 +914,8 @@ Extra apparaatondersteuning Bijdragers Kernteam (in volgorde van eerste codebijdrage) - Cloudloze vrije vervanging voor de gesloten Android-applicaties van gadgetfabrikanten. - Over Gadgetbridge + Cloudloze vrije vervanging voor de gesloten Android-applicaties van gadgetfabrikanten. + Over Gadgetbridge Over Gebruikt voor de LineageOS-weeraanbieder, andere Android versies moeten een app zoals \"Weather notification\" gebruiken. Meer informatie is te vinden in de Gadgetbridge wiki. Wereld Klok diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index bed0b2fe6..00bd6f24f 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Ustawienia Debuguj Wyjdź @@ -108,7 +108,7 @@ Kliknij połączone urządzenie, aby uruchomić menadżer aplikacji Dotknij urządzenie aby połączyć Nie można połączyć. Nieprawidłowy adres Bluetooth\? - Gadgetbridge działa + Gadgetbridge działa Instalowanie binarki %1$d/%2$d Instalacja nie powiodła się Zainstalowano @@ -913,7 +913,7 @@ Ostatnie powiadomienie Ustaw własną nazwę Współtwórcy - O Gadgetbridge + O Gadgetbridge Amazfit T-Rex Styl grzbietowy Styl dowolny @@ -1031,7 +1031,7 @@ Linki Dziękujemy wszystkim nie notowanym na liście współtwórcom za udostępnienie kodu, tłumaczenia, wsparcie, pomysły, motywację, zgłoszenia błędów, pieniądze… ✊ Zespół główny (w kolejności od pierwszego wkładu w kod aplikacji) - Wolny od chmury zamiennik dla aplikacji o zamkniętym kodzie źródłowym dostarczanych przez producentów gadżetów dla systemu Android. + Wolny od chmury zamiennik dla aplikacji o zamkniętym kodzie źródłowym dostarczanych przez producentów gadżetów dla systemu Android. Edytuj etykietę Ping-pong Krykiet diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index a411025d3..d42561908 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Configurações Depurar Sair @@ -148,7 +148,7 @@ Toque no dispositivo conectado para vibração Toque num dispositivo para ligar Não foi possível conectar. Endereço de Bluetooth inválido\? - Gadgetbridge em execução + Gadgetbridge em execução Instalando binário %1$d/%2$d Instalação falhou Instalado @@ -920,8 +920,8 @@ Suporte a dispositivos adicionais Contribuidores Equipe Core (na ordem da primeira contribuição de código) - Um substituto livre, protegido por copyleft, sem acesso a nuvem para os aplicativos Android de código fechado dos fornecedores de gadgets. - Sobre o Gadgetbridge + Um substituto livre, protegido por copyleft, sem acesso a nuvem para os aplicativos Android de código fechado dos fornecedores de gadgets. + Sobre o Gadgetbridge Sobre Usado para o provedor do clima do LineageOS, outras versões do Android precisam usar um aplicativo como o \"Notificação de clima\". Encontrará mais informações no wiki do Gadgetbridge. Relógio mundial diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 74efd9cd1..d26dbd7aa 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Definições Depurar Sair @@ -156,7 +156,7 @@ Toque no aparelho ligado para o fazer vibrar Toque num aparelho para ligar Não foi possível conectar. Endereço de Bluetooth inválido\? - Gadgetbridge a executar + Gadgetbridge a executar Instalando binário %1$d/%2$d A instalação falhou Instalado @@ -573,8 +573,8 @@ Suporte a aparelhos adicionais Contribuidores Equipa Core (na ordem da primeira contribuição de código) - Um substituto livre, protegido por copyleft, sem acesso a nuvem para as apps Android de código fechado dos fornecedores de gadgets. - Sobre o Gadgetbridge + Um substituto livre, protegido por copyleft, sem acesso a nuvem para as apps Android de código fechado dos fornecedores de gadgets. + Sobre o Gadgetbridge Sobre Está prestes a instalar o firmware %s no seu Amazit T-Rex. \n diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index a05411b86..a12113c8a 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Setari Depaneaza Iesire diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index a6c394052..1d606ba1d 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Настройки Отладка Выйти @@ -157,7 +157,7 @@ Коснитесь подключённого устройства для Вибрации Коснитесь устройства для соединения Не удалось соединиться. Неверный адрес Bluetooth\? - Gadgetbridge запущен + Gadgetbridge запущен установка бинарного файла %1$d/%2$d Установка не удалась Установлено @@ -848,8 +848,8 @@ Дополнительная поддержка устройств Соавторы Основная команда (в порядке поступления первого кода) - \"Безоблачная\" свободная альтернатива закрытым приложениям от производителей гаджетов. - О Gadgetbridge + \"Безоблачная\" свободная альтернатива закрытым приложениям от производителей гаджетов. + О Gadgetbridge О программе Последнее уведомление Сохранять необработанные файлы активности diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 8cff0a970..ec6aba113 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Nastavenia Ladenie Ukončiť @@ -180,7 +180,7 @@ Dotknite sa pripojeného zariadenia pre vibrácie Dotknite sa pripojeného zariadenia pre pripojenie Nie je možné pripojiť. Je BT adresa v poriadku? - Gadgetbridge je spustený + Gadgetbridge je spustený Instalujem binárny súbor %1$d/%2$d Inštalácia zlyhala Inštalácia bola úspešná diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 6a8f73ae5..47dea915a 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Inställningar Avsluta Donera diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 3a2ab4b7b..9bafbe118 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -88,7 +88,7 @@ \nSürüm %2$s, %3$s tarafından \n Yukarı taşı - Gadgetbridge + Gadgetbridge Kur Pebble uygulama mağazasında ara Önbellekteki uygulamalar @@ -314,7 +314,7 @@ Dosya kurulamıyor, aygıt hazır değil. Aygıta bağlantı: %1$s Bu ürün yazılımı bu aygıtla uyumlu değil - Gadgetbridge çalışıyor + Gadgetbridge çalışıyor Almanca Kalp ritmi Yatay @@ -754,7 +754,7 @@ Uygulama Yöneticisi Kara Listeye Alınan Takvimler Etkinlik ve Uyku - Gadgetbridge + Gadgetbridge Veri yönetimi Hata Ayıklama Aygıta özel ayarlar @@ -937,8 +937,8 @@ Ek aygıt desteği Katkıda bulunanlar Çekirdek Ekip (ilk kod katkıda bulunma sırasına göre) - Satıcıların kapalı kaynaklı Android aygıt uygulamalarının yerine bulut gerektirmeyen copyleft özgür alternatif. - Gadgetbridge hakkında + Satıcıların kapalı kaynaklı Android aygıt uygulamalarının yerine bulut gerektirmeyen copyleft özgür alternatif. + Gadgetbridge hakkında Hakkında LineageOS hava durumu sağlayıcısı için kullanılır, diğer Android sürümleri \"Weather notification\" gibi bir uygulama kullanmalıdır. Gadgetbridge wiki sayfasında daha fazla bilgi bulabilirsiniz. Dünya Saati diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 1b8d399aa..814a11ce0 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Налаштування Зневадження Вийти @@ -98,7 +98,7 @@ Bluetooth не підтримується. Bluetooth вимкнуто. Не вдалося з\'єднатися. Неправильна Bluetooth адреса\? - Gadgetbridge запущено + Gadgetbridge запущено Встановлення двійкового файлу %1$d/%2$d Невдале встановлення Встановлено @@ -1022,8 +1022,8 @@ Підтримка додаткових пристроїв Співавтори Основна команда (впорядковано за датою допомоги) - Незалежний від хмари, вільний замінник закритих застосунків від інших виробників. - Про Gadgetbridge + Незалежний від хмари, вільний замінник закритих застосунків від інших виробників. + Про Gadgetbridge Про застосунок Останнє сповіщення Світовий час diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 3e852602c..fbd33c430 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge Cài đặt Dò lỗi Thoát @@ -49,7 +49,7 @@ Không hỗ trợ Bluetooth. Đã tắt Bluetooth. Không thể kết nối. Địa chỉ Bluetooth không hợp lệ\? - Gadgetbridge đang chạy + Gadgetbridge đang chạy Đang cài tệp nhị phân %1$d/%2$d Cài đặt thất bại Đã cài đặt diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index ea6d5dcdf..3746eaf0d 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1,7 +1,7 @@ - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge 设置 调试 退出 @@ -166,7 +166,7 @@ 点按以震动已连接的设备 点按一个设备以连接 无法连接。 蓝牙地址无效? - Gadgetbridge 正在运行 + Gadgetbridge 正在运行 正在安装二进制文件 %1$d/%2$d 安装失败 安装成功 @@ -917,8 +917,8 @@ 额外设备支持 贡献者 核心成员 (以第一次提交代码排序) - 用于替代原厂手环应用的脱机无版权自由应用。 - 关于 Gadgetbridge + 用于替代原厂手环应用的脱机无版权自由应用。 + 关于 Gadgetbridge 关于 由LineageOS天气服务提供,其他版本的Android系统需要使用诸如“Weather notification”。更多信息请访问 Gadgetbridge 的Wiki。 世界时钟 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 1c761d590..132683fe5 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -26,8 +26,8 @@ 刪除並清除緩存 重新安裝 nodomain.freeyourgadget.gadgetbridge.ButtonPressed - Gadgetbridge - Gadgetbridge + Gadgetbridge + Gadgetbridge 連接中… 截取設備的屏幕截圖 校正設備 @@ -524,7 +524,7 @@ 配對您的小米手環 配對裝置 初始化完成 - Gadgetbridge 正在執行 + Gadgetbridge 正在執行 點擊一個裝置以進行連線 藍芽不支援。 涵蓋活動與未活動時消耗的卡路里 @@ -583,8 +583,8 @@ 額外裝置支援 貢獻者 核心團隊(按第一次程式碼貢獻順序排列) - 用來取代廠商提供的閉源 Android 小裝置應用程式的離線且版權自由的替代品。 - 關於 Gadgetbridge + 用來取代廠商提供的閉源 Android 小裝置應用程式的離線且版權自由的替代品。 + 關於 Gadgetbridge 關於 運動活動 游泳