xremote_custom_view.c 1.2 KB

123456789101112131415161718192021222324252627282930313233
  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. furi_assert(context);
  12. XRemoteViewModel* model = context;
  13. XRemoteAppContext* app_ctx = model->context;
  14. ViewOrientation orientation = app_ctx->app_settings->orientation;
  15. uint64_t x = orientation == ViewOrientationVertical ? 70 : 34;
  16. xremote_canvas_draw_header(canvas, orientation, "Custom");
  17. canvas_set_font(canvas, FontSecondary);
  18. canvas_draw_str(canvas, 0, x, "Coming Soon.");
  19. xremote_canvas_draw_exit_footer(canvas, orientation, "Press to exit");
  20. }
  21. XRemoteView* xremote_custom_view_alloc(void* app_ctx) {
  22. XRemoteView* view = xremote_view_alloc(app_ctx, NULL, xremote_custom_view_draw_callback);
  23. with_view_model(
  24. xremote_view_get_view(view), XRemoteViewModel * model, { model->context = app_ctx; }, true);
  25. return view;
  26. }