diff --git a/.build-rules.yml b/.build-rules.yml index 62e6463..2b43e03 100644 --- a/.build-rules.yml +++ b/.build-rules.yml @@ -6,25 +6,25 @@ # Componet test_apps test_apps: enable: - - if: IDF_TARGET in ["esp32s2", "esp32s3", "esp32p4", "esp32c3", "esp32c6"] + - if: IDF_TARGET in ["esp32s3", "esp32p4"] # Examples -examples/esp_brookesia_phone_m5stace_core_s3: +examples/esp_idf/esp_brookesia_phone_m5stace_core_s3: enable: - if: IDF_TARGET in ["esp32s3"] -examples/esp_brookesia_phone_p4_function_ev_board: +examples/esp_idf/esp_brookesia_phone_p4_function_ev_board: enable: - if: IDF_TARGET in ["esp32p4"] -examples/esp_brookesia_phone_s3_box: +examples/esp_idf/esp_brookesia_phone_s3_box: enable: - if: IDF_TARGET in ["esp32s3"] -examples/esp_brookesia_phone_s3_box_3: +examples/esp_idf/esp_brookesia_phone_s3_box_3: enable: - if: IDF_TARGET in ["esp32s3"] -examples/esp_brookesia_phone_s3_lcd_ev_board: +examples/esp_idf/esp_brookesia_phone_s3_lcd_ev_board: enable: - if: IDF_TARGET in ["esp32s3"] diff --git a/CHANGELOG.md b/CHANGELOG.md index 8340a8f..eac0fff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * feat(assets): refactor assets and update stylesheet * feat(phone): add default image for app launcher in stylesheet +* feat(phone): enable recents screen hide when no snapshot by default * feat(widgets): avoid click the next page icon when the app launcher scroll is not finished ### Bugfixes: diff --git a/src/systems/phone/esp_brookesia_phone_manager.cpp b/src/systems/phone/esp_brookesia_phone_manager.cpp index 1662e9b..727c8df 100644 --- a/src/systems/phone/esp_brookesia_phone_manager.cpp +++ b/src/systems/phone/esp_brookesia_phone_manager.cpp @@ -1176,6 +1176,10 @@ void ESP_Brookesia_PhoneManager::onRecentsScreenGestureReleaseEventCallback(lv_e manager->_recents_screen_active_app->getId(), recents_screen_active_snapshot_index); } + } else if (manager->data.flags.enable_recents_screen_hide_when_no_snapshot) { + // If there are no active apps, hide the recents_screen + ESP_BROOKESIA_LOGD("No active app, hide recents_screen"); + ESP_BROOKESIA_CHECK_FALSE_EXIT(manager->processRecentsScreenHide(), "Hide recents_screen failed"); } } } @@ -1198,14 +1202,16 @@ void ESP_Brookesia_PhoneManager::onRecentsScreenSnapshotDeletedEventCallback(lv_ recents_screen = manager->home._recents_screen.get(); ESP_BROOKESIA_CHECK_NULL_EXIT(recents_screen, "Invalid recents_screen"); app_id = (intptr_t)lv_event_get_param(event); - app_event_data.id = app_id; - ESP_BROOKESIA_CHECK_FALSE_EXIT(manager->_core.sendAppEvent(&app_event_data), "Core send app event failed"); + if (app_id > 0) { + app_event_data.id = app_id; + ESP_BROOKESIA_CHECK_FALSE_EXIT(manager->_core.sendAppEvent(&app_event_data), "Core send app event failed"); + } if (recents_screen->getSnapshotCount() == 0) { ESP_BROOKESIA_LOGD("No snapshot in the recents_screen"); manager->_recents_screen_active_app = nullptr; - if (manager->home.getData().flags.enable_recents_screen_hide_when_no_snapshot) { + if (manager->data.flags.enable_recents_screen_hide_when_no_snapshot) { ESP_BROOKESIA_CHECK_FALSE_EXIT(manager->processRecentsScreenHide(), "Manager hide recents_screen failed"); } } diff --git a/src/systems/phone/esp_brookesia_phone_type.h b/src/systems/phone/esp_brookesia_phone_type.h index 9cf340d..abd8a11 100644 --- a/src/systems/phone/esp_brookesia_phone_type.h +++ b/src/systems/phone/esp_brookesia_phone_type.h @@ -43,7 +43,7 @@ typedef struct { uint8_t enable_app_launcher_flex_size: 1; uint8_t enable_recents_screen: 1; uint8_t enable_recents_screen_flex_size: 1; - uint8_t enable_recents_screen_hide_when_no_snapshot: 1; + uint8_t enable_recents_screen_hide_when_no_snapshot: 1; /* Deprecated, use flag in manager instead */ } flags; } ESP_Brookesia_PhoneHomeData_t; @@ -62,6 +62,7 @@ typedef struct { struct { uint8_t enable_gesture: 1; uint8_t enable_recents_screen_snapshot_drag: 1; + uint8_t enable_recents_screen_hide_when_no_snapshot: 1; } flags; } ESP_Brookesia_PhoneManagerData_t; diff --git a/src/systems/phone/stylesheets/1024_600/dark/stylesheet.h b/src/systems/phone/stylesheets/1024_600/dark/stylesheet.h index 436b480..8b24511 100644 --- a/src/systems/phone/stylesheets/1024_600/dark/stylesheet.h +++ b/src/systems/phone/stylesheets/1024_600/dark/stylesheet.h @@ -60,6 +60,7 @@ extern "C" { .flags = { \ .enable_gesture = 1, \ .enable_recents_screen_snapshot_drag = 1, \ + .enable_recents_screen_hide_when_no_snapshot = 1, \ }, \ } diff --git a/src/systems/phone/stylesheets/1280_800/dark/stylesheet.h b/src/systems/phone/stylesheets/1280_800/dark/stylesheet.h index 4a967f6..75ebc6b 100644 --- a/src/systems/phone/stylesheets/1280_800/dark/stylesheet.h +++ b/src/systems/phone/stylesheets/1280_800/dark/stylesheet.h @@ -60,6 +60,7 @@ extern "C" { .flags = { \ .enable_gesture = 1, \ .enable_recents_screen_snapshot_drag = 1, \ + .enable_recents_screen_hide_when_no_snapshot = 1, \ }, \ } diff --git a/src/systems/phone/stylesheets/320_240/dark/stylesheet.h b/src/systems/phone/stylesheets/320_240/dark/stylesheet.h index 06272ad..583651e 100644 --- a/src/systems/phone/stylesheets/320_240/dark/stylesheet.h +++ b/src/systems/phone/stylesheets/320_240/dark/stylesheet.h @@ -43,7 +43,6 @@ extern "C" { .enable_app_launcher_flex_size = 1, \ .enable_recents_screen = 1, \ .enable_recents_screen_flex_size = 1, \ - .enable_recents_screen_hide_when_no_snapshot = 0, \ }, \ } @@ -61,6 +60,7 @@ extern "C" { .flags = { \ .enable_gesture = 1, \ .enable_recents_screen_snapshot_drag = 1, \ + .enable_recents_screen_hide_when_no_snapshot = 1, \ }, \ } diff --git a/src/systems/phone/stylesheets/320_480/dark/stylesheet.h b/src/systems/phone/stylesheets/320_480/dark/stylesheet.h index c4521e9..ef25a2c 100644 --- a/src/systems/phone/stylesheets/320_480/dark/stylesheet.h +++ b/src/systems/phone/stylesheets/320_480/dark/stylesheet.h @@ -43,7 +43,6 @@ extern "C" { .enable_app_launcher_flex_size = 1, \ .enable_recents_screen = 1, \ .enable_recents_screen_flex_size = 1, \ - .enable_recents_screen_hide_when_no_snapshot = 0, \ }, \ } @@ -61,6 +60,7 @@ extern "C" { .flags = { \ .enable_gesture = 1, \ .enable_recents_screen_snapshot_drag = 1, \ + .enable_recents_screen_hide_when_no_snapshot = 1, \ }, \ } diff --git a/src/systems/phone/stylesheets/480_480/dark/stylesheet.h b/src/systems/phone/stylesheets/480_480/dark/stylesheet.h index ce98de0..fee9e33 100644 --- a/src/systems/phone/stylesheets/480_480/dark/stylesheet.h +++ b/src/systems/phone/stylesheets/480_480/dark/stylesheet.h @@ -60,6 +60,7 @@ extern "C" { .flags = { \ .enable_gesture = 1, \ .enable_recents_screen_snapshot_drag = 1, \ + .enable_recents_screen_hide_when_no_snapshot = 1, \ }, \ } diff --git a/src/systems/phone/stylesheets/800_1280/dark/stylesheet.h b/src/systems/phone/stylesheets/800_1280/dark/stylesheet.h index 4c7939a..e9eb429 100644 --- a/src/systems/phone/stylesheets/800_1280/dark/stylesheet.h +++ b/src/systems/phone/stylesheets/800_1280/dark/stylesheet.h @@ -60,6 +60,7 @@ extern "C" { .flags = { \ .enable_gesture = 1, \ .enable_recents_screen_snapshot_drag = 1, \ + .enable_recents_screen_hide_when_no_snapshot = 1, \ }, \ } diff --git a/src/systems/phone/stylesheets/800_480/dark/stylesheet.h b/src/systems/phone/stylesheets/800_480/dark/stylesheet.h index a043e13..69e3b96 100644 --- a/src/systems/phone/stylesheets/800_480/dark/stylesheet.h +++ b/src/systems/phone/stylesheets/800_480/dark/stylesheet.h @@ -60,6 +60,7 @@ extern "C" { .flags = { \ .enable_gesture = 1, \ .enable_recents_screen_snapshot_drag = 1, \ + .enable_recents_screen_hide_when_no_snapshot = 1, \ }, \ } diff --git a/src/systems/phone/stylesheets/default/dark/stylesheet.h b/src/systems/phone/stylesheets/default/dark/stylesheet.h index 7f42bbd..dc6c8a9 100644 --- a/src/systems/phone/stylesheets/default/dark/stylesheet.h +++ b/src/systems/phone/stylesheets/default/dark/stylesheet.h @@ -42,7 +42,6 @@ extern "C" { .enable_app_launcher_flex_size = 1, \ .enable_recents_screen = 1, \ .enable_recents_screen_flex_size = 1, \ - .enable_recents_screen_hide_when_no_snapshot = 0, \ }, \ } @@ -60,6 +59,7 @@ extern "C" { .flags = { \ .enable_gesture = 1, \ .enable_recents_screen_snapshot_drag = 1, \ + .enable_recents_screen_hide_when_no_snapshot = 1, \ }, \ } diff --git a/src/widgets/recents_screen/esp_brookesia_recents_screen.cpp b/src/widgets/recents_screen/esp_brookesia_recents_screen.cpp index 8ca1a47..82f6221 100644 --- a/src/widgets/recents_screen/esp_brookesia_recents_screen.cpp +++ b/src/widgets/recents_screen/esp_brookesia_recents_screen.cpp @@ -613,6 +613,9 @@ void ESP_Brookesia_RecentsScreen::onTrashTouchEventCallback(lv_event_t *event) lv_event_send(recents_screen->getEventObject(), recents_screen->getSnapshotDeletedEventCode(), reinterpret_cast(it.first)); } + // Send this event to notify that trash icon is clicked + lv_event_send(recents_screen->getEventObject(), recents_screen->getSnapshotDeletedEventCode(), + reinterpret_cast(0)); break; case LV_EVENT_PRESSED: ESP_BROOKESIA_LOGD("Pressed");