mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-14 16:18:07 +00:00
Restore home menu order (#2384)
* Fix ext notice position ( No need to alter the position of the ext app notice, as there is no back button on the home screen ) * add desired position to external apps * read and store desired location * apply ext apps desired order * fix memory alignment in application_information_t
This commit is contained in:
@@ -118,30 +118,36 @@ void BtnGridView::clear() {
|
||||
menu_item_views.clear();
|
||||
}
|
||||
|
||||
void BtnGridView::add_items(std::initializer_list<GridItem> new_items) {
|
||||
void BtnGridView::add_items(std::initializer_list<GridItem> new_items, bool inhibit_update) {
|
||||
for (auto item : new_items) {
|
||||
if (!blacklisted_app(item))
|
||||
menu_items.push_back(item);
|
||||
}
|
||||
|
||||
update_items();
|
||||
}
|
||||
|
||||
void BtnGridView::add_item(GridItem new_item) {
|
||||
if (!blacklisted_app(new_item)) {
|
||||
menu_items.push_back(new_item);
|
||||
if (!inhibit_update) {
|
||||
update_items();
|
||||
}
|
||||
}
|
||||
|
||||
void BtnGridView::insert_item(GridItem new_item, uint8_t position) {
|
||||
void BtnGridView::add_item(const GridItem& new_item, bool inhibit_update) {
|
||||
if (!blacklisted_app(new_item)) {
|
||||
menu_items.push_back(new_item);
|
||||
if (!inhibit_update) {
|
||||
update_items();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BtnGridView::insert_item(const GridItem& new_item, size_t position, bool inhibit_update) {
|
||||
if (!blacklisted_app(new_item)) {
|
||||
if (position < menu_items.size()) {
|
||||
auto pos_iter = menu_items.begin() + position;
|
||||
menu_items.insert(pos_iter, new_item);
|
||||
update_items();
|
||||
} else {
|
||||
menu_items.push_back(new_item);
|
||||
}
|
||||
|
||||
if (!inhibit_update) {
|
||||
update_items();
|
||||
}
|
||||
}
|
||||
|
@@ -59,9 +59,9 @@ class BtnGridView : public View {
|
||||
|
||||
~BtnGridView();
|
||||
|
||||
void add_items(std::initializer_list<GridItem> new_items);
|
||||
void add_item(GridItem new_item);
|
||||
void insert_item(GridItem new_item, uint8_t position);
|
||||
void add_items(std::initializer_list<GridItem> new_items, bool inhibit_update = false);
|
||||
void add_item(const GridItem& new_item, bool inhibit_update = false);
|
||||
void insert_item(const GridItem& new_item, size_t position, bool inhibit_update = false);
|
||||
void set_max_rows(int rows);
|
||||
int rows();
|
||||
void clear();
|
||||
@@ -81,12 +81,13 @@ class BtnGridView : public View {
|
||||
bool on_encoder(const EncoderEvent event) override;
|
||||
bool blacklisted_app(GridItem new_item);
|
||||
|
||||
void update_items();
|
||||
|
||||
protected:
|
||||
virtual void on_populate() = 0;
|
||||
|
||||
private:
|
||||
int rows_{3};
|
||||
void update_items();
|
||||
void on_tick_second();
|
||||
|
||||
bool keep_highlight{false};
|
||||
|
Reference in New Issue
Block a user