51f5641c5e
* FIX: Fixed inconsistencies between texts: I have changed inconsistencies. Sometimes there was a missing capital letter and sometimes there was dot instead of exclamation mark and so on. No other changes were made. I have made the correction based on how other text looks on Fliper and for headers most texts use Pascal Case. * FIX: Fixed inconsistencies between texts: Found 2 more texts with inconsistencies. Co-authored-by: あく <alleteam@gmail.com>
60 lines
2.2 KiB
C++
60 lines
2.2 KiB
C++
#include "lfrfid_app_scene_retry_confirm.h"
|
|
#include "../view/elements/button_element.h"
|
|
#include "../view/elements/icon_element.h"
|
|
#include "../view/elements/string_element.h"
|
|
|
|
void LfRfidAppSceneRetryConfirm::on_enter(LfRfidApp* app, bool /* need_restore */) {
|
|
auto container = app->view_controller.get<ContainerVM>();
|
|
|
|
auto button = container->add<ButtonElement>();
|
|
button->set_type(ButtonElement::Type::Left, "Exit");
|
|
button->set_callback(app, LfRfidAppSceneRetryConfirm::exit_callback);
|
|
|
|
button = container->add<ButtonElement>();
|
|
button->set_type(ButtonElement::Type::Right, "Stay");
|
|
button->set_callback(app, LfRfidAppSceneRetryConfirm::stay_callback);
|
|
|
|
auto line_1 = container->add<StringElement>();
|
|
auto line_2 = container->add<StringElement>();
|
|
|
|
line_1->set_text("Return to Reading?", 64, 19, 128 - 2, AlignCenter, AlignBottom, FontPrimary);
|
|
line_2->set_text(
|
|
"All unsaved data will be lost!", 64, 29, 0, AlignCenter, AlignBottom, FontSecondary);
|
|
|
|
app->view_controller.switch_to<ContainerVM>();
|
|
}
|
|
|
|
bool LfRfidAppSceneRetryConfirm::on_event(LfRfidApp* app, LfRfidApp::Event* event) {
|
|
bool consumed = false;
|
|
|
|
if(event->type == LfRfidApp::EventType::Next) {
|
|
app->scene_controller.search_and_switch_to_previous_scene({LfRfidApp::SceneType::Read});
|
|
consumed = true;
|
|
} else if(event->type == LfRfidApp::EventType::Stay) {
|
|
app->scene_controller.switch_to_previous_scene();
|
|
consumed = true;
|
|
} else if(event->type == LfRfidApp::EventType::Back) {
|
|
consumed = true;
|
|
}
|
|
|
|
return consumed;
|
|
}
|
|
|
|
void LfRfidAppSceneRetryConfirm::on_exit(LfRfidApp* app) {
|
|
app->view_controller.get<ContainerVM>()->clean();
|
|
}
|
|
|
|
void LfRfidAppSceneRetryConfirm::exit_callback(void* context) {
|
|
LfRfidApp* app = static_cast<LfRfidApp*>(context);
|
|
LfRfidApp::Event event;
|
|
event.type = LfRfidApp::EventType::Next;
|
|
app->view_controller.send_event(&event);
|
|
}
|
|
|
|
void LfRfidAppSceneRetryConfirm::stay_callback(void* context) {
|
|
LfRfidApp* app = static_cast<LfRfidApp*>(context);
|
|
LfRfidApp::Event event;
|
|
event.type = LfRfidApp::EventType::Stay;
|
|
app->view_controller.send_event(&event);
|
|
}
|