mod: Phase 2b - adapt HomeActivity, EpubReaderMenuActivity, EpubReaderActivity

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
This commit is contained in:
cottongin
2026-03-07 15:38:53 -05:00
parent 66a754dabd
commit bd2cea8b8d
8 changed files with 1774 additions and 74 deletions

View File

@@ -21,12 +21,24 @@ class EpubReaderMenuActivity final : public Activity {
DISPLAY_QR,
GO_HOME,
SYNC,
DELETE_CACHE
DELETE_CACHE,
// Mod-specific actions
ADD_BOOKMARK,
REMOVE_BOOKMARK,
LOOKUP_WORD,
LOOKUP_HISTORY,
GO_TO_BOOKMARK,
TABLE_OF_CONTENTS,
TOGGLE_ORIENTATION,
TOGGLE_FONT_SIZE,
CLOSE_BOOK,
DELETE_DICT_CACHE
};
explicit EpubReaderMenuActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const std::string& title,
const int currentPage, const int totalPages, const int bookProgressPercent,
const uint8_t currentOrientation, const bool hasFootnotes);
const uint8_t currentOrientation, const bool hasFootnotes,
bool isBookmarked = false, uint8_t currentFontSize = 0);
void onEnter() override;
void onExit() override;
@@ -39,7 +51,7 @@ class EpubReaderMenuActivity final : public Activity {
StrId labelId;
};
static std::vector<MenuItem> buildMenuItems(bool hasFootnotes);
static std::vector<MenuItem> buildMenuItems(bool hasFootnotes, bool isBookmarked);
// Fixed menu layout
const std::vector<MenuItem> menuItems;
@@ -49,9 +61,11 @@ class EpubReaderMenuActivity final : public Activity {
ButtonNavigator buttonNavigator;
std::string title = "Reader Menu";
uint8_t pendingOrientation = 0;
uint8_t pendingFontSize = 0;
uint8_t selectedPageTurnOption = 0;
const std::vector<StrId> orientationLabels = {StrId::STR_PORTRAIT, StrId::STR_LANDSCAPE_CW, StrId::STR_INVERTED,
StrId::STR_LANDSCAPE_CCW};
const std::vector<StrId> fontSizeLabels = {StrId::STR_SMALL, StrId::STR_MEDIUM, StrId::STR_LARGE, StrId::STR_X_LARGE};
const std::vector<const char*> pageTurnLabels = {I18N.get(StrId::STR_STATE_OFF), "1", "3", "6", "12"};
int currentPage = 0;
int totalPages = 0;