aboutsummaryrefslogtreecommitdiffstats
path: root/src/displayapp/widgets
diff options
context:
space:
mode:
authorJohn Quigley <Elements6007@gmail.com>2023-01-14 14:50:21 -0500
committerGitHub <noreply@github.com>2023-01-14 21:50:21 +0200
commita7f8b59bfb1641dea7f30a267c6bf7e882d9edbf (patch)
treeaa0a46d0da410c83165014af1007acf7be349530 /src/displayapp/widgets
parent6f6ea68acaf2d72dcef479dce429df214b51651c (diff)
Combine Date and Time Settings (#1465)
Replace separate SettingSetDate and SettingSetTime with a combined screenlist. Add DotIndicators. Similar to PageIndicator, but for use when separating screens instead of pages of a list. Co-authored-by: Riku Isokoski <riksu9000@gmail.com>
Diffstat (limited to 'src/displayapp/widgets')
-rw-r--r--src/displayapp/widgets/DotIndicator.cpp28
-rw-r--r--src/displayapp/widgets/DotIndicator.h18
2 files changed, 46 insertions, 0 deletions
diff --git a/src/displayapp/widgets/DotIndicator.cpp b/src/displayapp/widgets/DotIndicator.cpp
new file mode 100644
index 00000000..209b43bd
--- /dev/null
+++ b/src/displayapp/widgets/DotIndicator.cpp
@@ -0,0 +1,28 @@
+#include "displayapp/widgets/DotIndicator.h"
+#include "displayapp/InfiniTimeTheme.h"
+
+using namespace Pinetime::Applications::Widgets;
+
+DotIndicator::DotIndicator(uint8_t nCurrentScreen, uint8_t nScreens) : nCurrentScreen {nCurrentScreen}, nScreens {nScreens} {
+}
+
+void DotIndicator::Create() {
+ lv_obj_t* dotIndicator[nScreens];
+ static constexpr uint8_t dotSize = 12;
+
+ lv_obj_t* container = lv_cont_create(lv_scr_act(), nullptr);
+ lv_cont_set_layout(container, LV_LAYOUT_COLUMN_LEFT);
+ lv_cont_set_fit(container, LV_FIT_TIGHT);
+ lv_obj_set_style_local_pad_inner(container, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, dotSize);
+ lv_obj_set_style_local_bg_opa(container, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
+
+ for (int i = 0; i < nScreens; i++) {
+ dotIndicator[i] = lv_obj_create(container, nullptr);
+ lv_obj_set_size(dotIndicator[i], dotSize, dotSize);
+ lv_obj_set_style_local_bg_color(dotIndicator[i], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
+ }
+
+ lv_obj_set_style_local_bg_color(dotIndicator[nCurrentScreen], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+
+ lv_obj_align(container, nullptr, LV_ALIGN_IN_RIGHT_MID, 0, 0);
+}
diff --git a/src/displayapp/widgets/DotIndicator.h b/src/displayapp/widgets/DotIndicator.h
new file mode 100644
index 00000000..49cdca26
--- /dev/null
+++ b/src/displayapp/widgets/DotIndicator.h
@@ -0,0 +1,18 @@
+#pragma once
+#include <lvgl/lvgl.h>
+
+namespace Pinetime {
+ namespace Applications {
+ namespace Widgets {
+ class DotIndicator {
+ public:
+ DotIndicator(uint8_t nCurrentScreen, uint8_t nScreens);
+ void Create();
+
+ private:
+ uint8_t nCurrentScreen;
+ uint8_t nScreens;
+ };
+ }
+ }
+}