scene_file_select.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include "../malveke_gb_photo.h"
  2. #include <storage/storage.h>
  3. static bool file_select(Boilerplate* app) {
  4. furi_assert(app);
  5. furi_string_set(app->file_path, MALVEKE_APP_FOLDER_RAMS);
  6. DialogsFileBrowserOptions browser_options;
  7. dialog_file_browser_set_basic_options(
  8. &browser_options, MALVEKE_APP_RAM_EXTENSION, &I_icon_10px);
  9. browser_options.base_path = MALVEKE_APP_FOLDER_RAMS;
  10. browser_options.skip_assets = true;
  11. // Input events and views are managed by file_browser
  12. bool res =
  13. dialog_file_browser_show(app->dialogs, app->file_path, app->file_path, &browser_options);
  14. return res;
  15. }
  16. void boilerplate_scene_fileselect_on_enter(void* context) {
  17. Boilerplate* app = context;
  18. // if(app->script) {
  19. // script_close(app->script);
  20. // app->script = NULL;
  21. // }
  22. // if(app->camera_ram_sav && storage_file_is_open(app->camera_ram_sav)) {
  23. // storage_file_close(app->camera_ram_sav);
  24. // }
  25. // app->camera_ram_sav = storage_file_alloc(app->storage);
  26. if(file_select(app)) {
  27. if(storage_file_open(
  28. app->camera_ram_sav,
  29. furi_string_get_cstr(app->file_path),
  30. FSAM_READ,
  31. FSOM_OPEN_EXISTING)) {
  32. scene_manager_next_scene(app->scene_manager, BoilerplateSceneMenu);
  33. }
  34. } else {
  35. view_dispatcher_stop(app->view_dispatcher);
  36. }
  37. }
  38. bool boilerplate_scene_fileselect_on_event(void* context, SceneManagerEvent event) {
  39. UNUSED(context);
  40. UNUSED(event);
  41. // Boilerplate* app = context;
  42. return false;
  43. }
  44. void boilerplate_scene_fileselect_on_exit(void* context) {
  45. UNUSED(context);
  46. // Boilerplate* app = context;
  47. }