hex_viewer_scene_startscreen.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include "../hex_viewer.h"
  2. #include "../helpers/hex_viewer_custom_event.h"
  3. #include "../views/hex_viewer_startscreen.h"
  4. void hex_viewer_scene_startscreen_callback(BoilerplateCustomEvent event, void* context) {
  5. furi_assert(context);
  6. Boilerplate* app = context;
  7. view_dispatcher_send_custom_event(app->view_dispatcher, event);
  8. }
  9. void hex_viewer_scene_startscreen_on_enter(void* context) {
  10. furi_assert(context);
  11. Boilerplate* app = context;
  12. hex_viewer_startscreen_set_callback(app->hex_viewer_startscreen, hex_viewer_scene_startscreen_callback, app);
  13. view_dispatcher_switch_to_view(app->view_dispatcher, BoilerplateViewIdStartscreen);
  14. }
  15. bool hex_viewer_scene_startscreen_on_event(void* context, SceneManagerEvent event) {
  16. Boilerplate* app = context;
  17. bool consumed = false;
  18. if(event.type == SceneManagerEventTypeCustom) {
  19. switch(event.event) {
  20. case BoilerplateCustomEventStartscreenLeft:
  21. case BoilerplateCustomEventStartscreenRight:
  22. break;
  23. case BoilerplateCustomEventStartscreenUp:
  24. case BoilerplateCustomEventStartscreenDown:
  25. break;
  26. case BoilerplateCustomEventStartscreenOk:
  27. scene_manager_next_scene(app->scene_manager, BoilerplateSceneMenu);
  28. consumed = true;
  29. break;
  30. case BoilerplateCustomEventStartscreenBack:
  31. notification_message(app->notification, &sequence_reset_red);
  32. notification_message(app->notification, &sequence_reset_green);
  33. notification_message(app->notification, &sequence_reset_blue);
  34. if(!scene_manager_search_and_switch_to_previous_scene(
  35. app->scene_manager, BoilerplateSceneStartscreen)) {
  36. scene_manager_stop(app->scene_manager);
  37. view_dispatcher_stop(app->view_dispatcher);
  38. }
  39. consumed = true;
  40. break;
  41. }
  42. }
  43. return consumed;
  44. }
  45. void hex_viewer_scene_startscreen_on_exit(void* context) {
  46. Boilerplate* app = context;
  47. UNUSED(app);
  48. }