xremote_scene_infoscreen.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #include "../xremote.h"
  2. #include "../helpers/xremote_custom_event.h"
  3. #include "../views/xremote_infoscreen.h"
  4. void xremote_scene_infoscreen_callback(XRemoteCustomEvent event, void* context) {
  5. furi_assert(context);
  6. XRemote* app = context;
  7. view_dispatcher_send_custom_event(app->view_dispatcher, event);
  8. }
  9. void xremote_scene_infoscreen_on_enter(void* context) {
  10. furi_assert(context);
  11. XRemote* app = context;
  12. xremote_infoscreen_set_callback(
  13. app->xremote_infoscreen, xremote_scene_infoscreen_callback, app);
  14. view_dispatcher_switch_to_view(app->view_dispatcher, XRemoteViewIdInfoscreen);
  15. }
  16. bool xremote_scene_infoscreen_on_event(void* context, SceneManagerEvent event) {
  17. XRemote* app = context;
  18. bool consumed = false;
  19. if(event.type == SceneManagerEventTypeCustom) {
  20. switch(event.event) {
  21. case XRemoteCustomEventInfoscreenLeft:
  22. case XRemoteCustomEventInfoscreenRight:
  23. break;
  24. case XRemoteCustomEventInfoscreenUp:
  25. case XRemoteCustomEventInfoscreenDown:
  26. break;
  27. case XRemoteCustomEventInfoscreenOk:
  28. scene_manager_next_scene(app->scene_manager, XRemoteSceneMenu);
  29. consumed = true;
  30. break;
  31. case XRemoteCustomEventInfoscreenBack:
  32. notification_message(app->notification, &sequence_reset_red);
  33. notification_message(app->notification, &sequence_reset_green);
  34. notification_message(app->notification, &sequence_reset_blue);
  35. if(!scene_manager_search_and_switch_to_previous_scene(
  36. app->scene_manager, XRemoteSceneInfoscreen)) {
  37. scene_manager_stop(app->scene_manager);
  38. view_dispatcher_stop(app->view_dispatcher);
  39. }
  40. consumed = true;
  41. break;
  42. }
  43. }
  44. return consumed;
  45. }
  46. void xremote_scene_infoscreen_on_exit(void* context) {
  47. XRemote* app = context;
  48. UNUSED(app);
  49. }