diff --git a/src/DisplayApp/LittleVgl.cpp b/src/DisplayApp/LittleVgl.cpp index 7b6cda94..3483f8e8 100644 --- a/src/DisplayApp/LittleVgl.cpp +++ b/src/DisplayApp/LittleVgl.cpp @@ -17,6 +17,8 @@ LV_FONT_DECLARE(jetbrains_mono_extrabold_compressed) LV_FONT_DECLARE(jetbrains_mono_bold_20) } +lv_style_t* LabelBigStyle = nullptr; + static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p) { auto* lvgl = static_cast(disp_drv->user_data); lvgl->FlushDisplay(area, color_p); @@ -361,6 +363,10 @@ void LittleVgl::InitThemeLabel() { lv_style_copy(&prim, &bg); prim.text.color = lv_color_hsv_to_rgb(hue, 5, 95); + lv_style_copy(&labelBigStyle, &prim); + labelBigStyle.text.font = &jetbrains_mono_extrabold_compressed; + LabelBigStyle = &(this->labelBigStyle); + lv_style_copy(&sec, &bg); sec.text.color = lv_color_hsv_to_rgb(hue, 15, 65); diff --git a/src/DisplayApp/LittleVgl.h b/src/DisplayApp/LittleVgl.h index c6e728b2..8bd56ddf 100644 --- a/src/DisplayApp/LittleVgl.h +++ b/src/DisplayApp/LittleVgl.h @@ -79,6 +79,7 @@ namespace Pinetime { uint16_t hue = 10; lv_theme_t theme; lv_style_t btn_rel, btn_pr, btn_tgl_rel, btn_tgl_pr, btn_ina; + lv_style_t labelBigStyle; lv_style_t prim, sec, hint; lv_style_t led; lv_style_t bar_bg, bar_indic; diff --git a/src/DisplayApp/Screens/Clock.cpp b/src/DisplayApp/Screens/Clock.cpp index 07db83ee..68471854 100644 --- a/src/DisplayApp/Screens/Clock.cpp +++ b/src/DisplayApp/Screens/Clock.cpp @@ -11,7 +11,7 @@ using namespace Pinetime::Applications::Screens; extern lv_font_t jetbrains_mono_extrabold_compressed; extern lv_font_t jetbrains_mono_bold_20; - +extern lv_style_t* LabelBigStyle; static void event_handler(lv_obj_t * obj, lv_event_t event) { Clock* screen = static_cast(obj->user_data); @@ -41,21 +41,12 @@ Clock::Clock(DisplayApp* app, lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60); - labelStyle = const_cast(lv_label_get_style(label_date, LV_LABEL_STYLE_MAIN)); - labelStyle->text.font = &jetbrains_mono_bold_20; - - lv_style_copy(&labelBigStyle, labelStyle); - labelBigStyle.text.font = &jetbrains_mono_extrabold_compressed; - - lv_label_set_style(label_date, LV_LABEL_STYLE_MAIN, labelStyle); - label_time = lv_label_create(lv_scr_act(), NULL); - lv_label_set_style(label_time, LV_LABEL_STYLE_MAIN, &labelBigStyle); + lv_label_set_style(label_time, LV_LABEL_STYLE_MAIN, LabelBigStyle); lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0); backgroundLabel = lv_label_create(lv_scr_act(), NULL); backgroundLabel->user_data = this; - lv_label_set_style(backgroundLabel, LV_LABEL_STYLE_MAIN, labelStyle); lv_obj_set_click(backgroundLabel, true); lv_obj_set_event_cb(backgroundLabel, event_handler); lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); diff --git a/src/DisplayApp/Screens/Clock.h b/src/DisplayApp/Screens/Clock.h index 7c4a09df..2450158d 100644 --- a/src/DisplayApp/Screens/Clock.h +++ b/src/DisplayApp/Screens/Clock.h @@ -66,16 +66,9 @@ namespace Pinetime { DirtyValue> currentDateTime; DirtyValue version; - lv_style_t* labelStyle; - lv_style_t labelBigStyle; - lv_obj_t * label_battery; - - lv_obj_t * label_ble; lv_obj_t* label_time; lv_obj_t* label_date; - lv_obj_t* label_version; lv_obj_t* backgroundLabel; - lv_obj_t * batteryIcon; lv_obj_t * bleIcon; diff --git a/src/DisplayApp/Screens/Message.cpp b/src/DisplayApp/Screens/Message.cpp index c8a4ea1f..b83cb751 100644 --- a/src/DisplayApp/Screens/Message.cpp +++ b/src/DisplayApp/Screens/Message.cpp @@ -24,17 +24,12 @@ Message::Message(DisplayApp* app) : Screen(app) { backgroundLabel = lv_label_create(lv_scr_act(), NULL); backgroundLabel->user_data = this; - labelStyle = const_cast(lv_label_get_style(backgroundLabel, LV_LABEL_STYLE_MAIN)); - labelStyle->text.font = &jetbrains_mono_bold_20; - - lv_label_set_style(backgroundLabel, LV_LABEL_STYLE_MAIN, labelStyle); lv_obj_set_click(backgroundLabel, true); lv_obj_set_event_cb(backgroundLabel, event_handler); lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_pos(backgroundLabel, 0, 0); lv_label_set_text(backgroundLabel, ""); -// lv_obj_align(backgroundLabel, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0); button = lv_btn_create(lv_scr_act(), NULL); lv_obj_set_event_cb(button, event_handler); @@ -42,11 +37,9 @@ Message::Message(DisplayApp* app) : Screen(app) { button->user_data = this; label = lv_label_create(button, NULL); - lv_label_set_style(label, LV_LABEL_STYLE_MAIN, labelStyle); lv_label_set_text(label, "Hello!"); labelClick = lv_label_create(lv_scr_act(), NULL); - lv_label_set_style(labelClick, LV_LABEL_STYLE_MAIN, labelStyle); lv_obj_align(labelClick, button, LV_ALIGN_OUT_BOTTOM_MID, 0, 30); lv_label_set_text(labelClick, "0"); } diff --git a/src/DisplayApp/Screens/Message.h b/src/DisplayApp/Screens/Message.h index 4e87bba4..6ddcbb43 100644 --- a/src/DisplayApp/Screens/Message.h +++ b/src/DisplayApp/Screens/Message.h @@ -22,8 +22,6 @@ namespace Pinetime { void OnObjectEvent(lv_obj_t* obj, lv_event_t event); private: - - lv_style_t* labelStyle; lv_obj_t * label; lv_obj_t* backgroundLabel; lv_obj_t * button;