flipperzero-firmware/applications/irda/scene/irda_app_scene_learn_done.cpp
Albert Kharisov 07036cc0f5
[FL-2222] IR fixes (#994)
* Fix elements_multiline_text_aligned
* IR: fix delete menu
* IR: bold text on delete/saved
* IR: add safe back screen
* IR: don't clear text on rename
* Nfc,Infrared: update DialogEx usage

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2022-02-16 14:09:47 +03:00

42 lines
1.3 KiB
C++

#include "../irda_app.h"
#include <dolphin/dolphin.h>
void IrdaAppSceneLearnDone::on_enter(IrdaApp* app) {
IrdaAppViewManager* view_manager = app->get_view_manager();
Popup* popup = view_manager->get_popup();
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
DOLPHIN_DEED(DolphinDeedIrSave);
if(app->get_learn_new_remote()) {
popup_set_header(popup, "New remote\ncreated!", 0, 0, AlignLeft, AlignTop);
} else {
popup_set_header(popup, "Saved!", 5, 7, AlignLeft, AlignTop);
}
popup_set_callback(popup, IrdaApp::popup_callback);
popup_set_context(popup, app);
popup_set_timeout(popup, 1500);
popup_enable_timeout(popup);
view_manager->switch_to(IrdaAppViewManager::ViewType::Popup);
}
bool IrdaAppSceneLearnDone::on_event(IrdaApp* app, IrdaAppEvent* event) {
bool consumed = false;
if(event->type == IrdaAppEvent::Type::PopupTimer) {
app->switch_to_next_scene(IrdaApp::Scene::Remote);
consumed = true;
}
return consumed;
}
void IrdaAppSceneLearnDone::on_exit(IrdaApp* app) {
app->set_learn_new_remote(false);
IrdaAppViewManager* view_manager = app->get_view_manager();
Popup* popup = view_manager->get_popup();
popup_set_header(popup, nullptr, 0, 0, AlignLeft, AlignTop);
}