Open the dictionary as a sheet where a panel would crush the poem #3

Closed
anas wants to merge 0 commits from fix/dictionary-panel-crushes-narrow-page into main
Owner

The bug

On a book-style foldable held open in portrait — 700dp wide, inside the design's 600–839dp band — tapping a word made the poem unreadable.

The dictionary panel is a fixed 360dp and the columns keep their widths, so the page was left about 75dp. The verse broke to one or two characters a line:

دل
می‌رو
د ز
دستم
صاح
ب‌دلا
ن خدا
را

The breadcrumbs and the metre line shattered the same way.

Why

The panel was chosen from the width of the window (wide, ≥600dp). That is the wrong question — what matters is what is left of the page once the columns have taken their room.

The fix

Both side panels now ask that instead:

  • the dictionary opens beside the poem only while the page keeps 400dp;
  • reading settings open beside the browser only while it keeps its own 600dp — below that the panel would squeeze the columns and the poem into less than the layout is built for.

Where they do not fit, the bottom sheet is used, exactly as on a phone: it covers the foot of the poem but leaves every line whole.

The two panels also now share one width constant (SidePanelWidth) instead of repeating 360.dp.

Verified on device

Geometry Before After
1840×2208 @ 420dpi (700dp, foldable portrait) page ~75dp, verse unreadable sheet, verse full width
2560×1600 @ 320dpi (1280dp, tablet) panel, correct unchanged — panel still opens, poem still reads

63 unit tests pass; debug APK builds.

Design docs

design/components/ColumnBrowser/README.md records the rule for both panels, so the spec and the code say the same thing.

## The bug On a book-style foldable held open in portrait — 700dp wide, inside the design's 600–839dp band — tapping a word made the poem unreadable. The dictionary panel is a fixed 360dp and the columns keep their widths, so the page was left about **75dp**. The verse broke to one or two characters a line: ``` دل می‌رو د ز دستم صاح ب‌دلا ن خدا را ``` The breadcrumbs and the metre line shattered the same way. ## Why The panel was chosen from the width of the *window* (`wide`, ≥600dp). That is the wrong question — what matters is what is left of the *page* once the columns have taken their room. ## The fix Both side panels now ask that instead: - the **dictionary** opens beside the poem only while the page keeps **400dp**; - **reading settings** open beside the browser only while it keeps its own **600dp** — below that the panel would squeeze the columns and the poem into less than the layout is built for. Where they do not fit, the bottom sheet is used, exactly as on a phone: it covers the foot of the poem but leaves every line whole. The two panels also now share one width constant (`SidePanelWidth`) instead of repeating `360.dp`. ## Verified on device | Geometry | Before | After | |---|---|---| | 1840×2208 @ 420dpi (700dp, foldable portrait) | page ~75dp, verse unreadable | sheet, verse full width | | 2560×1600 @ 320dpi (1280dp, tablet) | panel, correct | **unchanged** — panel still opens, poem still reads | 63 unit tests pass; debug APK builds. ## Design docs `design/components/ColumnBrowser/README.md` records the rule for both panels, so the spec and the code say the same thing.
anas added 1 commit 2026-10-07 16:05:07 +00:00
On a book-style foldable held open in portrait — 700dp, inside the 600–839dp
band — tapping a word made the poem unreadable. The panel is a fixed 360dp and
the columns keep their widths, so the page was left about 75dp: the verse broke
to one or two characters a line, and the breadcrumbs and the metre shattered the
same way.

The panel was chosen from the width of the window. That is the wrong question.
What matters is what is left of the page once the columns have taken their room,
so both panels now ask that instead:

- the dictionary opens beside the poem only while the page keeps 400dp;
- reading settings open beside the browser only while it keeps its own 600dp,
  below which the panel would squeeze the columns and the poem into less than
  the layout is built for.

Where they do not fit, the bottom sheet is used, exactly as on a phone: it
covers the foot of the poem but leaves every line whole. A tablet is unaffected
— verified at 2560x1600 that the panel still opens and the poem still reads.

The two panels now share one width, and the design notes record the rule.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
anas added 1 commit 2026-10-07 16:33:27 +00:00
main has moved on since this branch opened, and most of what it carried has been
answered better there:

- the reading settings no longer need a fallback to the sheet, because they fold
  the columns away and take the room that frees (aab8b2e);
- the two panels no longer share a width, because the dictionary is now 216dp
  against the settings' 360dp.

Both were dropped: the conflicting files are taken from main as they stand.

What survives is the reason this branch exists. Which container the dictionary
uses is still decided by the width of the *window*, and that is the wrong
question — what matters is what is left of the page once the columns have taken
theirs. On a 700dp foldable that is about 450dp, and a panel beside it leaves
the verse a couple of characters a line. It now opens beside the poem only while
the page keeps 400dp, and falls back to the sheet below that, which covers the
foot of the poem but leaves every line whole.

Recalculated for the narrower panel: a tablet keeps the panel (~900dp page less
216dp leaves 684dp), a foldable in portrait does not (236dp).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Author
Owner

Conflicts resolved — and the scope has shrunk

main moved on while this sat open (it was 7 ahead / 1 behind, conflicting in 4 files). Merged main in; mergeable again. Most of what this branch originally carried has since been answered better on main, so it was dropped rather than forced through:

  • The settings fallback is gone. aab8b2e folds the columns away for the settings panel, which is a better answer than falling back to a sheet. Dropped.
  • The shared SidePanelWidth is gone. The two panels no longer want the same width — the dictionary is now 216dp against the settings' 360dp. Dropped.

Conflicting files were taken from main as they stand.

What survives

The reason the branch exists. Which container the dictionary uses is still decided by the width of the window, and that is the wrong question — what matters is what's left of the page once the columns have taken theirs.

Recalculated for the narrower 216dp panel:

Geometry Page before panel Less 216dp Result
Tablet, 1280dp ~900dp 684dp panel ✓
Foldable portrait, 700dp ~450dp 236dp sheet ✓

So the guard is still needed even at 216dp — 236dp is a cramped phone column, not a measure for a hemistich.

The diff is now 3 files, +22/−2

PoemScreen.kt   | 13 +++++++++++--
WordSheet.kt    |  7 +++++++
ColumnBrowser/README.md | 4 ++++

Builds clean, 63 tests pass.

Note on the other two PRs

#4 and #5 are already in main (merged directly at your request — both now show 0 commits ahead of main). They can be closed as merged; there is nothing left to pull from them.

Still unverified

The 700dp behaviour was confirmed on device before the dictionary narrowed to 216dp. The arithmetic above says the sheet still wins there, but I have not re-run it since that change.

## Conflicts resolved — and the scope has shrunk `main` moved on while this sat open (it was 7 ahead / 1 behind, conflicting in 4 files). Merged `main` in; **mergeable again**. Most of what this branch originally carried has since been answered better on main, so it was dropped rather than forced through: - **The settings fallback is gone.** `aab8b2e` folds the columns away for the settings panel, which is a better answer than falling back to a sheet. Dropped. - **The shared `SidePanelWidth` is gone.** The two panels no longer *want* the same width — the dictionary is now 216dp against the settings' 360dp. Dropped. Conflicting files were taken from `main` as they stand. ### What survives The reason the branch exists. Which container the dictionary uses is still decided by the width of the **window**, and that is the wrong question — what matters is what's left of the **page** once the columns have taken theirs. Recalculated for the narrower 216dp panel: | Geometry | Page before panel | Less 216dp | Result | |---|---|---|---| | Tablet, 1280dp | ~900dp | 684dp | panel ✓ | | Foldable portrait, 700dp | ~450dp | **236dp** | sheet ✓ | So the guard is still needed even at 216dp — 236dp is a cramped phone column, not a measure for a hemistich. ### The diff is now 3 files, +22/−2 ``` PoemScreen.kt | 13 +++++++++++-- WordSheet.kt | 7 +++++++ ColumnBrowser/README.md | 4 ++++ ``` Builds clean, 63 tests pass. ### Note on the other two PRs **#4 and #5 are already in `main`** (merged directly at your request — both now show 0 commits ahead of main). They can be closed as merged; there is nothing left to pull from them. ### Still unverified The 700dp behaviour was confirmed on device **before** the dictionary narrowed to 216dp. The arithmetic above says the sheet still wins there, but I have not re-run it since that change.
anas closed this pull request 2026-10-07 16:53:12 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: anas/ganjoorandroid#3
No description provided.