Adds full support for book lists managed by the Companion App: - New /list API endpoints (GET/POST) for uploading, retrieving, and deleting lists - BookListStore for binary serialization of lists to /.lists/ directory - ListViewActivity for viewing list contents with book thumbnails - Reading Lists tab in My Library with pin/unpin and delete actions - Pinnable list shortcut on home screen (split button layout) - Automatic cleanup of pinned status when lists are deleted
53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
#pragma once
|
|
#include <freertos/FreeRTOS.h>
|
|
#include <freertos/semphr.h>
|
|
#include <freertos/task.h>
|
|
|
|
#include <functional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#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<void()> onBack;
|
|
const std::function<void(const std::string& path)> 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<void()>& onBack,
|
|
const std::function<void(const std::string& path)>& onSelectBook)
|
|
: Activity("ListView", renderer, mappedInput), listName(listName), onBack(onBack), onSelectBook(onSelectBook) {}
|
|
|
|
void onEnter() override;
|
|
void onExit() override;
|
|
void loop() override;
|
|
};
|