weebo_scene_info.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. if(weebo_get_figure_series(weebo, name)) {
  20. furi_string_cat_printf(str, "Series: %s\n", furi_string_get_cstr(name));
  21. }
  22. furi_string_free(name);
  23. text_box_set_font(weebo->text_box, TextBoxFontText);
  24. text_box_set_text(weebo->text_box, furi_string_get_cstr(weebo->text_box_store));
  25. view_dispatcher_switch_to_view(weebo->view_dispatcher, WeeboViewTextBox);
  26. }
  27. bool weebo_scene_info_on_event(void* context, SceneManagerEvent event) {
  28. Weebo* weebo = context;
  29. bool consumed = false;
  30. UNUSED(weebo);
  31. if(event.type == SceneManagerEventTypeCustom) {
  32. }
  33. return consumed;
  34. }
  35. void weebo_scene_info_on_exit(void* context) {
  36. Weebo* weebo = context;
  37. // Clear view
  38. text_box_reset(weebo->text_box);
  39. }