28 lines
1.8 KiB
Markdown
28 lines
1.8 KiB
Markdown
|
|
# BookInfo: Landscape Button Hint Gutter Fix
|
||
|
|
|
||
|
|
**Date**: 2026-03-09
|
||
|
|
**Task**: Adjust BookInfo's content area and header placement in landscape orientations to account for button hints appearing on a side instead of the bottom.
|
||
|
|
|
||
|
|
## Problem
|
||
|
|
|
||
|
|
In landscape orientations the physical front buttons end up on a side of the screen (CW = left, CCW = right). BookInfo was reserving `buttonHintsHeight` at the bottom in all orientations, wasting vertical space in landscape and not accounting for the side gutter needed to avoid overlapping the side-drawn button hints.
|
||
|
|
|
||
|
|
## Changes Made
|
||
|
|
|
||
|
|
### `src/activities/home/BookInfoActivity.cpp`
|
||
|
|
|
||
|
|
- **`buildLayout()`**: Added `hintGutterWidth` computation (`metrics.sideButtonHintsWidth` in landscape, 0 in portrait). Text wrapping width (`contentW`) now subtracts `hintGutterWidth`. Bottom padding for `contentHeight` uses only `verticalSpacing` in landscape (no `buttonHintsHeight` since there are no bottom hints).
|
||
|
|
- **`render()`**: Added `isLandscapeCw`, `hintGutterWidth`, and `contentX` computations following the established codebase pattern. In CW, `contentX = hintGutterWidth` shifts all content right (hints on left). In CCW, `contentX = 0` and content width is reduced (hints on right). Cover X position offset by `contentX`. Field X offset by `contentX`. `contentBottom` no longer subtracts `buttonHintsHeight` in landscape. Header `fillRect` and `drawHeader` Rect both adjusted by `contentX` and `hintGutterWidth`.
|
||
|
|
|
||
|
|
## Pattern Followed
|
||
|
|
|
||
|
|
The established pattern from `LookedUpWordsActivity`, `DictionarySuggestionsActivity`, `EpubReaderMenuActivity`, and others:
|
||
|
|
```cpp
|
||
|
|
const int hintGutterWidth = isLandscape ? metrics.sideButtonHintsWidth : 0;
|
||
|
|
const int contentX = isLandscapeCw ? hintGutterWidth : 0;
|
||
|
|
```
|
||
|
|
|
||
|
|
## Follow-up
|
||
|
|
|
||
|
|
Ready for hardware testing in all 4 orientations.
|