From b768829c633dd8fa344b744382d7d75c71c4229f Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Wed, 27 Jul 2022 20:10:39 +0300 Subject: [PATCH] More timeout options and improved checkbox alignment --- src/displayapp/lv_pinetime_theme.c | 2 +- src/displayapp/screens/settings/SettingDisplay.cpp | 6 +++--- src/displayapp/screens/settings/SettingDisplay.h | 2 +- src/displayapp/screens/settings/SettingTimeFormat.h | 2 +- src/displayapp/screens/settings/SettingWakeUp.cpp | 8 ++++---- src/displayapp/screens/settings/SettingWatchFace.h | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/displayapp/lv_pinetime_theme.c b/src/displayapp/lv_pinetime_theme.c index 9c90ce12..f712004a 100644 --- a/src/displayapp/lv_pinetime_theme.c +++ b/src/displayapp/lv_pinetime_theme.c @@ -207,7 +207,7 @@ static void basic_init(void) { lv_style_reset(&style_cb_bg); lv_style_set_radius(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(4)); - lv_style_set_pad_inner(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(10)); + lv_style_set_pad_inner(&style_cb_bg, LV_STATE_DEFAULT, 18); lv_style_set_outline_color(&style_cb_bg, LV_STATE_DEFAULT, LV_COLOR_WHITE); lv_style_set_outline_width(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(2)); lv_style_set_outline_pad(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(20)); diff --git a/src/displayapp/screens/settings/SettingDisplay.cpp b/src/displayapp/screens/settings/SettingDisplay.cpp index bf2087ab..e044a85a 100644 --- a/src/displayapp/screens/settings/SettingDisplay.cpp +++ b/src/displayapp/screens/settings/SettingDisplay.cpp @@ -15,7 +15,7 @@ namespace { } } -constexpr std::array SettingDisplay::options; +constexpr std::array SettingDisplay::options; SettingDisplay::SettingDisplay(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) : Screen(app), settingsController {settingsController} { @@ -30,7 +30,7 @@ SettingDisplay::SettingDisplay(Pinetime::Applications::DisplayApp* app, Pinetime lv_obj_set_pos(container1, 10, 60); lv_obj_set_width(container1, LV_HOR_RES - 20); lv_obj_set_height(container1, LV_VER_RES - 50); - lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT); + lv_cont_set_layout(container1, LV_LAYOUT_PRETTY_TOP); lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text_static(title, "Display timeout"); @@ -46,7 +46,7 @@ SettingDisplay::SettingDisplay(Pinetime::Applications::DisplayApp* app, Pinetime char buffer[12]; for (unsigned int i = 0; i < options.size(); i++) { cbOption[i] = lv_checkbox_create(container1, nullptr); - sprintf(buffer, "%3d seconds", options[i] / 1000); + sprintf(buffer, "%2ds", options[i] / 1000); lv_checkbox_set_text(cbOption[i], buffer); cbOption[i]->user_data = this; lv_obj_set_event_cb(cbOption[i], event_handler); diff --git a/src/displayapp/screens/settings/SettingDisplay.h b/src/displayapp/screens/settings/SettingDisplay.h index dc56419d..eeddaef8 100644 --- a/src/displayapp/screens/settings/SettingDisplay.h +++ b/src/displayapp/screens/settings/SettingDisplay.h @@ -20,7 +20,7 @@ namespace Pinetime { void UpdateSelected(lv_obj_t* object, lv_event_t event); private: - static constexpr std::array options = {5000, 15000, 20000, 30000}; + static constexpr std::array options = {5000, 7000, 10000, 15000, 20000, 30000}; Controllers::Settings& settingsController; lv_obj_t* cbOption[options.size()]; diff --git a/src/displayapp/screens/settings/SettingTimeFormat.h b/src/displayapp/screens/settings/SettingTimeFormat.h index 818edf0c..01ca2c9b 100644 --- a/src/displayapp/screens/settings/SettingTimeFormat.h +++ b/src/displayapp/screens/settings/SettingTimeFormat.h @@ -20,7 +20,7 @@ namespace Pinetime { void UpdateSelected(lv_obj_t* object, lv_event_t event); private: - static constexpr std::array options = {" 12-hour", " 24-hour"}; + static constexpr std::array options = {"12-hour", "24-hour"}; Controllers::Settings& settingsController; lv_obj_t* cbOption[options.size()]; }; diff --git a/src/displayapp/screens/settings/SettingWakeUp.cpp b/src/displayapp/screens/settings/SettingWakeUp.cpp index 4a4b60f8..59275e2f 100644 --- a/src/displayapp/screens/settings/SettingWakeUp.cpp +++ b/src/displayapp/screens/settings/SettingWakeUp.cpp @@ -42,7 +42,7 @@ SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime:: optionsTotal = 0; cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); - lv_checkbox_set_text_static(cbOption[optionsTotal], " Single Tap"); + lv_checkbox_set_text_static(cbOption[optionsTotal], "Single Tap"); cbOption[optionsTotal]->user_data = this; lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::SingleTap)) { @@ -50,7 +50,7 @@ SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime:: } optionsTotal++; cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); - lv_checkbox_set_text_static(cbOption[optionsTotal], " Double Tap"); + lv_checkbox_set_text_static(cbOption[optionsTotal], "Double Tap"); cbOption[optionsTotal]->user_data = this; lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) { @@ -58,7 +58,7 @@ SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime:: } optionsTotal++; cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); - lv_checkbox_set_text_static(cbOption[optionsTotal], " Raise Wrist"); + lv_checkbox_set_text_static(cbOption[optionsTotal], "Raise Wrist"); cbOption[optionsTotal]->user_data = this; lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist)) { @@ -66,7 +66,7 @@ SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime:: } optionsTotal++; cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); - lv_checkbox_set_text_static(cbOption[optionsTotal], " Shake Wake"); + lv_checkbox_set_text_static(cbOption[optionsTotal], "Shake Wake"); cbOption[optionsTotal]->user_data = this; lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); if (settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::Shake)) { diff --git a/src/displayapp/screens/settings/SettingWatchFace.h b/src/displayapp/screens/settings/SettingWatchFace.h index 62427b4f..d65f4a22 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.h +++ b/src/displayapp/screens/settings/SettingWatchFace.h @@ -20,7 +20,7 @@ namespace Pinetime { void UpdateSelected(lv_obj_t* object, lv_event_t event); private: - static constexpr std::array options = {" Digital face", " Analog face", " PineTimeStyle", " Terminal"}; + static constexpr std::array options = {"Digital face", "Analog face", "PineTimeStyle", "Terminal"}; Controllers::Settings& settingsController; lv_obj_t* cbOption[options.size()];