nfc_scene_restore_original.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include "../nfc_i.h"
  2. void nfc_scene_restore_original_popup_callback(void* context) {
  3. Nfc* nfc = context;
  4. view_dispatcher_send_custom_event(nfc->view_dispatcher, NfcCustomEventViewExit);
  5. }
  6. void nfc_scene_restore_original_on_enter(void* context) {
  7. Nfc* nfc = context;
  8. // Setup view
  9. Popup* popup = nfc->popup;
  10. popup_set_icon(popup, 32, 5, &I_DolphinNice_96x59);
  11. popup_set_header(popup, "Original file\nrestored", 13, 22, AlignLeft, AlignBottom);
  12. popup_set_timeout(popup, 1500);
  13. popup_set_context(popup, nfc);
  14. popup_set_callback(popup, nfc_scene_restore_original_popup_callback);
  15. popup_enable_timeout(popup);
  16. view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewPopup);
  17. }
  18. bool nfc_scene_restore_original_on_event(void* context, SceneManagerEvent event) {
  19. Nfc* nfc = context;
  20. bool consumed = false;
  21. if(event.type == SceneManagerEventTypeCustom) {
  22. if(event.event == NfcCustomEventViewExit) {
  23. consumed = scene_manager_previous_scene(nfc->scene_manager);
  24. }
  25. }
  26. return consumed;
  27. }
  28. void nfc_scene_restore_original_on_exit(void* context) {
  29. Nfc* nfc = context;
  30. // Clear view
  31. popup_reset(nfc->popup);
  32. }