diff --git a/radio/src/gui/colorlcd/libui/fullscreen_dialog.cpp b/radio/src/gui/colorlcd/libui/fullscreen_dialog.cpp index 83261aa8e29..cd2fa4040cd 100644 --- a/radio/src/gui/colorlcd/libui/fullscreen_dialog.cpp +++ b/radio/src/gui/colorlcd/libui/fullscreen_dialog.cpp @@ -106,7 +106,7 @@ void FullScreenDialog::build() if (!action.empty()) { auto btn = new TextButton( - this, {(LCD_W - 280) / 2, LCD_H - 48, 280, 40}, action.c_str(), + this, {(LCD_W - ONEBTN_W) / 2, LCD_H - ONEBTN_H - PAD_LARGE, ONEBTN_W, ONEBTN_H}, action.c_str(), [=]() { closeDialog(); return 0; @@ -116,7 +116,7 @@ void FullScreenDialog::build() } else { if (type == WARNING_TYPE_CONFIRM) { auto btn = new TextButton( - this, {LCD_W / 3 - 50, LCD_H - 48, 100, 40}, STR_EXIT, + this, {LCD_W / 3 - TWOBTN_W / 2, LCD_H - TWOBTN_H - PAD_LARGE, TWOBTN_W, TWOBTN_H}, STR_EXIT, [=]() { deleteLater(); return 0; @@ -124,7 +124,7 @@ void FullScreenDialog::build() etx_bg_color(btn->getLvObj(), COLOR_THEME_SECONDARY3_INDEX); etx_txt_color(btn->getLvObj(), COLOR_THEME_PRIMARY1_INDEX); btn = new TextButton( - this, {LCD_W * 2 / 3 - 50, LCD_H - 48, 100, 40}, STR_OK, + this, {LCD_W * 2 / 3 - TWOBTN_W / 2, LCD_H - TWOBTN_H - PAD_LARGE, TWOBTN_W, TWOBTN_H}, STR_OK, [=]() { closeDialog(); return 0; diff --git a/radio/src/gui/colorlcd/libui/fullscreen_dialog.h b/radio/src/gui/colorlcd/libui/fullscreen_dialog.h index e08024d9a37..9993c924831 100644 --- a/radio/src/gui/colorlcd/libui/fullscreen_dialog.h +++ b/radio/src/gui/colorlcd/libui/fullscreen_dialog.h @@ -66,6 +66,10 @@ class FullScreenDialog : public Window static LAYOUT_VAL(ALERT_TITLE_LEFT, 146, 140, LS(146)) static LAYOUT_VAL(ALERT_MESSAGE_TOP, ALERT_TITLE_TOP + 85, ALERT_TITLE_TOP + 130, ALERT_TITLE_TOP + LS(85)) static LAYOUT_VAL(ALERT_MESSAGE_LEFT, ALERT_TITLE_LEFT, 15, ALERT_TITLE_LEFT) + static LAYOUT_VAL(ONEBTN_W, 280, 280, LS(280)) + static LAYOUT_VAL(ONEBTN_H, 40, 40, LS(40)) + static LAYOUT_VAL(TWOBTN_W, 100, 100, LS(100)) + static LAYOUT_VAL(TWOBTN_H, 40, 40, LS(40)) protected: uint8_t type; diff --git a/radio/src/gui/colorlcd/startup_shutdown.cpp b/radio/src/gui/colorlcd/startup_shutdown.cpp index a7161380a0d..d80f52ff0aa 100644 --- a/radio/src/gui/colorlcd/startup_shutdown.cpp +++ b/radio/src/gui/colorlcd/startup_shutdown.cpp @@ -31,7 +31,7 @@ extern void checkSpeakerVolume(); const std::string ver_str = "" VERSION_TAG; const std::string nam_str = "" CODENAME; #if PORTRAIT_LCD -#define TXT_Y 404 +#define TXT_Y (LCD_H * 21 / 25)) #else #define TXT_Y (LCD_H * 3 / 4) #endif @@ -40,13 +40,15 @@ const std::string ver_str = "" VERSION; const std::string nam_str = "" VERSION_SUFFIX; const std::string git_str = "(" GIT_STR ")"; #if PORTRAIT_LCD -#define TXT_Y 380 +#define TXT_Y (LCD_H * 19 / 24) #else #define TXT_Y (LCD_H * 2 / 3) #endif #endif +static LAYOUT_VAL(TXT_W, 200, 200, LS(200)) static LAYOUT_VAL(TXT_H, 24, 24, LS(24)) +static LAYOUT_VAL(TXT_XO, 100, 100, LS(100)) #if !PORTRAIT_LCD #define TXT_X (LCD_W * 4 / 5) @@ -62,27 +64,6 @@ const uint8_t __bmp_splash_logo[]{ #include "splash_logo.lbm" }; -void draw_splash_cb(lv_event_t* e) -{ - auto draw_ctx = lv_event_get_draw_ctx(e); - auto splashImg = (BitmapBuffer*)lv_event_get_user_data(e); - - if (splashImg) { - lv_draw_img_dsc_t img_dsc; - lv_draw_img_dsc_init(&img_dsc); - - lv_area_t coords; - coords.x1 = (LCD_W / 2) - (splashImg->width() / 2); - coords.y1 = (LCD_H / 2) - (splashImg->height() / 2); - coords.x2 = coords.x1 + splashImg->width() - 1; - coords.y2 = coords.y1 + splashImg->height() - 1; - - lv_draw_img_decoded(draw_ctx, &img_dsc, &coords, - (const uint8_t*)splashImg->getData(), - LV_IMG_CF_TRUE_COLOR); - } -} - static Window* splashScreen = nullptr; void drawSplash() @@ -103,11 +84,11 @@ void drawSplash() new StaticLZ4Image(splashScreen, IMG_X - logo->width / 2, IMG_Y - logo->height / 2, logo); - new StaticText(splashScreen, {TXT_X - 100, TXT_Y, 200, 24}, ver_str.c_str(), COLOR_GREY_INDEX, CENTERED); - new StaticText(splashScreen, {TXT_X - 100, TXT_Y + TXT_H, 200, TXT_H}, + new StaticText(splashScreen, {TXT_X - TXT_XO, TXT_Y, TXT_W, TXT_H}, ver_str.c_str(), COLOR_GREY_INDEX, CENTERED); + new StaticText(splashScreen, {TXT_X - TXT_XO, TXT_Y + TXT_H, TXT_W, TXT_H}, nam_str.c_str(), COLOR_GREY_INDEX, CENTERED); #if !defined(VERSION_TAG) - new StaticText(splashScreen, {TXT_X - 100, TXT_Y + TXT_H * 2, 200, TXT_H}, + new StaticText(splashScreen, {TXT_X - TXT_XO, TXT_Y + TXT_H * 2, TXT_W, TXT_H}, git_str.c_str(), COLOR_GREY_INDEX, CENTERED); #endif } @@ -174,7 +155,7 @@ void waitSplash() cancelSplash(); } -#define SHUTDOWN_CIRCLE_RADIUS 75 +static LAYOUT_VAL(SHUTDOWN_CIRCLE_RADIUS, 75, 75, LS(75)) const int8_t bmp_shutdown_xo[] = {0, 0, -SHUTDOWN_CIRCLE_RADIUS, -SHUTDOWN_CIRCLE_RADIUS};