mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-08-13 03:13:41 +00:00
Auto update ext apps (#3046)
* first naive impl * Unregister sdcard notification * btngrid reload_items fixed * format-code * Avoid some unnecessary updates * clear empty space after removing items * Fix displaying sdcard error after inserting card while running * format code * Eliminate multiple update_items() calls from on_populate() And call it only once after on_populate() * update_items() only once when showing btngrid * normalize offset when menu item count decreases
This commit is contained in:
@@ -771,8 +771,6 @@ void add_apps(NavigationView& nav, BtnGridView& grid, app_location_t loc) {
|
||||
true);
|
||||
}
|
||||
};
|
||||
|
||||
grid.update_items();
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
@@ -789,7 +787,7 @@ void add_external_items(NavigationView& nav, app_location_t location, BtnGridVie
|
||||
"Check SD card\n"
|
||||
"Update SD card content\n");
|
||||
}},
|
||||
error_tile_pos);
|
||||
error_tile_pos, true);
|
||||
} else {
|
||||
std::sort(externalItems.begin(), externalItems.end(), [](const auto &a, const auto &b)
|
||||
{
|
||||
@@ -804,8 +802,6 @@ void add_external_items(NavigationView& nav, app_location_t location, BtnGridVie
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
grid.update_items();
|
||||
}
|
||||
}
|
||||
// clang-format on
|
||||
@@ -824,7 +820,8 @@ ReceiversMenuView::ReceiversMenuView(NavigationView& nav)
|
||||
void ReceiversMenuView::on_populate() {
|
||||
bool return_icon = pmem::show_gui_return_icon();
|
||||
if (return_icon) {
|
||||
add_item({"..", Theme::getInstance()->fg_light->foreground, &bitmap_icon_previous, [this]() { nav_.pop(); }});
|
||||
add_item({"..", Theme::getInstance()->fg_light->foreground, &bitmap_icon_previous, [this]() { nav_.pop(); }},
|
||||
true);
|
||||
}
|
||||
add_apps(nav_, *this, RX);
|
||||
add_external_items(nav_, app_location_t::RX, *this, return_icon ? 1 : 0);
|
||||
@@ -913,14 +910,15 @@ SystemMenuView::SystemMenuView(NavigationView& nav)
|
||||
}
|
||||
|
||||
void SystemMenuView::on_populate() {
|
||||
if (!verify_sdcard_format()) {
|
||||
add_item({"SDCard Error", Theme::getInstance()->error_dark->foreground, nullptr, [this]() {
|
||||
nav_.display_modal("Error", "SD Card is not exFAT/FAT32");
|
||||
}});
|
||||
}
|
||||
add_apps(nav_, *this, HOME);
|
||||
add_external_items(nav_, app_location_t::HOME, *this, 0);
|
||||
add_item({"HackRF", Theme::getInstance()->fg_cyan->foreground, &bitmap_icon_hackrf, [this]() { hackrf_mode(nav_); }});
|
||||
if (!verify_sdcard_format()) { // Moved to the end... after sd status change event, fstype wasn't populated fast enough..
|
||||
insert_item({"SDCard Error", Theme::getInstance()->error_dark->foreground, nullptr, [this]() {
|
||||
nav_.display_modal("Error", "SD Card is not exFAT/FAT32");
|
||||
}},
|
||||
0, true);
|
||||
}
|
||||
}
|
||||
|
||||
/* SystemView ************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user