Skip to content

Commit

Permalink
feat(phone): enable recents screen hide when no snapshot by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Lzw655 committed Oct 25, 2024
1 parent 69707cb commit 229b9d6
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 13 deletions.
12 changes: 6 additions & 6 deletions .build-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 9 additions & 3 deletions src/systems/phone/esp_brookesia_phone_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
}
Expand All @@ -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");
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/systems/phone/esp_brookesia_phone_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand Down
1 change: 1 addition & 0 deletions src/systems/phone/stylesheets/1024_600/dark/stylesheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ extern "C" {
.flags = { \
.enable_gesture = 1, \
.enable_recents_screen_snapshot_drag = 1, \
.enable_recents_screen_hide_when_no_snapshot = 1, \
}, \
}

Expand Down
1 change: 1 addition & 0 deletions src/systems/phone/stylesheets/1280_800/dark/stylesheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ extern "C" {
.flags = { \
.enable_gesture = 1, \
.enable_recents_screen_snapshot_drag = 1, \
.enable_recents_screen_hide_when_no_snapshot = 1, \
}, \
}

Expand Down
2 changes: 1 addition & 1 deletion src/systems/phone/stylesheets/320_240/dark/stylesheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
}, \
}

Expand All @@ -61,6 +60,7 @@ extern "C" {
.flags = { \
.enable_gesture = 1, \
.enable_recents_screen_snapshot_drag = 1, \
.enable_recents_screen_hide_when_no_snapshot = 1, \
}, \
}

Expand Down
2 changes: 1 addition & 1 deletion src/systems/phone/stylesheets/320_480/dark/stylesheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
}, \
}

Expand All @@ -61,6 +60,7 @@ extern "C" {
.flags = { \
.enable_gesture = 1, \
.enable_recents_screen_snapshot_drag = 1, \
.enable_recents_screen_hide_when_no_snapshot = 1, \
}, \
}

Expand Down
1 change: 1 addition & 0 deletions src/systems/phone/stylesheets/480_480/dark/stylesheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ extern "C" {
.flags = { \
.enable_gesture = 1, \
.enable_recents_screen_snapshot_drag = 1, \
.enable_recents_screen_hide_when_no_snapshot = 1, \
}, \
}

Expand Down
1 change: 1 addition & 0 deletions src/systems/phone/stylesheets/800_1280/dark/stylesheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ extern "C" {
.flags = { \
.enable_gesture = 1, \
.enable_recents_screen_snapshot_drag = 1, \
.enable_recents_screen_hide_when_no_snapshot = 1, \
}, \
}

Expand Down
1 change: 1 addition & 0 deletions src/systems/phone/stylesheets/800_480/dark/stylesheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ extern "C" {
.flags = { \
.enable_gesture = 1, \
.enable_recents_screen_snapshot_drag = 1, \
.enable_recents_screen_hide_when_no_snapshot = 1, \
}, \
}

Expand Down
2 changes: 1 addition & 1 deletion src/systems/phone/stylesheets/default/dark/stylesheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
}, \
}

Expand All @@ -60,6 +59,7 @@ extern "C" {
.flags = { \
.enable_gesture = 1, \
.enable_recents_screen_snapshot_drag = 1, \
.enable_recents_screen_hide_when_no_snapshot = 1, \
}, \
}

Expand Down
3 changes: 3 additions & 0 deletions src/widgets/recents_screen/esp_brookesia_recents_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,9 @@ void ESP_Brookesia_RecentsScreen::onTrashTouchEventCallback(lv_event_t *event)
lv_event_send(recents_screen->getEventObject(), recents_screen->getSnapshotDeletedEventCode(),
reinterpret_cast<void *>(it.first));
}
// Send this event to notify that trash icon is clicked
lv_event_send(recents_screen->getEventObject(), recents_screen->getSnapshotDeletedEventCode(),
reinterpret_cast<void *>(0));
break;
case LV_EVENT_PRESSED:
ESP_BROOKESIA_LOGD("Pressed");
Expand Down

0 comments on commit 229b9d6

Please sign in to comment.