xremote_custom_view.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*!
  2. * @file flipper-xremote/views/xremote_custom_view.c
  3. @license This project is released under the GNU GPLv3 License
  4. * @copyright (c) 2023 Sandro Kalatozishvili (s.kalatoz@gmail.com)
  5. *
  6. * @brief Custom layout UI and view functionality for remote buttons.
  7. */
  8. #include "xremote_custom_view.h"
  9. #include "../xremote_app.h"
  10. static void xremote_custom_view_draw_callback(Canvas* canvas, void* context)
  11. {
  12. furi_assert(context);
  13. XRemoteViewModel* model = context;
  14. XRemoteAppContext *app_ctx = model->context;
  15. ViewOrientation orientation = app_ctx->app_settings->orientation;
  16. uint64_t x = orientation == ViewOrientationVertical ? 70 : 34;
  17. xremote_canvas_draw_header(canvas, orientation, "Custom");
  18. canvas_set_font(canvas, FontSecondary);
  19. canvas_draw_str(canvas, 0, x, "Coming Soon.");
  20. xremote_canvas_draw_exit_footer(canvas, orientation, "Press to exit");
  21. }
  22. XRemoteView* xremote_custom_view_alloc(void* app_ctx)
  23. {
  24. XRemoteView *view = xremote_view_alloc(app_ctx,
  25. NULL, xremote_custom_view_draw_callback);
  26. with_view_model(
  27. xremote_view_get_view(view),
  28. XRemoteViewModel* model,
  29. { model->context = app_ctx; },
  30. true
  31. );
  32. return view;
  33. }