mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-24 22:07:14 +03:00
b22ad77bbe
* [FL-2403] Changed (Name and save) buttons name * [FL-2403] NFC Reading revert LED color to blue * [FL-2438] Capital_letter_menu_names * [FL-2438] Capital_letter_menu_names * [FL-2438] Rename and unify menu items with capitals * [FL-2438] Capital_letter_menu_and_returned_Empty_folder * [FL-2438] Capital_letter_menu_and_returned_Empty_folder_label * [FL-2438] Capital_letter_menu_and_returned_Empty_folder_label_reformating Co-authored-by: あく <alleteam@gmail.com>
67 lines
2.2 KiB
C++
67 lines
2.2 KiB
C++
#include "../infrared_app.h"
|
|
|
|
typedef enum {
|
|
SubmenuIndexUniversalLibrary,
|
|
SubmenuIndexLearnNewRemote,
|
|
SubmenuIndexSavedRemotes,
|
|
} SubmenuIndex;
|
|
|
|
static void submenu_callback(void* context, uint32_t index) {
|
|
InfraredApp* app = static_cast<InfraredApp*>(context);
|
|
InfraredAppEvent event;
|
|
|
|
event.type = InfraredAppEvent::Type::MenuSelected;
|
|
event.payload.menu_index = index;
|
|
|
|
app->get_view_manager()->send_event(&event);
|
|
}
|
|
|
|
void InfraredAppSceneStart::on_enter(InfraredApp* app) {
|
|
InfraredAppViewManager* view_manager = app->get_view_manager();
|
|
Submenu* submenu = view_manager->get_submenu();
|
|
|
|
submenu_add_item(
|
|
submenu, "Universal Library", SubmenuIndexUniversalLibrary, submenu_callback, app);
|
|
submenu_add_item(
|
|
submenu, "Learn New Remote", SubmenuIndexLearnNewRemote, submenu_callback, app);
|
|
submenu_add_item(submenu, "Saved Remotes", SubmenuIndexSavedRemotes, submenu_callback, app);
|
|
submenu_set_selected_item(submenu, submenu_item_selected);
|
|
submenu_item_selected = 0;
|
|
|
|
view_manager->switch_to(InfraredAppViewManager::ViewId::Submenu);
|
|
}
|
|
|
|
bool InfraredAppSceneStart::on_event(InfraredApp* app, InfraredAppEvent* event) {
|
|
bool consumed = false;
|
|
|
|
if(event->type == InfraredAppEvent::Type::MenuSelected) {
|
|
submenu_item_selected = event->payload.menu_index;
|
|
switch(event->payload.menu_index) {
|
|
case SubmenuIndexUniversalLibrary:
|
|
app->switch_to_next_scene(InfraredApp::Scene::Universal);
|
|
break;
|
|
case SubmenuIndexLearnNewRemote:
|
|
app->set_learn_new_remote(true);
|
|
app->switch_to_next_scene(InfraredApp::Scene::Learn);
|
|
break;
|
|
case SubmenuIndexSavedRemotes:
|
|
app->switch_to_next_scene(InfraredApp::Scene::RemoteList);
|
|
break;
|
|
default:
|
|
furi_assert(0);
|
|
break;
|
|
}
|
|
consumed = true;
|
|
}
|
|
|
|
return consumed;
|
|
}
|
|
|
|
void InfraredAppSceneStart::on_exit(InfraredApp* app) {
|
|
InfraredAppViewManager* view_manager = app->get_view_manager();
|
|
Submenu* submenu = view_manager->get_submenu();
|
|
|
|
app->get_remote_manager()->reset_remote();
|
|
submenu_reset(submenu);
|
|
}
|