#pragma once #include #include #include #include "../Activity.h" #include "RecentBooksStore.h" #include "util/ButtonNavigator.h" class FileBrowserActivity final : public Activity { private: // Deletion void clearFileMetadata(const std::string& fullPath); ButtonNavigator buttonNavigator; size_t selectorIndex = 0; // Files state std::string basepath = "/"; std::string focusName; // entry to select on first load (e.g. the file just returned from) std::vector files; // Data loading void loadFiles(); size_t findEntry(const std::string& name) const; public: explicit FileBrowserActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, std::string initialPath = "/", std::string focusName = {}) : Activity("FileBrowser", renderer, mappedInput), basepath(initialPath.empty() ? "/" : std::move(initialPath)), focusName(std::move(focusName)) {} void onEnter() override; void onExit() override; void loop() override; void render(RenderLock&&) override; };