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 zcmYL_KX21e6vcnG8ZPcLO=r=LM(po`Q{dcZ8&=fQZE{k)x<1}#G2U8GDkdK9x9`mRI7T@{wCZyIqw#o z1K@VermFg2P;S9`8^Ru>L&%3v-h#CQsb6oYVhyAklmgZseX%|-Fyl)Cus);LGiStF!6?XWn(qjm=2v}v&wo?;U!jP3+HNLGe-9^FVJIdT(=LFnHog@RaUA^ z1F{bM&}!$+7KB}x--L2`p{{1>-TL0@{`oyfL&znR5=_1Jsq!I={!K>LjE@X3cOl=c z*~1ZJBgjWkjv%~Wdz@A881gZcP5!EgaQZ)EE=%o!+IBgezCC{T;q=AH@vDKQKbBAQPNpYE}f+jfQB#stL&^s9n&zAljgP zPQdJj|p`Yq@fRxV`wpgoxH!vIH>S|SG#HKn(7rJ4FNNH@mctdsJO zlTaGJjN6>A#6ia*C%;=!RaTeoD}R>rQT%2=?f6SvPdBB#=+{RrKi$f++9;}}uJR)P zbz-}ia0YDuujYzdYkTb3SF_>&J5|TCpJv+-vp?oytPa-NfcZO6hoBP>5`?q%BY;do zQiZt$Re|3Yd?-QE0o^J7lXYRz1>FVFgRED0Imz(|^bxEA5M}7#*PjMFR_yoY= 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