mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-23 21:13:16 +00:00
fix[infrared]: select first button on remote change
This commit is contained in:
parent
64edddeabf
commit
9bd6d956ca
3 changed files with 16 additions and 0 deletions
|
@ -83,6 +83,15 @@ ButtonPanel* button_panel_alloc() {
|
|||
return button_panel;
|
||||
}
|
||||
|
||||
void button_panel_reset_selection(ButtonPanel* button_panel) {
|
||||
with_view_model(
|
||||
button_panel->view, (ButtonPanelModel * model) {
|
||||
model->selected_item_x = 0;
|
||||
model->selected_item_y = 0;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
void button_panel_reserve(ButtonPanel* button_panel, size_t reserve_x, size_t reserve_y) {
|
||||
furi_check(reserve_x > 0);
|
||||
furi_check(reserve_y > 0);
|
||||
|
|
|
@ -35,6 +35,12 @@ void button_panel_free(ButtonPanel* button_panel);
|
|||
*/
|
||||
void button_panel_reset(ButtonPanel* button_panel);
|
||||
|
||||
/** Resets selected_item_x and selected_item_y.
|
||||
*
|
||||
* @param button_panel ButtonPanel instance
|
||||
*/
|
||||
void button_panel_reset_selection(ButtonPanel* button_panel);
|
||||
|
||||
/** Reserve space for adding items.
|
||||
*
|
||||
* One does not simply use button_panel_add_item() without this function. It
|
||||
|
|
|
@ -33,6 +33,7 @@ static void infrared_scene_universal_common_hide_popup(Infrared* infrared) {
|
|||
|
||||
void infrared_scene_universal_common_on_enter(void* context) {
|
||||
Infrared* infrared = context;
|
||||
button_panel_reset_selection(infrared->button_panel);
|
||||
view_stack_add_view(infrared->view_stack, button_panel_get_view(infrared->button_panel));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue