More timeout options and improved checkbox alignment

This commit is contained in:
Riku Isokoski 2022-07-27 20:10:39 +03:00 committed by JF
parent 67e0cad573
commit b768829c63
6 changed files with 11 additions and 11 deletions

View File

@ -207,7 +207,7 @@ static void basic_init(void) {
lv_style_reset(&style_cb_bg); lv_style_reset(&style_cb_bg);
lv_style_set_radius(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(4)); 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_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_width(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(2));
lv_style_set_outline_pad(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(20)); lv_style_set_outline_pad(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(20));

View File

@ -15,7 +15,7 @@ namespace {
} }
} }
constexpr std::array<uint16_t, 4> SettingDisplay::options; constexpr std::array<uint16_t, 6> SettingDisplay::options;
SettingDisplay::SettingDisplay(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) SettingDisplay::SettingDisplay(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
: Screen(app), settingsController {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_pos(container1, 10, 60);
lv_obj_set_width(container1, LV_HOR_RES - 20); lv_obj_set_width(container1, LV_HOR_RES - 20);
lv_obj_set_height(container1, LV_VER_RES - 50); 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_obj_t* title = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_text_static(title, "Display timeout"); lv_label_set_text_static(title, "Display timeout");
@ -46,7 +46,7 @@ SettingDisplay::SettingDisplay(Pinetime::Applications::DisplayApp* app, Pinetime
char buffer[12]; char buffer[12];
for (unsigned int i = 0; i < options.size(); i++) { for (unsigned int i = 0; i < options.size(); i++) {
cbOption[i] = lv_checkbox_create(container1, nullptr); 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); lv_checkbox_set_text(cbOption[i], buffer);
cbOption[i]->user_data = this; cbOption[i]->user_data = this;
lv_obj_set_event_cb(cbOption[i], event_handler); lv_obj_set_event_cb(cbOption[i], event_handler);

View File

@ -20,7 +20,7 @@ namespace Pinetime {
void UpdateSelected(lv_obj_t* object, lv_event_t event); void UpdateSelected(lv_obj_t* object, lv_event_t event);
private: private:
static constexpr std::array<uint16_t, 4> options = {5000, 15000, 20000, 30000}; static constexpr std::array<uint16_t, 6> options = {5000, 7000, 10000, 15000, 20000, 30000};
Controllers::Settings& settingsController; Controllers::Settings& settingsController;
lv_obj_t* cbOption[options.size()]; lv_obj_t* cbOption[options.size()];