HomeActivity: Add mod features on top of upstream ActivityManager pattern: - Multi-server OPDS support (OpdsServerStore instead of single URL) - Long-press recent book for BookManageMenuActivity - Long-press Browse Files to open archive folder - Placeholder cover generation for books without covers - startActivityForResult pattern for manage menu EpubReaderMenuActivity: Replace upstream menu items with mod menu: - Add/Remove Bookmark, Lookup Word, Go to Bookmark, Lookup History - Table of Contents, Toggle Orientation, Toggle Font Size - Close Book, Delete Dictionary Cache - Pass isBookmarked and currentFontSize to constructor - Show current orientation/font size value inline EpubReaderActivity: Add mod action handlers: - Bookmark add/remove via BookmarkStore - Go to Bookmark via EpubReaderBookmarkSelectionActivity - Dictionary word lookup via DictionaryWordSelectActivity - Lookup history via LookedUpWordsActivity - Delete dictionary cache - Font size toggle with section re-layout - Close Book action ActivityResult: Add fontSize field to MenuResult Made-with: Cursor
69 lines
1.3 KiB
C++
69 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <functional>
|
|
#include <string>
|
|
#include <type_traits>
|
|
#include <utility>
|
|
#include <variant>
|
|
|
|
struct WifiResult {
|
|
bool connected = false;
|
|
std::string ssid;
|
|
std::string ip;
|
|
};
|
|
|
|
struct KeyboardResult {
|
|
std::string text;
|
|
};
|
|
|
|
struct MenuResult {
|
|
int action = -1;
|
|
uint8_t orientation = 0;
|
|
uint8_t pageTurnOption = 0;
|
|
uint8_t fontSize = 0;
|
|
};
|
|
|
|
struct ChapterResult {
|
|
int spineIndex = 0;
|
|
};
|
|
|
|
struct PercentResult {
|
|
int percent = 0;
|
|
};
|
|
|
|
struct PageResult {
|
|
uint32_t page = 0;
|
|
};
|
|
|
|
struct SyncResult {
|
|
int spineIndex = 0;
|
|
int page = 0;
|
|
};
|
|
|
|
enum class NetworkMode;
|
|
|
|
struct NetworkModeResult {
|
|
NetworkMode mode;
|
|
};
|
|
|
|
struct FootnoteResult {
|
|
std::string href;
|
|
};
|
|
|
|
using ResultVariant = std::variant<std::monostate, WifiResult, KeyboardResult, MenuResult, ChapterResult, PercentResult,
|
|
PageResult, SyncResult, NetworkModeResult, FootnoteResult>;
|
|
|
|
struct ActivityResult {
|
|
bool isCancelled = false;
|
|
ResultVariant data;
|
|
|
|
explicit ActivityResult() = default;
|
|
|
|
template <typename ResultType, typename = std::enable_if_t<std::is_constructible_v<ResultVariant, ResultType&&>>>
|
|
// cppcheck-suppress noExplicitConstructor
|
|
ActivityResult(ResultType&& result) : data{std::forward<ResultType>(result)} {}
|
|
};
|
|
|
|
using ActivityResultHandler = std::function<void(const ActivityResult&)>;
|