summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/components/settings/Settings.h46
-rw-r--r--src/displayapp/Colors.cpp27
-rw-r--r--src/displayapp/Colors.h10
-rw-r--r--src/displayapp/screens/PineTimeStyle.cpp11
-rw-r--r--src/displayapp/screens/PineTimeStyle.h5
-rw-r--r--src/displayapp/screens/settings/SettingPineTimeStyle.cpp147
-rw-r--r--src/displayapp/screens/settings/SettingPineTimeStyle.h12
8 files changed, 144 insertions, 116 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 69c19367..a7242903 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -418,6 +418,7 @@ list(APPEND SOURCE_FILES
displayapp/screens/BatteryInfo.cpp
displayapp/screens/Steps.cpp
displayapp/screens/Timer.cpp
+ displayapp/Colors.cpp
## Settings
displayapp/screens/settings/QuickSettings.cpp
@@ -611,6 +612,7 @@ set(INCLUDE_FILES
displayapp/screens/Metronome.h
displayapp/screens/Motion.h
displayapp/screens/Timer.h
+ displayapp/Colors.h
drivers/St7789.h
drivers/SpiNorFlash.h
drivers/SpiMaster.h
diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h
index 40cafe9a..a294ab78 100644
--- a/src/components/settings/Settings.h
+++ b/src/components/settings/Settings.h
@@ -17,6 +17,14 @@ namespace Pinetime {
DoubleTap = 1,
RaiseWrist = 2,
};
+ enum class Colors : uint8_t {
+ White, Silver, Gray, Black, Red, Maroon, Yellow, Olive, Lime, Green, Cyan, Teal, Blue, Navy, Magenta, Purple, Orange
+ };
+ struct PineTimeStyle {
+ Colors ColorTime = Colors::Teal;
+ Colors ColorBar = Colors::Teal;
+ Colors ColorBG = Colors::Black;
+ };
Settings(Pinetime::Controllers::FS& fs);
@@ -33,37 +41,38 @@ namespace Pinetime {
return settings.clockFace;
};
- void SetPTSColorTime(uint8_t colorTime) {
- if (colorTime != settings.PTSColorTime)
+ void SetPTSColorTime(Colors colorTime) {
+ if (colorTime != settings.PTS.ColorTime)
settingsChanged = true;
- settings.PTSColorTime = colorTime;
+ settings.PTS.ColorTime = colorTime;
};
- uint8_t GetPTSColorTime() const {
- return settings.PTSColorTime;
+ Colors GetPTSColorTime() const {
+ return settings.PTS.ColorTime;
};
- void SetPTSColorBar(uint8_t colorBar) {
- if (colorBar != settings.PTSColorBar)
+ void SetPTSColorBar(Colors colorBar) {
+ if (colorBar != settings.PTS.ColorBar)
settingsChanged = true;
- settings.PTSColorBar = colorBar;
+ settings.PTS.ColorBar = colorBar;
};
- uint8_t GetPTSColorBar() const {
- return settings.PTSColorBar;
+ Colors GetPTSColorBar() const {
+ return settings.PTS.ColorBar;
};
- void SetPTSColorBG(uint8_t colorBG) {
- if (colorBG != settings.PTSColorBG)
+ void SetPTSColorBG(Colors colorBG) {
+ if (colorBG != settings.PTS.ColorBG)
settingsChanged = true;
- settings.PTSColorBG = colorBG;
+ settings.PTS.ColorBG = colorBG;
};
- uint8_t GetPTSColorBG() const {
- return settings.PTSColorBG;
+ Colors GetPTSColorBG() const {
+ return settings.PTS.ColorBG;
};
void SetAppMenu(uint8_t menu) {
appMenu = menu;
};
- uint8_t GetAppMenu() {
+
+ uint8_t GetAppMenu() const {
return appMenu;
};
@@ -156,7 +165,6 @@ namespace Pinetime {
static constexpr uint32_t settingsVersion = 0x0002;
struct SettingsData {
-
uint32_t version = settingsVersion;
uint32_t stepsGoal = 10000;
uint32_t screenTimeOut = 15000;
@@ -166,9 +174,7 @@ namespace Pinetime {
uint8_t clockFace = 0;
- uint8_t PTSColorTime = 11;
- uint8_t PTSColorBar = 11;
- uint8_t PTSColorBG = 3;
+ PineTimeStyle PTS;
std::bitset<3> wakeUpMode {0};
diff --git a/src/displayapp/Colors.cpp b/src/displayapp/Colors.cpp
new file mode 100644
index 00000000..f45f0722
--- /dev/null
+++ b/src/displayapp/Colors.cpp
@@ -0,0 +1,27 @@
+#include "Colors.h"
+
+using namespace Pinetime::Applications;
+using namespace Pinetime::Controllers;
+
+lv_color_t Pinetime::Applications::Convert(Pinetime::Controllers::Settings::Colors color) {
+ switch (color) {
+ case Pinetime::Controllers::Settings::Colors::White: return LV_COLOR_WHITE;
+ case Pinetime::Controllers::Settings::Colors::Silver: return LV_COLOR_SILVER;
+ case Pinetime::Controllers::Settings::Colors::Gray: return LV_COLOR_GRAY;
+ case Pinetime::Controllers::Settings::Colors::Black: return LV_COLOR_BLACK;
+ case Pinetime::Controllers::Settings::Colors::Red: return LV_COLOR_RED;
+ case Pinetime::Controllers::Settings::Colors::Maroon: return LV_COLOR_MAROON;
+ case Pinetime::Controllers::Settings::Colors::Yellow: return LV_COLOR_YELLOW;
+ case Pinetime::Controllers::Settings::Colors::Olive: return LV_COLOR_OLIVE;
+ case Pinetime::Controllers::Settings::Colors::Lime: return LV_COLOR_LIME;
+ case Pinetime::Controllers::Settings::Colors::Green: return LV_COLOR_GREEN;
+ case Pinetime::Controllers::Settings::Colors::Cyan: return LV_COLOR_CYAN;
+ case Pinetime::Controllers::Settings::Colors::Teal: return LV_COLOR_TEAL;
+ case Pinetime::Controllers::Settings::Colors::Blue: return LV_COLOR_BLUE;
+ case Pinetime::Controllers::Settings::Colors::Navy: return LV_COLOR_NAVY;
+ case Pinetime::Controllers::Settings::Colors::Magenta: return LV_COLOR_MAGENTA;
+ case Pinetime::Controllers::Settings::Colors::Purple: return LV_COLOR_PURPLE;
+ case Pinetime::Controllers::Settings::Colors::Orange: return LV_COLOR_ORANGE;
+ default: return LV_COLOR_WHITE;
+ }
+}
diff --git a/src/displayapp/Colors.h b/src/displayapp/Colors.h
new file mode 100644
index 00000000..9db7dd20
--- /dev/null
+++ b/src/displayapp/Colors.h
@@ -0,0 +1,10 @@
+#pragma once
+
+#include <lvgl/src/lv_misc/lv_color.h>
+#include <components/settings/Settings.h>
+
+namespace Pinetime {
+ namespace Applications {
+ lv_color_t Convert(Controllers::Settings::Colors color);
+ }
+} \ No newline at end of file
diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp
index 772e4612..7a712f43 100644
--- a/src/displayapp/screens/PineTimeStyle.cpp
+++ b/src/displayapp/screens/PineTimeStyle.cpp
@@ -23,6 +23,7 @@
#include <date/date.h>
#include <lvgl/lvgl.h>
#include <cstdio>
+#include <displayapp/Colors.h>
#include "BatteryIcon.h"
#include "BleIcon.h"
#include "NotificationIcon.h"
@@ -63,7 +64,7 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
//Create a 200px wide background rectangle
timebar = lv_obj_create(lv_scr_act(), nullptr);
- lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorBG()]);
+ lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorBG()));
lv_obj_set_style_local_radius(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
lv_obj_set_size(timebar, 200, 240);
lv_obj_align(timebar, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 0);
@@ -71,25 +72,25 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
// Display the time
timeDD1 = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &open_sans_light);
- lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]);
+ lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime()));
lv_label_set_text(timeDD1, "12");
lv_obj_align(timeDD1, timebar, LV_ALIGN_IN_TOP_MID, 5, 5);
timeDD2 = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &open_sans_light);
- lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]);
+ lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime()));
lv_label_set_text(timeDD2, "34");
lv_obj_align(timeDD2, timebar, LV_ALIGN_IN_BOTTOM_MID, 5, -5);
timeAMPM = lv_label_create(lv_scr_act(), nullptr);
- lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]);
+ lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime()));
lv_obj_set_style_local_text_line_space(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -3);
lv_label_set_text(timeAMPM, "");
lv_obj_align(timeAMPM, timebar, LV_ALIGN_IN_BOTTOM_LEFT, 2, -20);
// Create a 40px wide bar down the right side of the screen
sidebar = lv_obj_create(lv_scr_act(), nullptr);
- lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorBar()]);
+ lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorBar()));
lv_obj_set_style_local_radius(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
lv_obj_set_size(sidebar, 40, 240);
lv_obj_align(sidebar, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0);
diff --git a/src/displayapp/screens/PineTimeStyle.h b/src/displayapp/screens/PineTimeStyle.h
index 16b6de19..cb74ead5 100644
--- a/src/displayapp/screens/PineTimeStyle.h
+++ b/src/displayapp/screens/PineTimeStyle.h
@@ -68,11 +68,6 @@ namespace Pinetime {
lv_obj_t* notificationIcon;
lv_obj_t* stepGauge;
lv_color_t needle_colors[1];
- lv_color_t pts_colors[17] = {LV_COLOR_WHITE, LV_COLOR_SILVER, LV_COLOR_GRAY, LV_COLOR_BLACK,
- LV_COLOR_RED, LV_COLOR_MAROON, LV_COLOR_YELLOW, LV_COLOR_OLIVE,
- LV_COLOR_LIME, LV_COLOR_GREEN, LV_COLOR_CYAN, LV_COLOR_TEAL,
- LV_COLOR_BLUE, LV_COLOR_NAVY, LV_COLOR_MAGENTA, LV_COLOR_PURPLE,
- LV_COLOR_ORANGE};
Controllers::DateTime& dateTimeController;
Controllers::Battery& batteryController;
diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp
index e125c8a2..c9af19b6 100644
--- a/src/displayapp/screens/settings/SettingPineTimeStyle.cpp
+++ b/src/displayapp/screens/settings/SettingPineTimeStyle.cpp
@@ -1,5 +1,6 @@
#include "SettingPineTimeStyle.h"
#include <lvgl/lvgl.h>
+#include <displayapp/Colors.h>
#include "displayapp/DisplayApp.h"
#include "displayapp/screens/Symbols.h"
@@ -15,7 +16,7 @@ namespace {
SettingPineTimeStyle::SettingPineTimeStyle(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
: Screen(app), settingsController {settingsController} {
timebar = lv_obj_create(lv_scr_act(), nullptr);
- lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorBG()]);
+ lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorBG()));
lv_obj_set_style_local_radius(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
lv_obj_set_size(timebar, 200, 240);
lv_obj_align(timebar, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 5, 0);
@@ -24,18 +25,18 @@ SettingPineTimeStyle::SettingPineTimeStyle(Pinetime::Applications::DisplayApp* a
timeDD1 = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &open_sans_light);
- lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]);
+ lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime()));
lv_label_set_text(timeDD1, "12");
lv_obj_align(timeDD1, timebar, LV_ALIGN_IN_TOP_MID, 5, 5);
timeDD2 = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_font(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &open_sans_light);
- lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]);
+ lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime()));
lv_label_set_text(timeDD2, "34");
lv_obj_align(timeDD2, timebar, LV_ALIGN_IN_BOTTOM_MID, 5, -5);
timeAMPM = lv_label_create(lv_scr_act(), nullptr);
- lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorTime()]);
+ lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorTime()));
lv_obj_set_style_local_text_line_space(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, -3);
lv_label_set_text(timeAMPM, "A\nM");
lv_obj_align(timeAMPM, timebar, LV_ALIGN_IN_BOTTOM_LEFT, 2, -20);
@@ -43,7 +44,7 @@ SettingPineTimeStyle::SettingPineTimeStyle(Pinetime::Applications::DisplayApp* a
// Create a 40px wide bar down the right side of the screen
sidebar = lv_obj_create(lv_scr_act(), nullptr);
- lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[settingsController.GetPTSColorBar()]);
+ lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(settingsController.GetPTSColorBar()));
lv_obj_set_style_local_radius(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 0);
lv_obj_set_size(sidebar, 40, 240);
lv_obj_align(sidebar, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0);
@@ -215,91 +216,60 @@ SettingPineTimeStyle::~SettingPineTimeStyle() {
settingsController.SaveSettings();
}
-bool SettingPineTimeStyle::Refresh() {
- return running;
-}
-
void SettingPineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) {
- uint8_t valueTime = settingsController.GetPTSColorTime();
- uint8_t valueBar = settingsController.GetPTSColorBar();
- uint8_t valueBG = settingsController.GetPTSColorBG();
+ auto valueTime = settingsController.GetPTSColorTime();
+ auto valueBar = settingsController.GetPTSColorBar();
+ auto valueBG = settingsController.GetPTSColorBG();
if (event == LV_EVENT_CLICKED) {
if (object == btnNextTime) {
- if (valueTime < 16) {
- valueTime += 1;
- } else {
- valueTime = 0;
- }
+ valueTime = GetNext(valueTime);
+
settingsController.SetPTSColorTime(valueTime);
- lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]);
- lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]);
- lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]);
+ lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
+ lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
+ lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
}
if (object == btnPrevTime) {
- if (valueTime > 0) {
- valueTime -= 1;
- } else {
- valueTime = 16;
- }
+ valueTime = GetPrevious(valueTime);
settingsController.SetPTSColorTime(valueTime);
- lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]);
- lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]);
- lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueTime]);
+ lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
+ lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
+ lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(valueTime));
}
if (object == btnNextBar) {
- if (valueBar < 16) {
- valueBar += 1;
- // Avoid setting the sidebar black
- if (valueBar == 3) {
- valueBar += 1;
- }
- } else {
- valueBar = 0;
- }
+ valueBar = GetNext(valueBar);
+ if(valueBar == Controllers::Settings::Colors::Black)
+ valueBar = GetNext(valueBar);
settingsController.SetPTSColorBar(valueBar);
- lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]);
+ lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar));
}
if (object == btnPrevBar) {
- if (valueBar > 0) {
- valueBar -= 1;
- // Avoid setting the sidebar black
- if (valueBar == 3) {
- valueBar -= 1;
- }
- } else {
- valueBar = 16;
- }
+ valueBar = GetPrevious(valueBar);
+ if(valueBar == Controllers::Settings::Colors::Black)
+ valueBar = GetPrevious(valueBar);
settingsController.SetPTSColorBar(valueBar);
- lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBar]);
+ lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBar));
}
if (object == btnNextBG) {
- if (valueBG < 16) {
- valueBG += 1;
- } else {
- valueBG = 0;
- }
+ valueBG = GetNext(valueBG);
settingsController.SetPTSColorBG(valueBG);
- lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]);
+ lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG));
}
if (object == btnPrevBG) {
- if (valueBG > 0) {
- valueBG -= 1;
- } else {
- valueBG = 16;
- }
+ valueBG = GetPrevious(valueBG);
settingsController.SetPTSColorBG(valueBG);
- lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[valueBG]);
+ lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(valueBG));
}
if (object == btnReset) {
- settingsController.SetPTSColorTime(11);
- lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[11]);
- lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[11]);
- lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[11]);
- settingsController.SetPTSColorBar(11);
- lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[11]);
- settingsController.SetPTSColorBG(3);
- lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[3]);
+ settingsController.SetPTSColorTime(Controllers::Settings::Colors::Teal);
+ lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal));
+ lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal));
+ lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal));
+ settingsController.SetPTSColorBar(Controllers::Settings::Colors::Teal);
+ lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Teal));
+ settingsController.SetPTSColorBG(Controllers::Settings::Colors::Black);
+ lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(Controllers::Settings::Colors::Black));
}
if (object == btnRandom) {
uint8_t randTime = rand() % 17;
@@ -312,14 +282,37 @@ void SettingPineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) {
if (randBar == 3) {
randBar -= 1;
}
- settingsController.SetPTSColorTime(randTime);
- lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]);
- lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]);
- lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randTime]);
- settingsController.SetPTSColorBar(randBar);
- lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randBar]);
- settingsController.SetPTSColorBG(randBG);
- lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, pts_colors[randBG]);
+ settingsController.SetPTSColorTime(static_cast<Controllers::Settings::Colors>(randTime));
+ lv_obj_set_style_local_text_color(timeDD1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(static_cast<Controllers::Settings::Colors>(randTime)));
+ lv_obj_set_style_local_text_color(timeDD2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(static_cast<Controllers::Settings::Colors>(randTime)));
+ lv_obj_set_style_local_text_color(timeAMPM, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Convert(static_cast<Controllers::Settings::Colors>(randTime)));
+ settingsController.SetPTSColorBar(static_cast<Controllers::Settings::Colors>(randBar));
+ lv_obj_set_style_local_bg_color(sidebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(static_cast<Controllers::Settings::Colors>(randBar)));
+ settingsController.SetPTSColorBG(static_cast<Controllers::Settings::Colors>(randBG));
+ lv_obj_set_style_local_bg_color(timebar, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Convert(static_cast<Controllers::Settings::Colors>(randBG)));
}
}
-} \ No newline at end of file
+}
+
+Pinetime::Controllers::Settings::Colors SettingPineTimeStyle::GetNext(Pinetime::Controllers::Settings::Colors color) {
+ auto colorAsInt = static_cast<uint8_t>(color);
+ Pinetime::Controllers::Settings::Colors nextColor;
+ if (colorAsInt < 16) {
+ nextColor = static_cast<Controllers::Settings::Colors>(colorAsInt + 1);
+ } else {
+ nextColor = static_cast<Controllers::Settings::Colors>(0);
+ }
+ return nextColor;
+}
+
+Pinetime::Controllers::Settings::Colors SettingPineTimeStyle::GetPrevious(Pinetime::Controllers::Settings::Colors color) {
+ auto colorAsInt = static_cast<uint8_t>(color);
+ Pinetime::Controllers::Settings::Colors prevColor;
+
+ if (colorAsInt > 0) {
+ prevColor = static_cast<Controllers::Settings::Colors>(colorAsInt - 1);
+ } else {
+ prevColor = static_cast<Controllers::Settings::Colors>(16);
+ }
+ return prevColor;
+}
diff --git a/src/displayapp/screens/settings/SettingPineTimeStyle.h b/src/displayapp/screens/settings/SettingPineTimeStyle.h
index 1a01ebbb..397bd86d 100644
--- a/src/displayapp/screens/settings/SettingPineTimeStyle.h
+++ b/src/displayapp/screens/settings/SettingPineTimeStyle.h
@@ -15,12 +15,14 @@ namespace Pinetime {
SettingPineTimeStyle(DisplayApp* app, Pinetime::Controllers::Settings &settingsController);
~SettingPineTimeStyle() override;
- bool Refresh() override;
void UpdateSelected(lv_obj_t *object, lv_event_t event);
private:
Controllers::Settings& settingsController;
+ Pinetime::Controllers::Settings::Colors GetNext(Controllers::Settings::Colors color);
+ Pinetime::Controllers::Settings::Colors GetPrevious(Controllers::Settings::Colors color);
+
lv_obj_t * btnNextTime;
lv_obj_t * btnPrevTime;
lv_obj_t * btnNextBar;
@@ -29,9 +31,6 @@ namespace Pinetime {
lv_obj_t * btnPrevBG;
lv_obj_t * btnReset;
lv_obj_t * btnRandom;
- lv_obj_t * timeColor;
- lv_obj_t * barColor;
- lv_obj_t * bgColor;
lv_obj_t * timebar;
lv_obj_t * sidebar;
lv_obj_t * timeDD1;
@@ -51,11 +50,6 @@ namespace Pinetime {
lv_obj_t * calendarCrossBar2;
lv_obj_t * stepGauge;
lv_color_t needle_colors[1];
- lv_color_t pts_colors[17] = {LV_COLOR_WHITE, LV_COLOR_SILVER, LV_COLOR_GRAY, LV_COLOR_BLACK,
- LV_COLOR_RED, LV_COLOR_MAROON, LV_COLOR_YELLOW, LV_COLOR_OLIVE,
- LV_COLOR_LIME, LV_COLOR_GREEN, LV_COLOR_CYAN, LV_COLOR_TEAL,
- LV_COLOR_BLUE, LV_COLOR_NAVY, LV_COLOR_MAGENTA, LV_COLOR_PURPLE,
- LV_COLOR_ORANGE};
};
}
}