Eunchurn Park 6d041c9a18
feat(nav): improve back button navigation with long press support
EPUB Reader:
- Short press BACK: go to file browser at the book's folder
- Long press BACK (1s+): go directly to home menu

File Browser:
- Short press BACK: go up one directory (or home if at root)
- Long press BACK (1s+): go directly to root folder
2025-12-26 02:16:02 +09:00

27 lines
959 B
C++

#pragma once
#include <memory>
#include "../ActivityWithSubactivity.h"
class Epub;
class ReaderActivity final : public ActivityWithSubactivity {
std::string initialEpubPath;
std::string currentEpubPath; // Track current book path for navigation
const std::function<void()> onGoBack;
static std::unique_ptr<Epub> loadEpub(const std::string& path);
static std::string extractFolderPath(const std::string& filePath);
void onSelectEpubFile(const std::string& path);
void onGoToFileSelection(const std::string& fromEpubPath = "");
void onGoToEpubReader(std::unique_ptr<Epub> epub);
public:
explicit ReaderActivity(GfxRenderer& renderer, InputManager& inputManager, std::string initialEpubPath,
const std::function<void()>& onGoBack)
: ActivityWithSubactivity("Reader", renderer, inputManager),
initialEpubPath(std::move(initialEpubPath)),
onGoBack(onGoBack) {}
void onEnter() override;
};