lfrfid_app_scene_delete_success.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "lfrfid_app_scene_delete_success.h"
  2. void LfRfidAppSceneDeleteSuccess::on_enter(LfRfidApp* app, bool /* need_restore */) {
  3. auto popup = app->view_controller.get<PopupVM>();
  4. popup->set_icon(0, 2, &I_DolphinMafia_115x62);
  5. popup->set_header("Deleted", 83, 19, AlignLeft, AlignBottom);
  6. popup->set_context(app);
  7. popup->set_callback(LfRfidAppSceneDeleteSuccess::timeout_callback);
  8. popup->set_timeout(1500);
  9. popup->enable_timeout();
  10. app->view_controller.switch_to<PopupVM>();
  11. }
  12. bool LfRfidAppSceneDeleteSuccess::on_event(LfRfidApp* app, LfRfidApp::Event* event) {
  13. bool consumed = false;
  14. if(event->type == LfRfidApp::EventType::Back) {
  15. app->scene_controller.search_and_switch_to_previous_scene(
  16. {LfRfidApp::SceneType::SelectKey});
  17. consumed = true;
  18. }
  19. return consumed;
  20. }
  21. void LfRfidAppSceneDeleteSuccess::on_exit(LfRfidApp* app) {
  22. app->view_controller.get<PopupVM>()->clean();
  23. }
  24. void LfRfidAppSceneDeleteSuccess::timeout_callback(void* context) {
  25. LfRfidApp* app = static_cast<LfRfidApp*>(context);
  26. LfRfidApp::Event event;
  27. event.type = LfRfidApp::EventType::Back;
  28. app->view_controller.send_event(&event);
  29. }