hex_viewer_scene_scene_4.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. FuriString* initial_path;
  6. initial_path = furi_string_alloc();
  7. furi_string_set(initial_path, HEX_VIEWER_APP_PATH_FOLDER);
  8. DialogsFileBrowserOptions browser_options;
  9. dialog_file_browser_set_basic_options(&browser_options, HEX_VIEWER_APP_EXTENSION, &I_hex_10px);
  10. browser_options.hide_ext = false;
  11. bool success =
  12. dialog_file_browser_show(app->dialogs, app->file_path, initial_path, &browser_options);
  13. furi_string_free(initial_path);
  14. if(success) {
  15. success = hex_viewer_open_file(app, furi_string_get_cstr(app->file_path));
  16. if(success) hex_viewer_read_file(app);
  17. }
  18. if(success) {
  19. // Load page to do something with result
  20. //scene_manager_next_scene(app->scene_manager, HexViewerViewIdMenu);
  21. //scene_manager_previous_scene(app->scene_manager); // temp for showcase
  22. scene_manager_search_and_switch_to_previous_scene(
  23. app->scene_manager, HexViewerViewIdStartscreen);
  24. } else {
  25. // This is basically if someone quites the browser
  26. scene_manager_previous_scene(app->scene_manager);
  27. }
  28. }
  29. bool hex_viewer_scene_scene_4_on_event(void* context, SceneManagerEvent event) {
  30. UNUSED(context);
  31. UNUSED(event);
  32. bool consumed = true;
  33. return consumed;
  34. }
  35. void hex_viewer_scene_scene_4_on_exit(void* context) {
  36. UNUSED(context);
  37. }