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
3.5 KiB
3.5 KiB
Improve Home Screen
Task Description
Enhance the Lyra theme home screen with six improvements: empty-state placeholder, adaptive recent book cards, 2-line title wrapping with author, adjusted button positioning, optional clock display, and a manual Set Time activity.
Changes Made
i18n Strings (8 YAML files + auto-generated C++ files)
- Added
STR_CHOOSE_SOMETHING,STR_HOME_SCREEN_CLOCK,STR_CLOCK_AMPM,STR_CLOCK_24H,STR_SET_TIMEto all 8 translation YAML files with localized text - Regenerated
lib/I18n/I18nKeys.h,I18nStrings.h,I18nStrings.cppviagen_i18n.py
Settings: Clock Format (CrossPointSettings.h, .cpp, SettingsList.h)
- Added
CLOCK_FORMATenum (CLOCK_OFF,CLOCK_AMPM,CLOCK_24H) andhomeScreenClockmember (default OFF) - Added persistence in
writeSettings()andloadFromFile()(appended at end for backward compatibility) - Added "Home Screen Clock" setting under Display category in
SettingsList.h
Lyra Theme: Empty State Placeholder (LyraTheme.cpp)
- When
recentBooksis empty, draws centered "Choose something to read" text instead of blank area
Lyra Theme: 1-Book Horizontal Layout (LyraTheme.cpp)
- When 1 recent book: cover on the left (natural aspect ratio), title + author on the right
- Title uses
UI_12_FONT_IDwith generous wrapping (up to 5 lines, no truncation unless very long) - Author in
UI_10_FONT_IDbelow title with 4px gap
Lyra Theme: Multi-Book Tile Layout (LyraTheme.cpp)
- 2-3 books: tile-based layout with cover centered within tile (no stretching)
- Cover bitmap rendering preserves aspect ratio: crops if wider than slot, centers if narrower
- Title wraps to 2 lines with ellipsis, author in
SMALL_FONT_IDbelow
Lyra Theme: Selection Background Fix (LyraTheme.cpp)
- Bottom section of selection highlight now uses full remaining height below cover
- Prevents author text from clipping outside the selection area
Lyra Theme: Shared Helpers (LyraTheme.cpp)
- Extracted
wrapTextlambda for reusable word-wrap logic (parameterized by font, maxLines, maxWidth) - Extracted
renderCoverBitmaplambda for aspect-ratio-preserving cover rendering
Lyra Metrics (LyraTheme.h)
- Increased
homeCoverTileHeightfrom 287 to 310 to accommodate expanded text area - Menu buttons shift down automatically since they're positioned relative to this metric
Home Screen Clock (HomeActivity.cpp)
- Added clock rendering in the header area (top-left) after
drawHeader() - Respects
homeScreenClocksetting (OFF / AM/PM / 24H) - Skips rendering if system time is unset (year <= 2000)
Set Time Activity (NEW: SetTimeActivity.h, SetTimeActivity.cpp)
- New sub-activity for manual time entry: displays HH:MM with field selection
- Left/Right switches between hours and minutes, Up/Down adjusts values
- Confirm saves via
settimeofday(), Back discards - Wired into Settings > Display as an action item
Settings Activity Wiring (SettingsActivity.h, SettingsActivity.cpp)
- Added
SetTimetoSettingActionenum - Added include and switch case for
SetTimeActivity - Added "Set Time" action to display settings category
Build Verification
pio run -e defaultsucceeded- RAM: 31.1% (101,772 / 327,680 bytes)
- Flash: 99.5%
Follow-up Items
- Test on hardware: verify clock display, card layout with 0/1/2/3 books, Set Time activity
- Fine-tune
homeCoverTileHeightvalue if text area feels too tight or loose visually - Consider NTP auto-sync when WiFi is available (currently only during KOReader sync)