avr_isp_scene_success.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "../avr_isp_app_i.h"
  2. void avr_isp_scene_success_popup_callback(void* context) {
  3. furi_assert(context);
  4. AvrIspApp* app = context;
  5. view_dispatcher_send_custom_event(app->view_dispatcher, AvrIspCustomEventSceneSuccess);
  6. }
  7. void avr_isp_scene_success_on_enter(void* context) {
  8. furi_assert(context);
  9. AvrIspApp* app = context;
  10. Popup* popup = app->popup;
  11. popup_set_icon(popup, 32, 5, &I_dolphin_nice_96x59);
  12. popup_set_header(popup, "Success!", 8, 22, AlignLeft, AlignBottom);
  13. popup_set_timeout(popup, 1500);
  14. popup_set_context(popup, app);
  15. popup_set_callback(popup, avr_isp_scene_success_popup_callback);
  16. popup_enable_timeout(popup);
  17. view_dispatcher_switch_to_view(app->view_dispatcher, AvrIspViewPopup);
  18. }
  19. bool avr_isp_scene_success_on_event(void* context, SceneManagerEvent event) {
  20. furi_assert(context);
  21. AvrIspApp* app = context;
  22. if(event.type == SceneManagerEventTypeCustom) {
  23. if(event.event == AvrIspCustomEventSceneSuccess) {
  24. scene_manager_search_and_switch_to_previous_scene(
  25. app->scene_manager, AvrIspSceneStart);
  26. return true;
  27. }
  28. }
  29. return false;
  30. }
  31. void avr_isp_scene_success_on_exit(void* context) {
  32. furi_assert(context);
  33. AvrIspApp* app = context;
  34. Popup* popup = app->popup;
  35. popup_reset(popup);
  36. }