weebo_scene_info.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "../weebo_i.h"
  2. #include <dolphin/dolphin.h>
  3. #define TAG "WeeboSceneInfo"
  4. void weebo_scene_info_on_enter(void* context) {
  5. Weebo* weebo = context;
  6. furi_string_reset(weebo->text_box_store);
  7. FuriString* str = weebo->text_box_store;
  8. FuriString* name = furi_string_alloc();
  9. furi_string_cat_printf(str, "Info:\n");
  10. if(weebo_get_figure_name(weebo, name)) {
  11. furi_string_cat_printf(str, "%s\n", furi_string_get_cstr(name));
  12. } else {
  13. furi_string_cat_printf(str, "Unknown\n");
  14. }
  15. furi_string_cat_printf(str, "ID: %04x\n", weebo_get_figure_id(weebo));
  16. if(weebo_get_figure_form(weebo, name)) {
  17. furi_string_cat_printf(str, "Form: %s\n", furi_string_get_cstr(name));
  18. }
  19. furi_string_free(name);
  20. text_box_set_font(weebo->text_box, TextBoxFontText);
  21. text_box_set_text(weebo->text_box, furi_string_get_cstr(weebo->text_box_store));
  22. view_dispatcher_switch_to_view(weebo->view_dispatcher, WeeboViewTextBox);
  23. }
  24. bool weebo_scene_info_on_event(void* context, SceneManagerEvent event) {
  25. Weebo* weebo = context;
  26. bool consumed = false;
  27. UNUSED(weebo);
  28. if(event.type == SceneManagerEventTypeCustom) {
  29. }
  30. return consumed;
  31. }
  32. void weebo_scene_info_on_exit(void* context) {
  33. Weebo* weebo = context;
  34. // Clear view
  35. text_box_reset(weebo->text_box);
  36. }