Skip to content

fix(now-playing): keep the controls on screen in short and square windows - #377

Merged
chrisuthe merged 1 commit into
mainfrom
fix/now-playing-fit
Oct 17, 2026
Merged

chrisuthe merged 1 commit into
mainfrom
fix/now-playing-fit

Conversation

@chrisuthe

Copy link
Copy Markdown
Owner

Fixes #376.

Cause

  • The layout was chosen from Configuration.orientation, and button sizes from FormFactor, which goes by width only. A phone on its side (about 993x330dp for Now Playing) counts as TABLET_10 and got 88dp/72dp buttons.
  • Neither layout could shrink or scroll. The landscape column centred content taller than itself, so it spilled past both edges and the volume slider was drawn over the switch-group button. The portrait layout's 70%-width artwork pushed the controls off the bottom of a square window.

Change

  • The layout follows the shape of the space Now Playing has (BoxWithConstraints): wider than tall puts the art beside the controls.
  • When Now Playing has less than 480dp of height, a tablet form factor gets the phone's buttons (controlsFormFactor). Landscape then puts switch group at the end of the transport row (PlaybackControls(secondaryInline = true)) and uses 16dp of vertical padding instead of 24dp.
  • Portrait art takes only the height the rest leaves (weight(fill = false) inside a column with heightIn(min = viewport)), and landscape art is capped at 40% of the row width.
  • Both layouts scroll as a last resort, for windows too small for anything else to work.

Tall phones and tablets look the same as before.

Testing

  • Emulator, the three cases from the issue reproduced with wm size/wm density before the fix and checked after it:
    • Fairphone-like landscape, 1116x2484 at 400dpi: everything fits now, switch group is inline, and nothing overlaps.
    • Square floating window, 746x761 at 227dpi: the art shrinks and every control is visible.
    • Wide floating window, 930x429 at 227dpi (about 180dp of content height): the controls column scrolls to every control.
    • Normal phone portrait: unchanged.
  • T901 tablet: landscape at 186dpi and portrait are unchanged. Landscape at 280dpi takes the compact path and everything fits. The density and auto-rotate settings were restored afterwards.
  • New NowPlayingFitTest (Robolectric), 6 tests. Against the old layout code the phone-landscape test and the too-short-window test fail. Robolectric's text lines are about twice a device's height, so the phone-landscape test checks the transport row and reaches the volume slider by scrolling. It does not assert that everything fits.
  • ./gradlew testDebugUnitTest: 1914 tests, 0 failures.

…dows

Now Playing picked its layout from the device orientation and sized its buttons by window width alone, and neither layout could shrink or scroll. A phone on its side reads as a 10" tablet by width, so it got the tablet's 88dp buttons in about 330dp of height, and the volume slider was drawn over the switch-group button. A square floating window took the portrait layout, whose artwork pushed the controls off the bottom.

- The layout follows the shape of the space Now Playing has: wider than tall puts the art beside the controls.
- Under 480dp of height a tablet form factor gets the phone's buttons, and the landscape layout puts switch group at the end of the transport row and trims its vertical padding.
- Portrait art gives up height before the controls do; landscape art leaves the controls at least 60% of the width.
- Both layouts scroll when nothing else makes everything fit.

Fixes #376
@chrisuthe
chrisuthe merged commit dfd662b into main Oct 17, 2026
1 check passed
@chrisuthe
chrisuthe deleted the fix/now-playing-fit branch October 17, 2026 16:50
Tomvis added a commit to Tomvis/SendspinDroid that referenced this pull request Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI-elements don't fit screen in certain scenarios

1 participant