feat(reader): collapse extra attachments into an accordion #136

Merged
JMR-dev merged 1 commits from feat-reader-attachment-accordion into main 2026-07-02 15:08:35 +00:00
JMR-dev commented 2026-07-02 14:57:37 +00:00 (Migrated from github.com)

What & why

In the message reader, a message with several attachments rendered every AttachmentRow
stacked vertically (attachments.forEach { AttachmentRow(...) }), pushing the message body
arbitrarily far down the screen. This collapses the extras behind an accordion.

Behavior

  • 0 attachments: unchanged (caller still guards if (attachments.isNotEmpty())).
  • Exactly 1 attachment: renders the single AttachmentRow as before — no accordion.
  • More than 1: always shows the first row, then a collapsed control below it — a down
    chevron + "See x more attachments" (x = attachments.size - 1). Tapping expands rows
    2..N; tapping again collapses. Default state is collapsed. On expand the chevron rotates
    (down→up) and the label flips to "See fewer attachments". The reveal is animated with
    AnimatedVisibility, matching the existing AdvancedServers accordion idiom.

Pluralization

Uses a <plurals> resource (attachments_see_more, quantity="one"/"other") via
pluralStringResource, not string concatenation:

  • 1 extra → "See 1 more attachment"
  • 2+ extras → "See 2 more attachments"

Accessibility

The toggle is a single clickable Role.Button; the chevron carries a contentDescription
("Expand attachments" / "Collapse attachments") that flips with state, so the expanded state
is exposed to screen readers. Each row's download/open behavior and downloading/downloaded
state are untouched.

Tests

Extended ReaderScreenTest (androidTest Compose UI), all block-body @Test methods returning
Unit:

  • single attachment shows no "See more" control;
  • three attachments show the first row + "See 2 more attachments", with rows 2–3 hidden until
    the control is tapped, then revealed;
  • two attachments use the singular plural form ("See 1 more attachment").

Verification

Local fast gate green: :app:assembleDebug :app:testDebugUnitTest :app:lintDebug :app:ktlintCheck :app:detekt plus :app:compileDebugAndroidTestKotlin. Instrumented E2E left
to CI. Scope limited to ui/reader/ReaderScreen.kt, strings.xml, and ReaderScreenTest.kt.

Closes #134

🤖 Generated with Claude Code

## What & why In the message reader, a message with several attachments rendered **every** `AttachmentRow` stacked vertically (`attachments.forEach { AttachmentRow(...) }`), pushing the message body arbitrarily far down the screen. This collapses the extras behind an accordion. ## Behavior - **0 attachments:** unchanged (caller still guards `if (attachments.isNotEmpty())`). - **Exactly 1 attachment:** renders the single `AttachmentRow` as before — no accordion. - **More than 1:** always shows the **first** row, then a collapsed control below it — a down chevron + **"See x more attachments"** (`x = attachments.size - 1`). Tapping expands rows 2..N; tapping again collapses. Default state is collapsed. On expand the chevron rotates (down→up) and the label flips to **"See fewer attachments"**. The reveal is animated with `AnimatedVisibility`, matching the existing `AdvancedServers` accordion idiom. ## Pluralization Uses a `<plurals>` resource (`attachments_see_more`, `quantity="one"/"other"`) via `pluralStringResource`, not string concatenation: - 1 extra → "See 1 more attachment" - 2+ extras → "See 2 more attachments" ## Accessibility The toggle is a single clickable `Role.Button`; the chevron carries a `contentDescription` ("Expand attachments" / "Collapse attachments") that flips with state, so the expanded state is exposed to screen readers. Each row's download/open behavior and `downloading`/`downloaded` state are untouched. ## Tests Extended `ReaderScreenTest` (androidTest Compose UI), all block-body `@Test` methods returning `Unit`: - single attachment shows no "See more" control; - three attachments show the first row + "See 2 more attachments", with rows 2–3 hidden until the control is tapped, then revealed; - two attachments use the singular plural form ("See 1 more attachment"). ## Verification Local fast gate green: `:app:assembleDebug :app:testDebugUnitTest :app:lintDebug :app:ktlintCheck :app:detekt` plus `:app:compileDebugAndroidTestKotlin`. Instrumented E2E left to CI. Scope limited to `ui/reader/ReaderScreen.kt`, `strings.xml`, and `ReaderScreenTest.kt`. Closes #134 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.