hex_viewer_scene_scene_2.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #include "../hex_viewer.h"
  2. #include "../helpers/hex_viewer_custom_event.h"
  3. #include "../helpers/hex_viewer_haptic.h"
  4. #include "../helpers/hex_viewer_led.h"
  5. #include "../views/hex_viewer_scene_2.h"
  6. void hex_viewer_scene_2_callback(HexViewerCustomEvent event, void* context) {
  7. furi_assert(context);
  8. HexViewer* app = context;
  9. view_dispatcher_send_custom_event(app->view_dispatcher, event);
  10. }
  11. void hex_viewer_scene_scene_2_on_enter(void* context) {
  12. furi_assert(context);
  13. HexViewer* app = context;
  14. hex_viewer_scene_2_set_callback(app->hex_viewer_scene_2, hex_viewer_scene_2_callback, app);
  15. view_dispatcher_switch_to_view(app->view_dispatcher, HexViewerViewIdScene2);
  16. }
  17. bool hex_viewer_scene_scene_2_on_event(void* context, SceneManagerEvent event) {
  18. HexViewer* app = context;
  19. bool consumed = false;
  20. if(event.type == SceneManagerEventTypeCustom) {
  21. switch(event.event) {
  22. case HexViewerCustomEventScene2Left:
  23. case HexViewerCustomEventScene2Right:
  24. break;
  25. case HexViewerCustomEventScene2Up:
  26. case HexViewerCustomEventScene2Down:
  27. break;
  28. case HexViewerCustomEventScene2Back:
  29. notification_message(app->notification, &sequence_reset_red);
  30. notification_message(app->notification, &sequence_reset_green);
  31. notification_message(app->notification, &sequence_reset_blue);
  32. if(!scene_manager_search_and_switch_to_previous_scene(
  33. app->scene_manager, HexViewerSceneMenu)) {
  34. scene_manager_stop(app->scene_manager);
  35. view_dispatcher_stop(app->view_dispatcher);
  36. }
  37. consumed = true;
  38. break;
  39. }
  40. }
  41. return consumed;
  42. }
  43. void hex_viewer_scene_scene_2_on_exit(void* context) {
  44. HexViewer* app = context;
  45. UNUSED(app);
  46. }