Skip to content

refactor(ui): build grouped lists on Material's segmented list items - #111

Merged
thisislvca merged 3 commits into
mainfrom
claude/dazzling-bardeen-0vg0kz-lists
Dec 2, 2026
Merged

thisislvca merged 3 commits into
mainfrom
claude/dazzling-bardeen-0vg0kz-lists

Conversation

@thisislvca

@thisislvca thisislvca commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

Item 3 of the Material 3 review. The grouped lists on settings-style screens were hand-built from Row + clickable with their own padding, heights and segment shapes, and their subtitles disagreed (bodySmall in AlbaListRow, bodyMedium in AlbaSwitchRow). 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 ships SegmentedListItem as stable, so the Alba rows now wrap it.

What changed

  • AlbaListRow is SegmentedListItem: the clickable overload for a button row (still Role.Button), the selectable one for a radio row (Role.RadioButton, selected), the plain one when onClick is null. Its parameters, names and test tags are unchanged, so no call site changes.
  • AlbaSwitchRow is the toggleable SegmentedListItem with the stock Switch trailing (onCheckedChange = null). The whole row toggles and reads as one Role.Switch node (the stock overload says Checkbox, and Alba's outer semantics override it), with no second toggle target.
  • AlbaFeatureRow is the plain SegmentedListItem (title in titleMedium, icon at the top).
  • One subtitle style: the stock supporting text (bodyMedium, onSurfaceVariant).
  • Padding and heights are Material's (ListItemDefaults.ContentPadding, 56/72/88dp for one, two and three lines) unless a caller passes contentPadding or minHeight. minHeight now defaults to Dp.Unspecified (Material's heights). gap keeps working as extra space beyond Material's 12dp.
  • AlbaListDefaults holds the colours and shapes in one place:
    • colors(containerColor = albaGroupColor(), contentColor = LocalContentColor.current) wraps ListItemDefaults.segmentedColors. Inside a group the container is albaGroupColor() (surfaceContainer, as before); outside one (cards, dialogs, sheets, the viewer's detail actions) it is transparent. Title and leading content still follow LocalContentColor, 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() is ListItemDefaults.shapes() (small corners at rest). SegmentGap is ListItemDefaults.SegmentedGap (2dp, unchanged).
    • fix(ui): follow Material and Android for sheets, back, icons, speed, toggles and haptics #109 changes the container colour in sheets through albaGroupColor()/LocalInAlbaSheet. The rows read that colour only through AlbaListDefaults.colors()'s default, so the two PRs should merge cleanly.
  • AlbaListGroup still spaces segments by the gap (no dividers, no chevrons) and clips the group's outer corners to shapes.large. That is the corner ListItemDefaults.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. AlbaListItem and albaListSegment() (blocks that are not rows) use the same shape and colour.

Visible differences

  • Rows with a 40dp leading box are 60dp tall instead of 68dp, because Material's vertical padding is 10dp, not 14dp. Two-line rows use Material's 72dp minimum, so rows whose callers set tighter padding (phone storage categories, shared album people) can grow a little.
  • AlbaListRow subtitles are bodyMedium instead of bodySmall, and there is no 2dp gap between title and subtitle.
  • The gap between a leading icon and the text is Material's 12dp. Switch rows (icon to title was 12dp, text to switch 16dp) and feature rows (16dp) change slightly.
  • Pressing or focusing a grouped row morphs it to Material's rounded pressed/focused shape (the stock expressive list behaviour). It runs on the theme's motion scheme, so it follows the system animation scale (off with reduced motion). A checked switch row or a selected row keeps its resting shape and colours.
  • Tall items top-align their leading and trailing content, Material's ListItemDefaults.verticalAlignment().
  • Plain rows (no 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

  • New AlbaListRowsTest (Robolectric): a switch row is one Role.Switch node 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.
  • BackupPageTest and BackupHeroTest look up the failure row's subtitle tag in the unmerged tree, because the plain row now merges its text. The assertions are unchanged. BackupHeroTest's assertDoesNotExist would otherwise have passed trivially.
  • Local: the full :app:testDebugUnitTest ran once (717 tests). Its only failure was the BackupPageTest finder fixed above. After the fix I reran AlbaListRowsTest and the transfers, account, shared, albums, screenshots and localization packages: 361 tests, 0 failures. Screenshots render locally but are compared only in CI. compileDebugUnitTestKotlin, compileDebugAndroidTestKotlin, detekt and ktlintCheck pass. No device tests were run.
  • Expect golden diffs for every screen with grouped lists: profile, account, backup page, phone storage, device folders, Free up space, about, shared album details and sheet. Rows outside groups (the album chooser, the limit dialogs, the filter sheet, the viewer's detail actions) set their own padding, so they should barely change.

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.

Screen Before After
account-permissions (standard) account-permissions standard before account-permissions standard after
account-permissions (dark) account-permissions dark before account-permissions dark after
backup-page-backing-up (standard) backup-page-backing-up standard before backup-page-backing-up standard after
backup-page-backing-up (dark) backup-page-backing-up dark before backup-page-backing-up dark after
backup-page-how-it-works (standard) backup-page-how-it-works standard before backup-page-how-it-works standard after
backup-page-how-it-works (dark) backup-page-how-it-works dark before backup-page-how-it-works dark after
backup-page-settings (standard) backup-page-settings standard before backup-page-settings standard after
backup-page-settings (dark) backup-page-settings dark before backup-page-settings dark after
backup-page-waiting-wifi (standard) backup-page-waiting-wifi standard before backup-page-waiting-wifi standard after
backup-page-waiting-wifi (dark) backup-page-waiting-wifi dark before backup-page-waiting-wifi dark after
collections (standard) collections standard before collections standard after
device-folders (standard) device-folders standard before device-folders standard after
device-folders (dark) device-folders dark before device-folders dark after
free-up-space (standard) free-up-space standard before free-up-space standard after
free-up-space (dark) free-up-space dark before free-up-space dark after
phone-storage (standard) phone-storage standard before phone-storage standard after
phone-storage (dark) phone-storage dark before phone-storage dark after
search (standard) search standard before search standard after
shared-album-details-legacy (standard) shared-album-details-legacy standard before shared-album-details-legacy standard after
shared-album-details-legacy (dark) shared-album-details-legacy dark before shared-album-details-legacy dark after
shared-album-details-modern (standard) shared-album-details-modern standard before shared-album-details-modern standard after
shared-album-details-modern (dark) shared-album-details-modern dark before shared-album-details-modern dark after
shared-album-sheet-member (standard) shared-album-sheet-member standard before shared-album-sheet-member standard after
shared-album-sheet-member (dark) shared-album-sheet-member dark before shared-album-sheet-member dark after
shared-album-sheet-member-end (standard) <img src="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"> <img src="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-member-end dark before shared-album-sheet-member-end dark after
shared-album-sheet-owner (standard) shared-album-sheet-owner standard before shared-album-sheet-owner standard after
shared-album-sheet-owner (dark) shared-album-sheet-owner dark before shared-album-sheet-owner dark after
shared-album-sheet-owner-end (standard) <img src="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"> <img src="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) shared-album-sheet-owner-end dark before shared-album-sheet-owner-end dark after

Generated by Claude Code

claude and others added 2 commits December 1, 2026 18:04
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
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Screenshot goldens updated

CI recorded the goldens on Linux and pushed ff47097 to this branch. The checks run again on it.

dark

  • Changed: account-permissions, backup-page-backing-up, backup-page-how-it-works, backup-page-settings, backup-page-waiting-wifi, device-folders, free-up-space, phone-storage, shared-album-details-legacy, shared-album-details-modern, shared-album-sheet-member-end, shared-album-sheet-member, shared-album-sheet-owner-end, shared-album-sheet-owner

standard

  • Changed: account-permissions, backup-page-backing-up, backup-page-how-it-works, backup-page-settings, backup-page-waiting-wifi, collections, device-folders, free-up-space, phone-storage, search, shared-album-details-legacy, shared-album-details-modern, shared-album-sheet-member-end, shared-album-sheet-member, shared-album-sheet-owner-end, shared-album-sheet-owner

Review the images in Files changed before merging: merging accepts them.

@thisislvca
thisislvca merged commit a8f661c into main Dec 2, 2026
5 checks passed
@thisislvca
thisislvca deleted the claude/dazzling-bardeen-0vg0kz-lists branch December 2, 2026 01:21
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.

2 participants