Files
crosspoint-reader-mod/chat-summaries/2026-02-19_21-30-summary.md
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

2.4 KiB

Port Upstream PRs #997, #1003, #1005, #1010

Task

Cherry-pick / port four upstream PRs from crosspoint-reader/crosspoint-reader into the mod fork.

Changes Made

PR #997 -- Already Ported (no changes)

Glyph null-safety in getSpaceWidth/getTextAdvanceX was already present via commit c1b8e53.

PR #1010 -- Fix Dangling Pointer

  • src/main.cpp: onGoToReader() now copies the initialEpubPath string before calling exitActivity(), preventing a dangling reference when the owning activity is destroyed.

PR #1005 -- Use HalPowerManager for Battery Percentage

  • lib/hal/HalPowerManager.h: Changed getBatteryPercentage() return type from int to uint16_t.
  • lib/hal/HalPowerManager.cpp: Same return type change.
  • src/Battery.h: Emptied contents (was static BatteryMonitor battery(BAT_GPIO0)).
  • src/main.cpp: Removed #include "Battery.h".
  • src/activities/home/HomeActivity.cpp: Removed #include "Battery.h".
  • src/components/themes/BaseTheme.cpp: Replaced Battery.h include with HalPowerManager.h, replaced battery.readPercentage() with powerManager.getBatteryPercentage() (2 occurrences).
  • src/components/themes/lyra/LyraTheme.cpp: Same replacements (2 occurrences).

PR #1003 -- Render Image Placeholders While Waiting for Decode

  • lib/Epub/Epub/blocks/ImageBlock.h/.cpp: Added isCached() method that checks if the .pxc cache file exists.
  • lib/Epub/Epub/Page.h/.cpp: Added PageImage::isCached(), PageImage::renderPlaceholder(), Page::renderTextOnly(), Page::countUncachedImages(), Page::renderImagePlaceholders(). Added #include <GfxRenderer.h> to Page.h.
  • src/activities/reader/EpubReaderActivity.cpp: Modified renderContents() to check for uncached images and display text + placeholder rectangles immediately (Phase 1 with HALF_REFRESH), then proceed with full image decode and display (Phase 2 with fast refresh). Existing mod-specific double FAST_REFRESH logic for anti-aliased image pages is preserved for the cached-image path.

Build Result

SUCCESS -- RAM: 31.5%, Flash: 70.4%. No linter errors.

Follow-up Items

  • PR #1003 is still open upstream (not merged); may need to rebase if upstream changes before merge.
  • The phased rendering for uncached images skips the mod's double FAST_REFRESH technique (relies on Phase 1's HALF_REFRESH instead). If grayscale quality on first-decode image pages is suboptimal, this could be revisited.