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:
@ -15,7 +15,6 @@
|
||||
ElectronEmojiDisplay::ElectronEmojiDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel, int width, int height, int offset_x, int offset_y, bool mirror_x, bool mirror_y,
|
||||
bool swap_xy)
|
||||
: SpiLcdDisplay(panel_io, panel, width, height, offset_x, offset_y, mirror_x, mirror_y, swap_xy) {
|
||||
SetupChatLabel();
|
||||
}
|
||||
|
||||
void ElectronEmojiDisplay::SetupUI() {
|
||||
@ -25,9 +24,12 @@ void ElectronEmojiDisplay::SetupUI() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Call parent SetupUI() first to create all lvgl objects
|
||||
// Call parent SetupUI() first to create all lvgl objects (including container_)
|
||||
SpiLcdDisplay::SetupUI();
|
||||
|
||||
|
||||
// Setup chat label after parent UI is initialized so that container_ is valid
|
||||
SetupChatLabel();
|
||||
|
||||
// Set default emotion after UI is initialized
|
||||
SetEmotion("staticstate");
|
||||
}
|
||||
@ -40,18 +42,22 @@ void ElectronEmojiDisplay::InitializeElectronEmojis() {
|
||||
}
|
||||
|
||||
void ElectronEmojiDisplay::SetupChatLabel() {
|
||||
DisplayLockGuard lock(this);
|
||||
// Create/recreate the chat label under the display lock
|
||||
{
|
||||
DisplayLockGuard lock(this);
|
||||
|
||||
if (chat_message_label_) {
|
||||
lv_obj_del(chat_message_label_);
|
||||
if (chat_message_label_) {
|
||||
lv_obj_del(chat_message_label_);
|
||||
}
|
||||
|
||||
chat_message_label_ = lv_label_create(container_);
|
||||
lv_label_set_text(chat_message_label_, "");
|
||||
lv_obj_set_width(chat_message_label_, width_ * 0.9);
|
||||
lv_label_set_long_mode(chat_message_label_, LV_LABEL_LONG_SCROLL_CIRCULAR);
|
||||
lv_obj_set_style_text_align(chat_message_label_, LV_TEXT_ALIGN_CENTER, 0);
|
||||
lv_obj_set_style_text_color(chat_message_label_, lv_color_white(), 0);
|
||||
}
|
||||
|
||||
chat_message_label_ = lv_label_create(container_);
|
||||
lv_label_set_text(chat_message_label_, "");
|
||||
lv_obj_set_width(chat_message_label_, width_ * 0.9); // 限制宽度为屏幕宽度的 90%
|
||||
lv_label_set_long_mode(chat_message_label_, LV_LABEL_LONG_SCROLL_CIRCULAR); // 设置为自动换行模式
|
||||
lv_obj_set_style_text_align(chat_message_label_, LV_TEXT_ALIGN_CENTER, 0); // 设置文本居中对齐
|
||||
lv_obj_set_style_text_color(chat_message_label_, lv_color_white(), 0);
|
||||
// SetTheme acquires DisplayLockGuard internally, so call it after releasing the lock above
|
||||
SetTheme(LvglThemeManager::GetInstance().GetTheme("dark"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user