Files
crosspoint-reader-mod/chat-summaries/2026-03-09_02-30-summary.md

52 lines
2.9 KiB
Markdown
Raw Normal View History

# BookInfo Button Mapping, Fallback Load, ManageBook Integration, Cover Regen Fix
**Date**: 2026-03-09
**Task**: Implement fixes 1-5 from the BookInfo Buttons and Load plan
## Changes Made
### BookInfoActivity.cpp — Fixes 1-3
1. **Button mapping** (`loop()`): Removed `Confirm` as exit trigger. Added `Left` and `Right` front buttons as scroll-down/scroll-up handlers alongside existing side-button `Down`/`Up` and `PageForward`/`PageBack`.
2. **Button hints** (`render()`): Updated `mapLabels` to show `STR_DIR_DOWN` on Left (btn3) and `STR_DIR_UP` on Right (btn4), with separate variables for each direction instead of a single combined hint.
3. **Fallback load** (`onEnter()`): Changed `epub.load(false, true)` pattern to try `epub.load(true, true)` on failure, ensuring cache is built for books that were never opened. XTC branch already builds unconditionally via `xtc.load()`.
### BookManageMenuActivity — Fix 4
- Added `BOOK_INFO` to `Action` enum (first entry)
- Added `STR_BOOK_INFO` menu item as first entry in `buildMenuItems()`
- Handled `BOOK_INFO` in all 4 result sites:
- `HomeActivity::openManageMenu()` — launches `BookInfoActivity` via `startActivityForResult`
- `RecentBooksActivity::openManageMenu()` — same pattern
- `FileBrowserActivity::handleManageResult()` — same pattern
- `EpubReaderActivity` inline switch — same pattern
- Added `BOOK_INFO` no-op case to `executeManageAction()` in Home/Recent to prevent compiler warnings
### HomeActivity cover regeneration — Fix 5
- After `generateThumbBmp()` fails or produces invalid BMP, now calls `generateCoverBmp(false)` to extract the full cover from the EPUB before retrying thumbnail generation
- Added `Epub::isValidThumbnailBmp()` validation after each `generateThumbBmp()` call
- Applied same pattern to XTC branch using `xtc.generateCoverBmp()` + validation
- This aligns the HomeActivity pipeline with the EpubReaderActivity's multi-tier fallback approach
## Files Changed
- `src/activities/home/BookInfoActivity.cpp` — button mapping, hints, fallback load
- `src/activities/home/BookManageMenuActivity.h` — BOOK_INFO enum entry
- `src/activities/home/BookManageMenuActivity.cpp` — BOOK_INFO menu item
- `src/activities/home/HomeActivity.cpp` — BOOK_INFO handler + cover regen fix
- `src/activities/home/RecentBooksActivity.cpp` — BOOK_INFO handler
- `src/activities/home/FileBrowserActivity.cpp` — BOOK_INFO handler
- `src/activities/reader/EpubReaderActivity.cpp` — BOOK_INFO handler
## Build Result
Build succeeded — 0 errors, 0 code warnings. RAM: 30.3%, Flash: 95.7%.
## Follow-up Items
- Test on device: verify all 4 BookInfo entry points work (Home manage, Recent manage, FileBrowser manage, Reader manage)
- Test cover regeneration after DELETE_CACHE from reader menu
- Verify button mapping on BookInfo screen (Left=down, Right=up, side buttons=scroll)
- Verify Book Info shows for books that have never been opened