Commit Graph

13 Commits

Author SHA1 Message Date
cottongin
2aba348070 fix: prevent BookInfo content from overlapping header on scroll
Draw header after content with a white fill over the header zone,
so scrolled cover images and text slide behind the header instead
of rendering on top of it. Removed incorrect maxHeight clamping
that caused the cover to shrink rather than scroll.

Made-with: Cursor
2026-03-09 03:42:47 -04:00
cottongin
4c62437689 fix: add header bar and fix bottom spacing in BookInfo
Draw the standard header (clock, battery, title) via GUI.drawHeader().
Replace hardcoded MARGIN with theme metrics for content positioning.
Content area now starts below the header and stops above button hints
so the last lines are never obscured.

Made-with: Cursor
2026-03-09 03:17:49 -04:00
cottongin
efa727eff2 refactor: consolidate Epub blank strings, simplify BookInfo buildLayout
Replace 13 per-accessor static std::string blank locals with a single
file-scope kBlank (~384 bytes DRAM saved). Add Epub::getMetadata()
returning the full BookMetadata struct. Refactor buildLayout from 14
individual parameters to a single BookMetadata const ref + fileSize.

Made-with: Cursor
2026-03-09 02:56:35 -04:00
cottongin
42ca85d560 feat: show loading popup in BookInfo when parsing unopened book
When BookInfo is opened for a book with no existing cache,
epub.load(true, true) triggers a 1-2s full parse. Show a
"Loading..." popup with progress bar so the device doesn't
appear frozen. Popup only appears on the fallback path —
cached books load silently. Same pattern for XTC books.

Made-with: Cursor
2026-03-09 02:22:51 -04:00
cottongin
edf273f1d8 feat: BookInfo button mapping, ManageBook integration, cover regen fix
- Fix BookInfo buttons: Left/Right front = scroll down/up, Confirm = no-op,
  side buttons retained. Separate Up/Down hints on btn3/btn4.
- Fallback load: try epub.load(true, true) when cache-only load fails,
  so Book Info works for unopened books.
- Add "Book Info" to ManageBook menu (BOOK_INFO action) with handlers in
  all 4 result sites (Home, Recent, FileBrowser, Reader).
- Fix HomeActivity cover regen: call generateCoverBmp(false) + validate
  with isValidThumbnailBmp before falling to placeholder, matching the
  reader's multi-tier fallback pipeline. Same for XTC branch.

Made-with: Cursor
2026-03-09 02:06:25 -04:00
cottongin
1105919359 fix: BookInfo performance — Y-culling, newline normalization, cover clamping
Addressed critical render performance issues identified via device debug log:
- Add Y-culling in render() to skip off-screen draw calls (was causing
  337K LOG_ERR calls per frame, 7-13s render times)
- Normalize description whitespace (strip embedded \n/\r/\t) to prevent
  "No glyph for codepoint 10" errors
- Clamp cover bitmap maxHeight to prevent drawing beyond screen edge
- Pre-compute layout in onEnter() with InfoField struct (wrappedText
  called once, not per frame)
- Add cover image display via generateThumbBmp + drawBitmap1Bit

Made-with: Cursor
2026-03-09 01:52:07 -04:00
cottongin
4cf395aee9 port: upstream PR #1342 - Book Info screen, richer metadata, safer controls
Ports upstream PR #1342 (feat: Add Book Info screen, richer metadata,
and safer file-browser controls) with mod-specific adaptations:

- Parse and cache series, seriesIndex, description from EPUB OPF
- Bump book.bin cache version to 6 for new metadata fields
- Add BookInfoActivity (new screen) accessible via Right button in FileBrowser
- Add ManageBook menu via Left button in FileBrowser (replaces upstream hidden delete)
- Guard all delete/archive actions with ConfirmationActivity (10 call sites)
- Add inputArmed gating to ConfirmationActivity to prevent accidental confirmation
- Safe deserialization: readString now returns bool with MAX_STRING_LENGTH guard
- Add series field to RecentBooksStore with JSON and binary serialization
- Add i18n keys: STR_BOOK_INFO, STR_AUTHOR, STR_SERIES, STR_FILE_SIZE, etc.

Made-with: Cursor
2026-03-09 00:39:32 -04:00
cottongin
255b98bda0 port: upstream PRs #1311 (inter-word spacing fix) and #1322 (zip early exit)
PR #1311: Replace separate spaceWidth + getSpaceKernAdjust() with a
single getSpaceAdvance() that combines space glyph advance and kerning
in fixed-point before snapping to pixels, eliminating +/-1 px rounding
drift in text layout.

PR #1322: Add early exit to fillUncompressedSizes() once all target
entries are matched, avoiding unnecessary central directory traversal.

Also updates tracking docs and verifies PR #1329 (reader utils refactor)
matches upstream after merge.

Made-with: Cursor
2026-03-08 15:53:13 -04:00
cottongin
5ca72ef231 docs: add chat summary for three reader bug fixes
Made-with: Cursor
2026-03-08 06:04:25 -04:00
cottongin
83aa38d1a2 docs: update tracking for ported PRs #1329, #1143, #1172, #1320, #1325
Add detailed entries to MERGED.md for all 5 ported PRs with context,
changes applied, and differences from upstream. Update upstream-sync.md
tracking table with new entries and sync date.

Made-with: Cursor
2026-03-08 05:02:05 -04:00
cottongin
dac087f391 docs: add chat summaries for upstream sync and bug fix sessions
Made-with: Cursor
2026-03-08 04:14:56 -04:00
cottongin
9464df1727 mod: restore missing mod features from resync audit
Re-add KOReaderSyncActivity PUSH_ONLY mode (PR #1090):
- SyncMode enum with INTERACTIVE/PUSH_ONLY, deferFinish pattern
- Push & Sleep menu action in EpubReaderMenuActivity
- ActivityManager::requestSleep() for activity-initiated sleep
- main.cpp checks isSleepRequested() each loop iteration

Wire EndOfBookMenuActivity into EpubReaderActivity:
- pendingEndOfBookMenu deferred flag avoids render-lock deadlock
- Handles all 6 actions: ARCHIVE, DELETE, TABLE_OF_CONTENTS,
  BACK_TO_BEGINNING, CLOSE_BOOK, CLOSE_MENU

Add book management to reader menu:
- ARCHIVE_BOOK, DELETE_BOOK, REINDEX_BOOK actions with handlers

Port silent next-chapter pre-indexing:
- silentIndexNextChapterIfNeeded() proactively indexes next chapter
  when user is near end of current one, eliminating load screens

Add per-book letterbox fill toggle in reader menu:
- LETTERBOX_FILL cycles Default/Dithered/Solid/None
- Loads/saves per-book override via BookSettings
- bookCachePath constructor param added to EpubReaderMenuActivity

Made-with: Cursor
2026-03-07 16:53:17 -05:00
cottongin
dfbc931c14 mod: Phase 1 - bring forward mod-exclusive files with ActivityManager migration
Brings ~55 mod-exclusive files to the upstream-based mod/master-resync branch:

Activities (migrated to new ActivityManager pattern):
- Clock/Time: SetTimeActivity, SetTimezoneOffsetActivity, NtpSyncActivity
- Dictionary: DictionaryDefinitionActivity, DictionarySuggestionsActivity,
  DictionaryWordSelectActivity, LookedUpWordsActivity
- Bookmark: EpubReaderBookmarkSelectionActivity
- Book management: BookManageMenuActivity, EndOfBookMenuActivity
- OPDS: OpdsServerListActivity, OpdsSettingsActivity
- Utility: DirectoryPickerActivity, NumericStepperActivity

Utilities (unchanged):
- BookManager, BookSettings, BookmarkStore, BootNtpSync
- Dictionary, LookupHistory, TimeSync, OpdsServerStore

Libraries: PlaceholderCover, TableData, ChapterXPathIndexer
Scripts: inject_mod_version, generate_book_icon, preview_placeholder_cover
Docs: KOReader sync XPath mapping

Migration changes:
- ActivityWithSubactivity -> Activity base class
- Callback constructors -> finish()/setResult() pattern
- enterNewActivity() -> startActivityForResult()
- Activity::RenderLock&& -> RenderLock&&

These files won't compile yet - they reference mod settings and I18n
strings that will be added in subsequent phases.

Made-with: Cursor
2026-03-07 15:10:00 -05:00