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
1.8 KiB
1.8 KiB
Implement BmpViewer Activity (upstream PR #887)
Task
Port the BmpViewer feature from upstream crosspoint-reader PR #887 to the mod/master fork, enabling .bmp file viewing from the file browser.
Changes Made
New Files
- src/activities/util/BmpViewerActivity.h -- Activity subclass declaration with file path, onGoBack callback, and loadFailed state
- src/activities/util/BmpViewerActivity.cpp -- BMP loading/rendering implementation: shows loading indicator, opens file via Storage HAL, parses BMP headers, computes centered position with aspect-ratio-preserving layout, renders via
renderer.drawBitmap(), draws localized back button hint, handles back button input in loop
Modified Files
- src/activities/reader/ReaderActivity.h -- Added
isBmpFile()andonGoToBmpViewer()private declarations - src/activities/reader/ReaderActivity.cpp -- Added BmpViewerActivity include,
isBmpFile()implementation,onGoToBmpViewer()implementation (sets currentBookPath, exits, enters BmpViewerActivity with goToLibrary callback), BMP routing inonEnter()before XTC/TXT checks - src/activities/home/MyLibraryActivity.cpp -- Added
.bmpto the file extension filter inloadFiles() - src/components/themes/lyra/LyraTheme.cpp -- Changed
fillRecttofillRoundedRectindrawButtonHints()for both FULL and SMALL button sizes to prevent white rectangles overflowing rounded button borders
Build Result
- PlatformIO build SUCCESS (default env)
- RAM: 32.7% (107,308 / 327,680 bytes)
- Flash: 71.1% (4,657,244 / 6,553,600 bytes)
Follow-up Items
- Test on hardware with various BMP files (different sizes, bit depths)
- Consider adding image scaling for oversized BMPs (currently
drawBitmaphandles scaling) - Future enhancements mentioned in upstream PR: next/prev image navigation, "display and sleep" button