67 lines
3.5 KiB
Markdown
67 lines
3.5 KiB
Markdown
|
|
# 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_TIME` to all 8 translation YAML files with localized text
|
||
|
|
- Regenerated `lib/I18n/I18nKeys.h`, `I18nStrings.h`, `I18nStrings.cpp` via `gen_i18n.py`
|
||
|
|
|
||
|
|
### Settings: Clock Format (`CrossPointSettings.h`, `.cpp`, `SettingsList.h`)
|
||
|
|
- Added `CLOCK_FORMAT` enum (`CLOCK_OFF`, `CLOCK_AMPM`, `CLOCK_24H`) and `homeScreenClock` member (default OFF)
|
||
|
|
- Added persistence in `writeSettings()` and `loadFromFile()` (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 `recentBooks` is 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_ID` with generous wrapping (up to 5 lines, no truncation unless very long)
|
||
|
|
- Author in `UI_10_FONT_ID` below 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_ID` below
|
||
|
|
|
||
|
|
### 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 `wrapText` lambda for reusable word-wrap logic (parameterized by font, maxLines, maxWidth)
|
||
|
|
- Extracted `renderCoverBitmap` lambda for aspect-ratio-preserving cover rendering
|
||
|
|
|
||
|
|
### Lyra Metrics (`LyraTheme.h`)
|
||
|
|
- Increased `homeCoverTileHeight` from 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 `homeScreenClock` setting (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 `SetTime` to `SettingAction` enum
|
||
|
|
- Added include and switch case for `SetTimeActivity`
|
||
|
|
- Added "Set Time" action to display settings category
|
||
|
|
|
||
|
|
## Build Verification
|
||
|
|
- `pio run -e default` succeeded
|
||
|
|
- 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 `homeCoverTileHeight` value if text area feels too tight or loose visually
|
||
|
|
- Consider NTP auto-sync when WiFi is available (currently only during KOReader sync)
|