Repository navigation
refactor(ui): build grouped lists on Material's segmented list items - #111
Merged
Merged
Conversation
AlbaListRow, AlbaSwitchRow and AlbaFeatureRow are now Material 3's SegmentedListItem (plain, clickable, selectable and toggleable overloads) instead of a hand-built Row with its own padding, heights and segment shapes. Their public APIs and test tags are unchanged. - Supporting text uses the stock style (bodyMedium, onSurfaceVariant) everywhere; AlbaListRow's subtitle was bodySmall. - Padding and heights are Material's (56/72/88dp) unless a caller sets contentPadding or minHeight. - AlbaSwitchRow is the toggleable item with the stock Switch trailing: the whole row toggles and reads as one Role.Switch node. - Colours and shapes live in AlbaListDefaults: the container comes from albaGroupColor() in a group and is transparent elsewhere; title and leading content keep following LocalContentColor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vGQ3zr1LSQtH3D545V8mU
Golden-Changed: dark/account-permissions.png Golden-Changed: dark/backup-page-backing-up.png Golden-Changed: dark/backup-page-how-it-works.png Golden-Changed: dark/backup-page-settings.png Golden-Changed: dark/backup-page-waiting-wifi.png Golden-Changed: dark/device-folders.png Golden-Changed: dark/free-up-space.png Golden-Changed: dark/phone-storage.png Golden-Changed: dark/shared-album-details-legacy.png Golden-Changed: dark/shared-album-details-modern.png Golden-Changed: dark/shared-album-sheet-member-end.png Golden-Changed: dark/shared-album-sheet-member.png Golden-Changed: dark/shared-album-sheet-owner-end.png Golden-Changed: dark/shared-album-sheet-owner.png Golden-Changed: standard/account-permissions.png Golden-Changed: standard/backup-page-backing-up.png Golden-Changed: standard/backup-page-how-it-works.png Golden-Changed: standard/backup-page-settings.png Golden-Changed: standard/backup-page-waiting-wifi.png Golden-Changed: standard/collections.png Golden-Changed: standard/device-folders.png Golden-Changed: standard/free-up-space.png Golden-Changed: standard/phone-storage.png Golden-Changed: standard/search.png Golden-Changed: standard/shared-album-details-legacy.png Golden-Changed: standard/shared-album-details-modern.png Golden-Changed: standard/shared-album-sheet-member-end.png Golden-Changed: standard/shared-album-sheet-member.png Golden-Changed: standard/shared-album-sheet-owner-end.png Golden-Changed: standard/shared-album-sheet-owner.png
Contributor
Screenshot goldens updatedCI recorded the goldens on Linux and pushed ff47097 to this branch. The checks run again on it. dark
standard
Review the images in Files changed before merging: merging accepts them. |
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.
Item 3 of the Material 3 review. The grouped lists on settings-style screens were hand-built from
Row+clickablewith their own padding, heights and segment shapes, and their subtitles disagreed (bodySmallinAlbaListRow,bodyMediuminAlbaSwitchRow). docs/design.md asks for "Android 16 grouped list items" built from "Stock Material 3 components … Wrap them for consistency; don't redraw them." Material 3 1.5.0 shipsSegmentedListItemas stable, so the Alba rows now wrap it.What changed
AlbaListRowisSegmentedListItem: the clickable overload for a button row (stillRole.Button), the selectable one for a radio row (Role.RadioButton, selected), the plain one whenonClickis null. Its parameters, names and test tags are unchanged, so no call site changes.AlbaSwitchRowis the toggleableSegmentedListItemwith the stockSwitchtrailing (onCheckedChange = null). The whole row toggles and reads as oneRole.Switchnode (the stock overload says Checkbox, and Alba's outer semantics override it), with no second toggle target.AlbaFeatureRowis the plainSegmentedListItem(title in titleMedium, icon at the top).ListItemDefaults.ContentPadding, 56/72/88dp for one, two and three lines) unless a caller passescontentPaddingorminHeight.minHeightnow defaults toDp.Unspecified(Material's heights).gapkeeps working as extra space beyond Material's 12dp.AlbaListDefaultsholds the colours and shapes in one place:colors(containerColor = albaGroupColor(), contentColor = LocalContentColor.current)wrapsListItemDefaults.segmentedColors. Inside a group the container isalbaGroupColor()(surfaceContainer, as before); outside one (cards, dialogs, sheets, the viewer's detail actions) it is transparent. Title and leading content still followLocalContentColor, so the error-coloured Leave row and the viewer's ink keep working. A row looks the same disabled or selected, as before: callers dim disabled rows themselves, and selected rows show their radio or check.segmentShapes()isListItemDefaults.shapes()(small corners at rest).SegmentGapisListItemDefaults.SegmentedGap(2dp, unchanged).albaGroupColor()/LocalInAlbaSheet. The rows read that colour only throughAlbaListDefaults.colors()'s default, so the two PRs should merge cleanly.AlbaListGroupstill spaces segments by the gap (no dividers, no chevrons) and clips the group's outer corners toshapes.large. That is the cornerListItemDefaults.segmentedShapes(index, count)gives a list's first and last items. A group's children are any composables, some of them conditional, so a row can't know its index; the clip draws the same result.AlbaListItemandalbaListSegment()(blocks that are not rows) use the same shape and colour.Visible differences
AlbaListRowsubtitles are bodyMedium instead of bodySmall, and there is no 2dp gap between title and subtitle.ListItemDefaults.verticalAlignment().onClick) now merge their text into one accessibility node, as Material's list item does.No strings added or removed. No test tags added or removed.
Tests
AlbaListRowsTest(Robolectric): a switch row is oneRole.Switchnode that the whole row toggles, with exactly one toggleable node in the unmerged tree. Button, radio and plain rows keep their roles. A group draws no dividers.BackupPageTestandBackupHeroTestlook up the failure row's subtitle tag in the unmerged tree, because the plain row now merges its text. The assertions are unchanged.BackupHeroTest'sassertDoesNotExistwould otherwise have passed trivially.:app:testDebugUnitTestran once (717 tests). Its only failure was theBackupPageTestfinder fixed above. After the fix I reranAlbaListRowsTestand thetransfers,account,shared,albums,screenshotsandlocalizationpackages: 361 tests, 0 failures. Screenshots render locally but are compared only in CI.compileDebugUnitTestKotlin,compileDebugAndroidTestKotlin,detektandktlintCheckpass. No device tests were run.Screenshots
Before is 9726857, after is ff47097, both recorded by CI on Linux. Standard and dark are shown; other variants that changed are listed under the table.
account-permissions(standard)account-permissions(dark)backup-page-backing-up(standard)backup-page-backing-up(dark)backup-page-how-it-works(standard)backup-page-how-it-works(dark)backup-page-settings(standard)backup-page-settings(dark)backup-page-waiting-wifi(standard)backup-page-waiting-wifi(dark)collections(standard)device-folders(standard)device-folders(dark)free-up-space(standard)free-up-space(dark)phone-storage(standard)phone-storage(dark)search(standard)shared-album-details-legacy(standard)shared-album-details-legacy(dark)shared-album-details-modern(standard)shared-album-details-modern(dark)shared-album-sheet-member(standard)shared-album-sheet-member(dark)shared-album-sheet-member-end(standard)https://raw.githubusercontent.com/thisislvca/alba/9726857747818d19e65f8973105dfc4d5ec1f12f/app/src/test/screenshots/standard/shared-album-sheet-member-end.png"width="260" alt="shared-album-sheet-member-end standard before">https://raw.githubusercontent.com/thisislvca/alba/ff47097fa23ba1a45569b571581816459ddd307c/app/src/test/screenshots/standard/shared-album-sheet-member-end.png"width="260" alt="shared-album-sheet-member-end standard after">shared-album-sheet-member-end(dark)shared-album-sheet-owner(standard)shared-album-sheet-owner(dark)shared-album-sheet-owner-end(standard)https://raw.githubusercontent.com/thisislvca/alba/9726857747818d19e65f8973105dfc4d5ec1f12f/app/src/test/screenshots/standard/shared-album-sheet-owner-end.png"width="260" alt="shared-album-sheet-owner-end standard before">https://raw.githubusercontent.com/thisislvca/alba/ff47097fa23ba1a45569b571581816459ddd307c/app/src/test/screenshots/standard/shared-album-sheet-owner-end.png"width="260" alt="shared-album-sheet-owner-end standard after">shared-album-sheet-owner-end(dark)Generated by Claude Code