#pragma once #include #include #include #include #include #include #include "../Activity.h" #include "BookListStore.h" /** * ListViewActivity - Displays the contents of a single book list * * Shows books in custom order with title, author, and thumbnail. * Allows selecting a book to open in the reader. */ class ListViewActivity final : public Activity { private: TaskHandle_t displayTaskHandle = nullptr; SemaphoreHandle_t renderingMutex = nullptr; std::string listName; BookList bookList; int selectorIndex = 0; bool updateRequired = false; // Callbacks const std::function onBack; const std::function onSelectBook; // Pagination helpers int getPageItems() const; int getTotalPages() const; int getCurrentPage() const; // Rendering static void taskTrampoline(void* param); [[noreturn]] void displayTaskLoop(); void render() const; public: explicit ListViewActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const std::string& listName, const std::function& onBack, const std::function& onSelectBook) : Activity("ListView", renderer, mappedInput), listName(listName), onBack(onBack), onSelectBook(onSelectBook) {} void onEnter() override; void onExit() override; void loop() override; };