feat: Implement Discord app UI and settings management
- Added MainUI class for displaying voice state, status icon, and buttons. - Introduced MainUIHandler to manage UI interactions and bridge communication. - Created SettingsUI for displaying QR code and configuration instructions. - Implemented SettingsUIHandler to manage settings and web server interactions. - Developed WebHandler for handling HTTP requests for settings configuration. - Updated AppRegistry to initialize with the new Discord app descriptor. - Enhanced InteractionHandler to support keyboard interactions across app switches. - Updated UIHandler to manage app switching and rendering of app icons. - Enabled QR code support in LVGL configuration.
This commit is contained in:
@@ -12,13 +12,20 @@ InteractionHandler::~InteractionHandler() {
|
||||
}
|
||||
}
|
||||
|
||||
esp_err_t InteractionHandler::init(lv_obj_t* app_container) {
|
||||
if (!app_container) {
|
||||
ESP_LOGE(TAG, "Invalid argument: app_container is nullptr");
|
||||
esp_err_t InteractionHandler::init(lv_obj_t* parent_container) {
|
||||
if (!parent_container) {
|
||||
ESP_LOGE(TAG, "Invalid argument: parent_container is nullptr");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
app_container_ = app_container;
|
||||
keyboard_ = lv_keyboard_create(app_container_);
|
||||
parent_container_ = parent_container;
|
||||
|
||||
keyboard_ = lv_keyboard_create(parent_container_);
|
||||
if (!keyboard_) {
|
||||
ESP_LOGE(TAG, "Failed to create keyboard object");
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Keyboard created successfully at %p", keyboard_);
|
||||
lv_obj_add_flag(keyboard_, LV_OBJ_FLAG_HIDDEN); // start hidden
|
||||
lv_obj_add_event_cb(
|
||||
keyboard_,
|
||||
@@ -102,11 +109,24 @@ void InteractionHandler::on_keyboard_event_(lv_event_t* e) {
|
||||
}
|
||||
|
||||
esp_err_t InteractionHandler::show_keyboard_for_textarea_(lv_obj_t* textarea) {
|
||||
if (!keyboard_ || !textarea) {
|
||||
ESP_LOGE(TAG, "Invalid state or argument in show_keyboard_for_textarea_");
|
||||
if (!textarea) {
|
||||
ESP_LOGE(TAG, "Invalid argument: textarea is nullptr");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (!keyboard_) {
|
||||
ESP_LOGE(TAG, "Keyboard object is nullptr - was InteractionHandler properly initialized?");
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
// Verify keyboard object is still valid
|
||||
if (!lv_obj_is_valid(keyboard_)) {
|
||||
ESP_LOGE(TAG, "Keyboard object is no longer valid - it may have been deleted");
|
||||
keyboard_ = nullptr;
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Showing keyboard for textarea %p", textarea);
|
||||
focused_textarea_ = textarea;
|
||||
lv_keyboard_set_textarea(keyboard_, textarea);
|
||||
lv_obj_clear_flag(keyboard_, LV_OBJ_FLAG_HIDDEN);
|
||||
|
||||
Reference in New Issue
Block a user