#pragma once #include #include #include #include #include #include #include "activities/ActivityWithSubactivity.h" class EpubReaderMenuActivity final : public ActivityWithSubactivity { std::shared_ptr epub; std::unique_ptr
section = nullptr; TaskHandle_t displayTaskHandle = nullptr; SemaphoreHandle_t renderingMutex = nullptr; int currentSpineIndex = 0; int selectedItemIndex = 0; bool updateRequired = false; const std::function onGoBack; // Reset to first section to prevent out of bound issue when render setting changes const std::function resetSectionHelper; const std::function onSelectSpineIndex; void onSelectChapters(); void onSelectSettings(); static void taskTrampoline(void* param); [[noreturn]] void displayTaskLoop(); void renderScreen(); public: explicit EpubReaderMenuActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const std::shared_ptr& epub, const int currentSpineIndex, const std::function& onGoBack, const std::function& resetSectionHelper, const std::function& onSelectSpineIndex) : ActivityWithSubactivity("EpubReaderMenu", renderer, mappedInput), epub(epub), currentSpineIndex(currentSpineIndex), onGoBack(onGoBack), resetSectionHelper(resetSectionHelper), onSelectSpineIndex(onSelectSpineIndex) {} void onEnter() override; void onExit() override; void loop() override; };