2021-08-11 20:51:06 +03:00
|
|
|
#include "../irda-app.h"
|
2021-06-02 18:16:05 +03:00
|
|
|
|
|
|
|
void IrdaAppSceneLearnDone::on_enter(IrdaApp* app) {
|
|
|
|
IrdaAppViewManager* view_manager = app->get_view_manager();
|
|
|
|
Popup* popup = view_manager->get_popup();
|
|
|
|
|
2021-07-07 11:57:49 +03:00
|
|
|
popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
|
2021-06-02 18:16:05 +03:00
|
|
|
|
|
|
|
if(app->get_learn_new_remote()) {
|
|
|
|
popup_set_text(popup, "New remote\ncreated!", 5, 7, AlignLeft, AlignTop);
|
|
|
|
} else {
|
|
|
|
popup_set_text(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) {
|
2021-07-22 03:07:00 +03:00
|
|
|
app->switch_to_next_scene(IrdaApp::Scene::Remote);
|
2021-06-02 18:16:05 +03:00
|
|
|
consumed = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return consumed;
|
|
|
|
}
|
|
|
|
|
|
|
|
void IrdaAppSceneLearnDone::on_exit(IrdaApp* app) {
|
|
|
|
app->set_learn_new_remote(false);
|
|
|
|
}
|