flipbip_scene_scene_1.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #include "../flipbip.h"
  2. #include "../helpers/flipbip_custom_event.h"
  3. #include "../views/flipbip_scene_1.h"
  4. void flipbip_scene_1_callback(FlipBipCustomEvent event, void* context) {
  5. furi_assert(context);
  6. FlipBip* app = context;
  7. view_dispatcher_send_custom_event(app->view_dispatcher, event);
  8. }
  9. void flipbip_scene_scene_1_on_enter(void* context) {
  10. furi_assert(context);
  11. FlipBip* app = context;
  12. flipbip_scene_1_set_callback(app->flipbip_scene_1, flipbip_scene_1_callback, app);
  13. view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewIdScene1);
  14. }
  15. bool flipbip_scene_scene_1_on_event(void* context, SceneManagerEvent event) {
  16. FlipBip* app = context;
  17. bool consumed = false;
  18. if(event.type == SceneManagerEventTypeCustom) {
  19. switch(event.event) {
  20. case FlipBipCustomEventScene1Left:
  21. case FlipBipCustomEventScene1Right:
  22. break;
  23. case FlipBipCustomEventScene1Up:
  24. case FlipBipCustomEventScene1Down:
  25. break;
  26. case FlipBipCustomEventScene1Back:
  27. notification_message(app->notification, &sequence_reset_red);
  28. notification_message(app->notification, &sequence_reset_green);
  29. notification_message(app->notification, &sequence_reset_blue);
  30. if(!scene_manager_search_and_switch_to_previous_scene(
  31. app->scene_manager, FlipBipSceneMenu)) {
  32. scene_manager_stop(app->scene_manager);
  33. view_dispatcher_stop(app->view_dispatcher);
  34. }
  35. consumed = true;
  36. break;
  37. }
  38. }
  39. return consumed;
  40. }
  41. void flipbip_scene_scene_1_on_exit(void* context) {
  42. FlipBip* app = context;
  43. UNUSED(app);
  44. }