Fix setupui (#1777)

* Enhance GitHub Actions artifact download script

- Updated the output directory structure to save downloaded files in a version-specific subdirectory (releases/<version>).
- Added a new function to determine the default releases directory path relative to the script's location.
- Improved artifact renaming logic to handle known extensions more robustly and ensure compatibility with filenames containing dots.

* Refactor UI setup in ElectronEmojiDisplay and OttoEmojiDisplay classes

- Moved SetupChatLabel call in ElectronEmojiDisplay to ensure it is executed after the parent UI is initialized, preventing potential issues with container validity.
- Updated SetupUI in OttoEmojiDisplay to release the display lock before calling SetEmotion, avoiding deadlock scenarios during UI setup.

* Add multiline chat message support in display configuration

- Introduced a new Kconfig option to enable multiline chat message display in the default mode.
- Updated the LCD display setup to accommodate a dynamic height bottom bar for multiline messages.
- Modified the configuration files for the waveshare-esp32-s3-epaper-1.54 board to include the new chat message setting.

* Update font and emoji settings for Magiclick boards; enhance bottom bar visibility logic in LCD display

- Changed the default text and emoji fonts for Magiclick S3 2P4 and S3 2P5 boards to Noto fonts.
- Improved bottom bar visibility logic in LcdDisplay to hide when there is no content, ensuring a cleaner UI experience.
This commit is contained in:
Xiaoxia
2026-02-19 20:10:27 +08:00
committed by GitHub
parent 4666ecef82
commit 71c86ab62b
10 changed files with 145 additions and 45 deletions

View File

@ -924,9 +924,33 @@ void LcdDisplay::SetupUI() {
lv_label_set_text(status_label_, Lang::Strings::INITIALIZING);
lv_obj_align(status_label_, LV_ALIGN_CENTER, 0, 0);
#if CONFIG_USE_MULTILINE_CHAT_MESSAGE
/* Bottom bar - auto height, grows upward with wrapped text */
bottom_bar_ = lv_obj_create(screen);
lv_obj_set_width(bottom_bar_, LV_HOR_RES);
lv_obj_set_height(bottom_bar_, LV_SIZE_CONTENT);
lv_obj_set_style_radius(bottom_bar_, 0, 0);
lv_obj_set_style_bg_color(bottom_bar_, lvgl_theme->background_color(), 0);
lv_obj_set_style_bg_opa(bottom_bar_, LV_OPA_50, 0);
lv_obj_set_style_text_color(bottom_bar_, lvgl_theme->text_color(), 0);
lv_obj_set_style_pad_all(bottom_bar_, lvgl_theme->spacing(4), 0);
lv_obj_set_style_border_width(bottom_bar_, 0, 0);
lv_obj_set_scrollbar_mode(bottom_bar_, LV_SCROLLBAR_MODE_OFF);
lv_obj_align(bottom_bar_, LV_ALIGN_BOTTOM_MID, 0, 0);
/* chat_message_label_ placed in bottom_bar_, multiline wrapped display */
chat_message_label_ = lv_label_create(bottom_bar_);
lv_label_set_text(chat_message_label_, "");
lv_obj_set_width(chat_message_label_, LV_HOR_RES - lvgl_theme->spacing(8));
lv_label_set_long_mode(chat_message_label_, LV_LABEL_LONG_WRAP);
lv_obj_set_style_text_align(chat_message_label_, LV_TEXT_ALIGN_CENTER, 0);
lv_obj_set_style_text_color(chat_message_label_, lvgl_theme->text_color(), 0);
lv_obj_align(chat_message_label_, LV_ALIGN_CENTER, 0, 0);
lv_obj_add_flag(bottom_bar_, LV_OBJ_FLAG_HIDDEN); // Hide until there is content
#else
/* Top layer: Bottom bar - fixed height at bottom */
bottom_bar_ = lv_obj_create(screen);
lv_obj_set_size(bottom_bar_, LV_HOR_RES, text_font->line_height + lvgl_theme->spacing(12));
lv_obj_set_size(bottom_bar_, LV_HOR_RES, text_font->line_height + lvgl_theme->spacing(8));
lv_obj_set_style_radius(bottom_bar_, 0, 0);
lv_obj_set_style_bg_color(bottom_bar_, lvgl_theme->background_color(), 0);
lv_obj_set_style_text_color(bottom_bar_, lvgl_theme->text_color(), 0);
@ -953,6 +977,8 @@ void LcdDisplay::SetupUI() {
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
lv_obj_set_style_anim(chat_message_label_, &a, LV_PART_MAIN);
lv_obj_set_style_anim_duration(chat_message_label_, lv_anim_speed_clamped(60, 300, 60000), LV_PART_MAIN);
lv_obj_add_flag(bottom_bar_, LV_OBJ_FLAG_HIDDEN); // Hide until there is content
#endif
low_battery_popup_ = lv_obj_create(screen);
lv_obj_set_scrollbar_mode(low_battery_popup_, LV_SCROLLBAR_MODE_OFF);
@ -1016,14 +1042,32 @@ void LcdDisplay::SetChatMessage(const char* role, const char* content) {
return;
}
lv_label_set_text(chat_message_label_, content);
// Show bottom_bar_ only when there is content (and subtitle is not globally hidden)
if (bottom_bar_ != nullptr) {
if (content == nullptr || content[0] == '\0') {
lv_obj_add_flag(bottom_bar_, LV_OBJ_FLAG_HIDDEN);
} else if (!hide_subtitle_) {
lv_obj_remove_flag(bottom_bar_, LV_OBJ_FLAG_HIDDEN);
}
}
#if CONFIG_USE_MULTILINE_CHAT_MESSAGE
// Re-align bottom_bar_ after text change so it stays anchored to the bottom
// as its height adapts to the wrapped content.
if (bottom_bar_ != nullptr) {
lv_obj_align(bottom_bar_, LV_ALIGN_BOTTOM_MID, 0, 0);
}
#endif
}
void LcdDisplay::ClearChatMessages() {
DisplayLockGuard lock(this);
// In non-wechat mode, just clear the chat message label
// In non-wechat mode, just clear the chat message label and hide the bar
if (chat_message_label_ != nullptr) {
lv_label_set_text(chat_message_label_, "");
}
if (bottom_bar_ != nullptr) {
lv_obj_add_flag(bottom_bar_, LV_OBJ_FLAG_HIDDEN);
}
}
#endif
@ -1253,7 +1297,11 @@ void LcdDisplay::SetHideSubtitle(bool hide) {
if (hide) {
lv_obj_add_flag(bottom_bar_, LV_OBJ_FLAG_HIDDEN);
} else {
lv_obj_remove_flag(bottom_bar_, LV_OBJ_FLAG_HIDDEN);
// Only show if there is actual content to display
const char* text = (chat_message_label_ != nullptr) ? lv_label_get_text(chat_message_label_) : nullptr;
if (text != nullptr && text[0] != '\0') {
lv_obj_remove_flag(bottom_bar_, LV_OBJ_FLAG_HIDDEN);
}
}
}
}