summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/settings
diff options
context:
space:
mode:
authormashuptwice <info@mashup-tech.de>2022-08-25 10:56:09 +0200
committermashuptwice <info@mashup-tech.de>2022-08-25 10:56:09 +0200
commit5c253c10a8534879ea002baa7766ba341f1c168b (patch)
treea4bc18491594b36689f86bb030bbccac36496a0e /src/displayapp/screens/settings
parenta86668b6b717fb618cc4cc7167e49e3339748417 (diff)
parent69563ed03155eb861f8b8ada1df1325995fab51b (diff)
Merge remote-tracking branch 'upstream/develop' into workflow-ignore-md
Diffstat (limited to 'src/displayapp/screens/settings')
-rw-r--r--src/displayapp/screens/settings/QuickSettings.cpp60
-rw-r--r--src/displayapp/screens/settings/QuickSettings.h2
-rw-r--r--src/displayapp/screens/settings/SettingSetTime.cpp4
-rw-r--r--src/displayapp/screens/settings/SettingShakeThreshold.cpp4
-rw-r--r--src/displayapp/screens/settings/SettingSteps.cpp1
-rw-r--r--src/displayapp/screens/settings/SettingWatchFace.cpp1
6 files changed, 43 insertions, 29 deletions
diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp
index f7560066..b76affc9 100644
--- a/src/displayapp/screens/settings/QuickSettings.cpp
+++ b/src/displayapp/screens/settings/QuickSettings.cpp
@@ -2,20 +2,29 @@
#include "displayapp/DisplayApp.h"
#include "displayapp/screens/Symbols.h"
#include "displayapp/screens/BatteryIcon.h"
-#include <components/ble/BleController.h>
+#include "components/ble/BleController.h"
+#include "displayapp/InfiniTimeTheme.h"
using namespace Pinetime::Applications::Screens;
namespace {
void ButtonEventHandler(lv_obj_t* obj, lv_event_t event) {
auto* screen = static_cast<QuickSettings*>(obj->user_data);
- screen->OnButtonEvent(obj, event);
+ if (event == LV_EVENT_CLICKED) {
+ screen->OnButtonEvent(obj);
+ }
}
void lv_update_task(struct _lv_task_t* task) {
auto* user_data = static_cast<QuickSettings*>(task->user_data);
user_data->UpdateScreen();
}
+
+ enum class ButtonState : lv_state_t {
+ NotificationsOn = LV_STATE_CHECKED,
+ NotificationsOff = LV_STATE_DEFAULT,
+ Sleep = 0x40,
+ };
}
QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
@@ -50,7 +59,7 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
lv_style_init(&btn_style);
lv_style_set_radius(&btn_style, LV_STATE_DEFAULT, buttonHeight / 4);
- lv_style_set_bg_color(&btn_style, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x38, 0x38, 0x38));
+ lv_style_set_bg_color(&btn_style, LV_STATE_DEFAULT, Colors::bgAlt);
btn1 = lv_btn_create(lv_scr_act(), nullptr);
btn1->user_data = this;
@@ -78,19 +87,24 @@ QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app,
btn3 = lv_btn_create(lv_scr_act(), nullptr);
btn3->user_data = this;
lv_obj_set_event_cb(btn3, ButtonEventHandler);
- lv_btn_set_checkable(btn3, true);
lv_obj_add_style(btn3, LV_BTN_PART_MAIN, &btn_style);
+ lv_obj_set_style_local_bg_color(btn3, LV_BTN_PART_MAIN, static_cast<lv_state_t>(ButtonState::NotificationsOff), LV_COLOR_RED);
+ static constexpr lv_color_t violet = LV_COLOR_MAKE(0x60, 0x00, 0xff);
+ lv_obj_set_style_local_bg_color(btn3, LV_BTN_PART_MAIN, static_cast<lv_state_t>(ButtonState::Sleep), violet);
lv_obj_set_size(btn3, buttonWidth, buttonHeight);
lv_obj_align(btn3, nullptr, LV_ALIGN_IN_BOTTOM_LEFT, buttonXOffset, 0);
btn3_lvl = lv_label_create(btn3, nullptr);
lv_obj_set_style_local_text_font(btn3_lvl, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48);
- if (settingsController.GetNotificationStatus() == Controllers::Settings::Notification::ON) {
- lv_obj_add_state(btn3, LV_STATE_CHECKED);
+ if (settingsController.GetNotificationStatus() == Controllers::Settings::Notification::On) {
lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn);
- } else {
+ lv_obj_set_state(btn3, static_cast<lv_state_t>(ButtonState::NotificationsOn));
+ } else if (settingsController.GetNotificationStatus() == Controllers::Settings::Notification::Off) {
lv_label_set_text_static(btn3_lvl, Symbols::notificationsOff);
+ } else {
+ lv_label_set_text_static(btn3_lvl, Symbols::sleep);
+ lv_obj_set_state(btn3, static_cast<lv_state_t>(ButtonState::Sleep));
}
btn4 = lv_btn_create(lv_scr_act(), nullptr);
@@ -121,31 +135,33 @@ void QuickSettings::UpdateScreen() {
statusIcons.Update();
}
-void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
- if (object == btn2 && event == LV_EVENT_CLICKED) {
-
- running = false;
+void QuickSettings::OnButtonEvent(lv_obj_t* object) {
+ if (object == btn2) {
app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::Up);
-
- } else if (object == btn1 && event == LV_EVENT_CLICKED) {
+ } else if (object == btn1) {
brightness.Step();
lv_label_set_text_static(btn1_lvl, brightness.GetIcon());
settingsController.SetBrightness(brightness.Level());
- } else if (object == btn3 && event == LV_EVENT_VALUE_CHANGED) {
+ } else if (object == btn3) {
- if (lv_obj_get_state(btn3, LV_BTN_PART_MAIN) & LV_STATE_CHECKED) {
- settingsController.SetNotificationStatus(Controllers::Settings::Notification::ON);
- motorController.RunForDuration(35);
- lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn);
- } else {
- settingsController.SetNotificationStatus(Controllers::Settings::Notification::OFF);
+ if (settingsController.GetNotificationStatus() == Controllers::Settings::Notification::On) {
+ settingsController.SetNotificationStatus(Controllers::Settings::Notification::Off);
lv_label_set_text_static(btn3_lvl, Symbols::notificationsOff);
+ lv_obj_set_state(btn3, static_cast<lv_state_t>(ButtonState::NotificationsOff));
+ } else if (settingsController.GetNotificationStatus() == Controllers::Settings::Notification::Off) {
+ settingsController.SetNotificationStatus(Controllers::Settings::Notification::Sleep);
+ lv_label_set_text_static(btn3_lvl, Symbols::sleep);
+ lv_obj_set_state(btn3, static_cast<lv_state_t>(ButtonState::Sleep));
+ } else {
+ settingsController.SetNotificationStatus(Controllers::Settings::Notification::On);
+ lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn);
+ lv_obj_set_state(btn3, static_cast<lv_state_t>(ButtonState::NotificationsOn));
+ motorController.RunForDuration(35);
}
- } else if (object == btn4 && event == LV_EVENT_CLICKED) {
- running = false;
+ } else if (object == btn4) {
settingsController.SetSettingsMenu(0);
app->StartApp(Apps::Settings, DisplayApp::FullRefreshDirections::Up);
}
diff --git a/src/displayapp/screens/settings/QuickSettings.h b/src/displayapp/screens/settings/QuickSettings.h
index cd342b0c..f555d034 100644
--- a/src/displayapp/screens/settings/QuickSettings.h
+++ b/src/displayapp/screens/settings/QuickSettings.h
@@ -27,7 +27,7 @@ namespace Pinetime {
~QuickSettings() override;
- void OnButtonEvent(lv_obj_t* object, lv_event_t event);
+ void OnButtonEvent(lv_obj_t* object);
void UpdateScreen();
diff --git a/src/displayapp/screens/settings/SettingSetTime.cpp b/src/displayapp/screens/settings/SettingSetTime.cpp
index 7581f184..47b786e4 100644
--- a/src/displayapp/screens/settings/SettingSetTime.cpp
+++ b/src/displayapp/screens/settings/SettingSetTime.cpp
@@ -5,6 +5,7 @@
#include "displayapp/DisplayApp.h"
#include "displayapp/screens/Symbols.h"
#include "components/settings/Settings.h"
+#include "displayapp/InfiniTimeTheme.h"
using namespace Pinetime::Applications::Screens;
@@ -67,8 +68,7 @@ SettingSetTime::SettingSetTime(Pinetime::Applications::DisplayApp* app,
lv_obj_set_size(btnSetTime, 120, 50);
lv_obj_align(btnSetTime, lv_scr_act(), LV_ALIGN_IN_BOTTOM_MID, 0, 0);
lv_obj_set_style_local_value_str(btnSetTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Set");
- lv_obj_set_style_local_bg_color(btnSetTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_MAKE(0x38, 0x38, 0x38));
- lv_obj_set_style_local_bg_color(btnSetTime, LV_BTN_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_MAKE(0x18, 0x18, 0x18));
+ lv_obj_set_style_local_bg_color(btnSetTime, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, Colors::bgAlt);
lv_obj_set_style_local_value_color(btnSetTime, LV_BTN_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_GRAY);
lv_obj_set_event_cb(btnSetTime, SetTimeEventHandler);
diff --git a/src/displayapp/screens/settings/SettingShakeThreshold.cpp b/src/displayapp/screens/settings/SettingShakeThreshold.cpp
index aac1eaff..de46f7de 100644
--- a/src/displayapp/screens/settings/SettingShakeThreshold.cpp
+++ b/src/displayapp/screens/settings/SettingShakeThreshold.cpp
@@ -3,6 +3,7 @@
#include "displayapp/DisplayApp.h"
#include "displayapp/screens/Screen.h"
#include "displayapp/screens/Symbols.h"
+#include "displayapp/InfiniTimeTheme.h"
using namespace Pinetime::Applications::Screens;
@@ -123,8 +124,7 @@ void SettingShakeThreshold::UpdateSelected(lv_obj_t* object, lv_event_t event) {
vCalTime = xTaskGetTickCount();
lv_label_set_text_static(calLabel, "Ready!");
lv_obj_set_click(positionArc, false);
- lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_MAKE(0x0, 0xb0, 0x0));
- lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, LV_COLOR_MAKE(0x0, 0xb0, 0x0));
+ lv_obj_set_style_local_bg_color(calButton, LV_BTN_PART_MAIN, LV_STATE_CHECKED, Colors::highlight);
} else if (lv_btn_get_state(calButton) == LV_BTN_STATE_RELEASED) {
calibrating = 0;
lv_obj_set_click(positionArc, true);
diff --git a/src/displayapp/screens/settings/SettingSteps.cpp b/src/displayapp/screens/settings/SettingSteps.cpp
index e92600c2..af5bd6e9 100644
--- a/src/displayapp/screens/settings/SettingSteps.cpp
+++ b/src/displayapp/screens/settings/SettingSteps.cpp
@@ -17,7 +17,6 @@ SettingSteps::SettingSteps(Pinetime::Applications::DisplayApp* app, Pinetime::Co
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
- // lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5);
diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp
index 3cb2a364..be595a74 100644
--- a/src/displayapp/screens/settings/SettingWatchFace.cpp
+++ b/src/displayapp/screens/settings/SettingWatchFace.cpp
@@ -21,7 +21,6 @@ SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pine
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr);
- // lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111));
lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10);
lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5);