From 5f4d3f441f5a0758c2f44f9c7c7daf48e6e2edc2 Mon Sep 17 00:00:00 2001 From: Arjan Schrijver Date: Mon, 1 Aug 2022 17:21:55 +0200 Subject: [PATCH] Fossil Hybrid HR: Add toggling of backlight with physical button event --- .../assets/fossil_hr/openSourceWatchface.bin | Bin 8326 -> 8398 bytes .../HybridHRWatchfaceDesignerActivity.java | 3 +++ .../qhybrid/HybridHRWatchfaceFactory.java | 1 + .../qhybrid/HybridHRWatchfaceSettings.java | 9 +++++++++ .../HybridHRWatchfaceSettingsActivity.java | 10 ++++++++++ .../devices/qhybrid/QHybridConstants.java | 2 +- app/src/main/res/values/arrays.xml | 4 ++-- app/src/main/res/values/strings.xml | 5 +++-- .../res/xml/fossil_hr_watchface_settings.xml | 14 +++++++++++--- external/fossil-hr-watchface | 2 +- 10 files changed, 41 insertions(+), 9 deletions(-) diff --git a/app/src/main/assets/fossil_hr/openSourceWatchface.bin b/app/src/main/assets/fossil_hr/openSourceWatchface.bin index f73d261b0ae180bdcdc4c34f89bdd5f1b5aff696..481534f58b9212ee66e2d1264bcc291a00c2111f 100644 GIT binary patch delta 2232 zcmZXWTWl0n9L9e$dpX-~TiESd*QQzP()P3^V63uesVE9e#T!;rrB*B`3@S#&QW2u7 zqKxrE#8WR2FW9JqQ9;ER!3TYE)CZ%9QR9>G!AX45#0Q^@`Ok4hWs_#N=gj$^?|lF7 z`_AlH@#Tu1HDhDz%Ggi&6mS6f{{kG&AO|eFa$nDEJ?@663aSUf9#FlY`XK6qKtt3I z!2kq<5HAF85%`NCJQLJe5D!6gHs~eb*Fc{O`aJlC zvIop2hswCFo6Y_M_&f-PP1UUy{bis=Kmq;;#OIrFx34)F2EyfLk6Wol7ecrKyo*3x z4DrPfu7q%vWk|1vU^OTY0uRDb@GdbwxD%av4FqfKa{p30C67jznJZGuJ7ij_%Ol?9 z5M3@+&0MN_(v-R~nff7Bt$S-hT?Kj!!X}G89)sv=h_3-X4)Hkn*MdJEyz3ym4%9l( zIf&PR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XO!LUA zaeC{FRwSa@qPJ&?^TI9W5PvJEZ4f*M(evQH0O1SZY=>w&guN#5Zr_#8Xc?@f)X#s> z$ie9s`RPA1n|pIHu#BBd=JRpsi>CiYk>Ves#GoId9VU}ybfQdyP$ZOWOD)S)Pfeeh z^oyFB8E2hstC(C#Y68iNw)~uIUrdxpmJ-?3x%_yms?b@TEG352)%14ehMuQl>};GE zNGhQ+_4U%(!Ar)Nq{G!th<3r{#=qiLc6S@$xvzkC6R1~BtC!{Oq`-L%)a&3VV!qBB zB1TYqjX9RcTue;T+bb`OboYVMAXSK!GNbGedUdvxzj|7P5>C(q*UwJz8yEYQ%U3KuOdB-8W^hkK^tmDK zeSwgUxrJX2a`nE7xz{3{8-8svCK*@TbXV;r>t+3Y?VZ-BeT8BA#zI@E+O!#1*{l#3 z3lY-p83@i8^4Cj1?Ga=)I{S3fh+`H10BiQQ AhyVZp diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceDesignerActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceDesignerActivity.java index 6e18fd2f5..0cdf0edd7 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceDesignerActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceDesignerActivity.java @@ -399,6 +399,9 @@ public class HybridHRWatchfaceDesignerActivity extends AbstractGBActivity implem if (watchfaceConfig.has("toggle_widgets_event")) { watchfaceSettings.setToggleWidgetsEvent(watchfaceConfig.getString("toggle_widgets_event")); } + if (watchfaceConfig.has("toggle_backlight_event")) { + watchfaceSettings.setToggleBacklightEvent(watchfaceConfig.getString("toggle_backlight_event")); + } if (watchfaceConfig.has("powersave_display")) { watchfaceSettings.setPowersaveDisplay(watchfaceConfig.getBoolean("powersave_display")); } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceFactory.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceFactory.java index 6e85ead4c..cef895c0a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceFactory.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceFactory.java @@ -302,6 +302,7 @@ public class HybridHRWatchfaceFactory { config.put("wrist_flick_move_hour", settings.getWristFlickMoveHour()); config.put("wrist_flick_move_minute", settings.getWristFlickMoveMinute()); config.put("toggle_widgets_event", settings.getToggleWidgetsEvent()); + config.put("toggle_backlight_event", settings.getToggleBacklightEvent()); config.put("powersave_display", settings.getPowersaveDisplay()); config.put("powersave_hands", settings.getPowersaveHands()); config.put("light_up_on_notification", settings.getLightUpOnNotification()); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceSettings.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceSettings.java index c11309f42..4f947e874 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceSettings.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceSettings.java @@ -26,6 +26,7 @@ public class HybridHRWatchfaceSettings implements Serializable { private int wristFlickMoveHour = 360; private int wristFlickMoveMinute = -360; private String toggleWidgetsEvent = ""; + private String toggleBacklightEvent = ""; private boolean powersaveDisplay = false; private boolean powersaveHands = false; private boolean lightUpOnNotification = false; @@ -109,6 +110,14 @@ public class HybridHRWatchfaceSettings implements Serializable { this.toggleWidgetsEvent = event; } + public String getToggleBacklightEvent() { + return toggleBacklightEvent; + } + + public void setToggleBacklightEvent(String event) { + this.toggleBacklightEvent = event; + } + public boolean getPowersaveDisplay() { return powersaveDisplay; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceSettingsActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceSettingsActivity.java index 82d3e22b9..30ffe04d8 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceSettingsActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/HybridHRWatchfaceSettingsActivity.java @@ -110,6 +110,11 @@ public class HybridHRWatchfaceSettingsActivity extends AbstractSettingsActivity toggle_widgets.setValue(settings.getToggleWidgetsEvent()); toggle_widgets.setSummary(toggle_widgets.getEntry()); + ListPreference toggle_backlight = (ListPreference) findPreference("pref_hybridhr_watchface_toggle_backlight"); + toggle_backlight.setOnPreferenceChangeListener(this); + toggle_backlight.setValue(settings.getToggleBacklightEvent()); + toggle_backlight.setSummary(toggle_backlight.getEntry()); + SwitchPreference power_saving_display = (SwitchPreference) findPreference("pref_hybridhr_watchface_power_saving_display"); power_saving_display.setOnPreferenceChangeListener(this); power_saving_display.setChecked(settings.getPowersaveDisplay()); @@ -154,6 +159,11 @@ public class HybridHRWatchfaceSettingsActivity extends AbstractSettingsActivity ((ListPreference)preference).setValue(newValue.toString()); preference.setSummary(((ListPreference)preference).getEntry()); break; + case "pref_hybridhr_watchface_toggle_backlight": + settings.setToggleBacklightEvent(newValue.toString()); + ((ListPreference)preference).setValue(newValue.toString()); + preference.setSummary(((ListPreference)preference).getEntry()); + break; case "pref_hybridhr_watchface_power_saving_display": settings.setPowersaveDisplay((boolean) newValue); break; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/QHybridConstants.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/QHybridConstants.java index 36e90b1e2..b00cd0f09 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/QHybridConstants.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/qhybrid/QHybridConstants.java @@ -20,7 +20,7 @@ import java.util.HashMap; import java.util.Map; public final class QHybridConstants { - public static final String HYBRIDHR_WATCHFACE_VERSION = "1.3"; + public static final String HYBRIDHR_WATCHFACE_VERSION = "1.4"; public static final int HYBRID_HR_WATCHFACE_WIDGET_SIZE = 76; public static Map KNOWN_WAPP_VERSIONS = new HashMap() { diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 40ced400d..85de64751 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -1824,7 +1824,7 @@ widget_bg_dashed_circle - + @string/menuitem_nothing @string/pref_title_upper_button_function_short @string/pref_title_upper_button_function_long @@ -1832,7 +1832,7 @@ @string/pref_title_lower_button_function_short @string/pref_title_lower_button_function_long - + top_short_press_release top_hold diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 387055622..7209b5a2d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1472,8 +1472,9 @@ Hour hand (-360 to 360) Minute hand (-360 to 360) Duration (in ms) - Toggle widgets - Button action + Custom events + Toggle widgets + Turn backlight on A watchface with this name already exists in the cache. Do you want to overwrite it? Upload of the watchface failed. Please try again. Battery diff --git a/app/src/main/res/xml/fossil_hr_watchface_settings.xml b/app/src/main/res/xml/fossil_hr_watchface_settings.xml index d6d47fd82..ff3bb4717 100644 --- a/app/src/main/res/xml/fossil_hr_watchface_settings.xml +++ b/app/src/main/res/xml/fossil_hr_watchface_settings.xml @@ -45,16 +45,24 @@ + android:title="@string/watchface_setting_title_custom_events"> + diff --git a/external/fossil-hr-watchface b/external/fossil-hr-watchface index 0e2551757..6b3754690 160000 --- a/external/fossil-hr-watchface +++ b/external/fossil-hr-watchface @@ -1 +1 @@ -Subproject commit 0e2551757d8c70031c2533d3d94a0f284c05ca9f +Subproject commit 6b3754690359b8ae964d73d18e607d4631e1eaf2