From 6649f1941affc74a123f6fb782a65a93c7a79a81 Mon Sep 17 00:00:00 2001 From: Arjan Schrijver Date: Thu, 7 Jul 2022 22:16:52 +0200 Subject: [PATCH] Fossil Hybrid HR: Make 2nd TZ widget clock duration configurable --- app/src/main/assets/fossil_hr/widget2ndTZ.bin | Bin 1880 -> 1934 bytes .../HybridHRWatchfaceDesignerActivity.java | 11 +++++++++++ .../qhybrid/HybridHRWatchfaceFactory.java | 1 + .../dialog_hybridhr_watchface_widget.xml | 17 +++++++++++++++++ app/src/main/res/values/strings.xml | 1 + external/fossil-hr-watchface | 2 +- 6 files changed, 31 insertions(+), 1 deletion(-) diff --git a/app/src/main/assets/fossil_hr/widget2ndTZ.bin b/app/src/main/assets/fossil_hr/widget2ndTZ.bin index 1aa07387ebeeff23a8efdc4bfcdd324b0aefb2f7..4291447f882e38f758400ec229e1bab8e2c3d2c8 100644 GIT binary patch delta 565 zcmYLFJx|+E6g{@%_#=*!mjp;bftU*XQpy+`Bve%$2x0_v=mZi1lL1kQAh9J|Hl!$X zXF3)!L>;Pjqd&ky|AGHRhn^<`z0%RW@1A?_yXXG#Z!6{fgM&{^* z$(KWK4jKX!fPxT{zgul<5eR)?^bU|_T9BA^t+W{1UFT!siVxF0ZDS~P_3rvVgqH`m z)wHt9FIMttx^6a`87Dn1aatYdwSYS!TV~GXyPf}{wt6Ib206jF#yWCIi9R4!nYUT{ znw$fS=_3ryq}Z||n29CY(n;;u{ag|rxAJ5;cE1@r{`Z}V)P8E`s;C;2ItCPXZ-}ZC zsr|z5DZUmgMW}C{1&z2N3$yNAzvagBDysKIEw&R!xGx>^?5MHDjIi)Oy*o|xp!2+? z+S)2oMFsdpWy-8FRaB|q6%|eI_1UnuMorYK^pDqhgOGY9S;8`z=bh9Y!p>7C{qw~4 zoNm2gJ)tbzAV=I084XDPA{(qM^~pOR}byt Gmi7-(^kJm{ delta 494 zcmYLFJx{_=6utfafVQ+$Feqq^%0pzN#e~60jFZ8S#LdadufUDXgmiLnX4NndU39}A z&_RCzf5O4@QpJ~?oO|y%@8#Wd?|j= 0)) { + timezoneTimeout.setText(Integer.toString(widget.getExtraConfigInt("timeout_secs", -1))); + } // Set update timeout value final LinearLayout updateTimeoutLayout = layout.findViewById(R.id.watchface_widget_update_timeout_layout); updateTimeoutLayout.setVisibility(View.GONE); @@ -593,8 +600,10 @@ public class HybridHRWatchfaceDesignerActivity extends AbstractGBActivity implem String selectedType = widgetTypesArray.get(typeSpinner.getSelectedItemPosition()); if (selectedType.equals("widget2ndTZ")) { timezoneLayout.setVisibility(View.VISIBLE); + timezoneTimeoutLayout.setVisibility(View.VISIBLE); } else { timezoneLayout.setVisibility(View.GONE); + timezoneTimeoutLayout.setVisibility(View.GONE); } if (selectedType.equals("widgetCustom")) { sizeLayout.setVisibility(View.VISIBLE); @@ -644,6 +653,7 @@ public class HybridHRWatchfaceDesignerActivity extends AbstractGBActivity implem } String selectedType = widgetTypesArray.get(typeSpinner.getSelectedItemPosition()); String selectedTZ = tzSpinner.getSelectedItem().toString(); + int selectedTZtimeout = Integer.parseInt(timezoneTimeout.getText().toString()); int selectedUpdateTimeout = 0; if (selectedType.equals("widgetCustom")) { try { @@ -661,6 +671,7 @@ public class HybridHRWatchfaceDesignerActivity extends AbstractGBActivity implem JSONObject extraConfig = new JSONObject(); try { extraConfig.put("tzName", selectedTZ); + extraConfig.put("timeout_secs", selectedTZtimeout); } catch (JSONException e) { LOG.warn("JSON error", e); } 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 eec2d3407..2c969c226 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 @@ -102,6 +102,7 @@ public class HybridHRWatchfaceFactory { data.put("tzName", widgetDesc.getExtraConfigString("tzName", null)); data.put("loc", tzShortName); data.put("utc", tzOffsetMins); + data.put("timeout_secs", widgetDesc.getExtraConfigInt("timeout_secs", 0)); widget.put("data", data); } break; diff --git a/app/src/main/res/layout/dialog_hybridhr_watchface_widget.xml b/app/src/main/res/layout/dialog_hybridhr_watchface_widget.xml index c91273ca3..dd7ee7cb4 100644 --- a/app/src/main/res/layout/dialog_hybridhr_watchface_widget.xml +++ b/app/src/main/res/layout/dialog_hybridhr_watchface_widget.xml @@ -108,6 +108,23 @@ android:layout_height="wrap_content" /> + + + + + Volume Control Custom widget Time zone: + Clock visibility duration (in seconds): Update timeout in minutes: Hide text on timeout: Show circle on timeout: diff --git a/external/fossil-hr-watchface b/external/fossil-hr-watchface index 7c46ccf89..3b35b2a0a 160000 --- a/external/fossil-hr-watchface +++ b/external/fossil-hr-watchface @@ -1 +1 @@ -Subproject commit 7c46ccf890b5e6ee30e3711c2f8ed181e4b3f0c6 +Subproject commit 3b35b2a0a6bc0e8a5262e7b61154cdf487fa94a6