hex_viewer_scene_scene_4.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #include "../hex_viewer.h"
  2. void hex_viewer_scene_scene_4_on_enter(void* context) {
  3. furi_assert(context);
  4. HexViewer* app = context;
  5. // DialogsFileBrowserOptions browser_options;
  6. // This will filter the browser to only show one file type and also add an icon
  7. // dialog_file_browser_set_basic_options(&browser_options, SUBGHZ_APP_EXTENSION, &I_sub1_10px);
  8. // Get the Folder you want to browse
  9. // browser_options.base_path = SUBGHZ_APP_FOLDER;
  10. // FuriString* path;
  11. // path = furi_string_alloc();
  12. // furi_string_set(path, SUBGHZ_APP_FOLDER);
  13. // bool success = dialog_file_browser_show(
  14. // app->dialogs, app->file_path, path, &browser_options);
  15. // furi_string_free(path);
  16. FuriString* initial_path;
  17. initial_path = furi_string_alloc();
  18. furi_string_set(initial_path, HEX_VIEWER_APP_PATH_FOLDER);
  19. DialogsFileBrowserOptions browser_options;
  20. dialog_file_browser_set_basic_options(&browser_options, HEX_VIEWER_APP_EXTENSION, &I_hex_10px);
  21. browser_options.hide_ext = false;
  22. bool success =
  23. dialog_file_browser_show(app->dialogs, app->file_path, initial_path, &browser_options);
  24. furi_string_free(initial_path);
  25. if(success) {
  26. success = hex_viewer_open_file(app, furi_string_get_cstr(app->file_path));
  27. if(success) hex_viewer_read_file(app);
  28. }
  29. if(success) {
  30. // Load page to do something with result
  31. //scene_manager_next_scene(app->scene_manager, HexViewerViewIdMenu);
  32. //scene_manager_previous_scene(app->scene_manager); // temp for showcase
  33. scene_manager_search_and_switch_to_previous_scene(
  34. app->scene_manager, HexViewerViewIdStartscreen);
  35. } else {
  36. // This is basically if someone quites the browser
  37. scene_manager_previous_scene(app->scene_manager);
  38. }
  39. }
  40. bool hex_viewer_scene_scene_4_on_event(void* context, SceneManagerEvent event) {
  41. UNUSED(context);
  42. UNUSED(event);
  43. bool consumed = true;
  44. return consumed;
  45. }
  46. void hex_viewer_scene_scene_4_on_exit(void* context) {
  47. UNUSED(context);
  48. }