Repository navigation
fix(now-playing): keep the controls on screen in short and square windows - #377
Merged
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #376.
Cause
Configuration.orientation, and button sizes fromFormFactor, which goes by width only. A phone on its side (about 993x330dp for Now Playing) counts asTABLET_10and got 88dp/72dp buttons.Change
BoxWithConstraints): wider than tall puts the art beside the controls.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.weight(fill = false)inside a column withheightIn(min = viewport)), and landscape art is capped at 40% of the row width.Tall phones and tablets look the same as before.
Testing
wm size/wm densitybefore the fix and checked after it: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.