Skip to content

feat(card): put the app on the main button and the rarer tools behind a menu - #1309

Merged
astrovm merged 4 commits into
mainfrom
feat/main-card-tidy
Nov 28, 2026
Merged

astrovm merged 4 commits into
mainfrom
feat/main-card-tidy

Conversation

@astrovm

@astrovm astrovm commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

A song's card had four rows of controls: the app chip, the main button with two icons beside it, and a row of up to six tools. This makes it two.

What changes

  1. The app is part of the main button. The app's icon sits at the end of Play (or Open, Search), behind a thin line. A tap there opens the same list of apps the chip opened. The chip above the button is gone.
  2. The other ways in are tools with a word. Search and Open were icon-only buttons beside Play, which moved under it at big fonts. They are now flat tools in the row under the button, after Lyrics, each with its word.
  3. A song's rarer tools are behind ⋮. Copy link, Share link and Download are rows of a menu, each said whole with its icon. A playlist or album keeps all its tools in the row, as it has fewer ways in.
  4. Download stays in sight once it's used. While a song is being saved, is kept, or there is no room left, Download is in the row and shows its state, as before. After the song is let go, it stays in the row until another song's card, so the button does not jump away under the finger or the remote.
  5. A main button that can't be pressed is grey, with both of its ends.
  6. Screen readers hear the app's name and then "Choose app" on the button's end, as before. The main button, its app end and ⋮ are announced as buttons.

Tests

  1. CardButtonsLayoutTest is rewritten for the new button: both ends as tall, the line between, the card's width, the roles, the grey fill, mirrored right to left, the tools under it.
  2. CardToolsFitTest checks, in 16 languages at the largest fonts on a narrow phone, a common one and a TV, that the button spans the card, its word is never smaller than at the default font, each tool and ⋮ is in sight and at least 48 dp, each menu row is shown, and a kept song's fuller row fits.
  3. KeepOfflineButtonTest checks the menu row's text per state, that a kept song has Download in the row, and that it stays there after the song is let go, until another song.
  4. TvPlayTest: right from Play lands on the app and left goes back, down goes to the tools, and a tool picked behind ⋮ leaves the remote on ⋮.
  5. MainActivityTest and ListeningTest helpers open ⋮ when a tool is behind it. The swipe tests tell the player by its cover, as the card has a ⋮ too.

Done when

  • :app:ci passes locally (all tests, 100% line coverage, lint, detekt): green on the tree of 67ac7cf
  • CI and mutation testing pass on 67ac7cf
  • Checked on the Samsung, build of 67ac7cf: song, ⋮ menu, kept, let go, another song, playlist, a link not found, German at 2x font with the menu, light, dark, pure black. 0 crashes
  • Checked on the TV emulator: focus starts on Play, right reaches the app and back returns to it, down reaches ⋮, the menu opens on Copy link, focus returns to ⋮ after a pick
  • Store screenshots and site clips redrawn (754b66d)
  • Agent review: three reviews, the third found no defect

Review

Fixed from the reviews:

  1. A kept song's Download state was hidden behind ⋮. It is in the row now while it is saving, kept or out of room.
  2. Un-keeping a song on a TV moved the button under the remote. It stays in the row until another song.
  3. The main button, its app end and ⋮ had no button role.
  4. A main button that can't be pressed looked enabled.
  5. Tests: sizes, roles, the menu rows and the kept row were not held.

Not changed, and why:

  1. The press animation covers the whole button, also for a press on its app end. It is one button with two ends, and it reads as one.
  2. Two things are named "More": ⋮ and the last row of the app list. It is the same word the app uses elsewhere for "the rest", and a second word costs more than it gives.
  3. The ⋮ menu's open state could outlive its card. The menu closes when the result changes; KeepOfflineButtonTest shows another song's card with its row as new.
  4. The floating Play does not look disabled. It was so before this PR: Issue The floating Play button doesn't look disabled while it can't be pressed #1310.
  5. When a song's details change right after it is let go, Download can go back behind ⋮ early. Rare, and it costs one tap.
  6. CardToolsFitTest measures the room a word has, not its drawn size. Robolectric does not report the drawn size of auto-sized text. The phone check at 2x font covers what it cannot.

Known issues

  1. Issue The floating Play button doesn't look disabled while it can't be pressed #1310: the floating Play button does not look disabled while it can't be pressed. Not from this PR.
  2. Found during the phone check, not from this PR: a song heard on a radio app (VRadio) dropped back to the station name every 15 to 30 seconds. The fix is in PR fix(play): keep a song heard on a radio app, and name it by the first listen #1311.

@github-actions

Copy link
Copy Markdown
Contributor

Mutation testing: 71 of 85 changes caught by a test.

CrosstuneScreen.kt:1589  survived: negated conditional [class=com.astrovm.crosstune.CrosstuneScreenKt method=ResultCard$lambda$2$4(Lcom/astrovm/crosstune/MusicMetadata;Lcom/astrovm/crosstune/ScreenActions;Lcom/astrovm/crosstune/UiState;Lcom/astrovm/crosstune/Destination;Ljava/util/List;ZLandroidx/compose/foundation/layout/FlowRowScope;Landroidx/compose/runtime/Composer;I)Lkotlin/Unit; mutator=org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator index=251 block=66]
CrosstuneScreen.kt:1617  survived: removed call to androidx/compose/runtime/ScopeUpdateScope::updateScope [class=com.astrovm.crosstune.CrosstuneScreenKt method=ResultCard(Lcom/astrovm/crosstune/MusicMetadata;Lcom/astrovm/crosstune/UiState;Lcom/astrovm/crosstune/ScreenActions;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;II)V mutator=org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator index=2744 block=451]
CrosstuneScreen.kt:1624  timed out: replaced int return with 0 for com/astrovm/crosstune/Tool::getIcon [class=com.astrovm.crosstune.Tool method=getIcon()I mutator=org.pitest.mutationtest.engine.gregor.mutators.returns.PrimitiveReturnsMutator index=5 block=0]
CrosstuneScreen.kt:1642  survived: negated conditional [class=com.astrovm.crosstune.CrosstuneScreenKt method=MainButton(Lcom/astrovm/crosstune/MainAction;Lcom/astrovm/crosstune/UiState;Lcom/astrovm/crosstune/ScreenActions;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;I)V mutator=org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator index=162 block=44]
CrosstuneScreen.kt:1661  survived: negated conditional [class=com.astrovm.crosstune.CrosstuneScreenKt method=MainButton(Lcom/astrovm/crosstune/MainAction;Lcom/astrovm/crosstune/UiState;Lcom/astrovm/crosstune/ScreenActions;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;I)V mutator=org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator index=723 block=142]
CrosstuneScreen.kt:1666  survived: replaced return value with null for com/astrovm/crosstune/CrosstuneScreenKt::MainButton$lambda$4$1$1$0 [class=com.astrovm.crosstune.CrosstuneScreenKt method=MainButton$lambda$4$1$1$0(Lcom/astrovm/crosstune/MainAction;)Ljava/lang/Object; mutator=org.pitest.mutationtest.engine.gregor.mutators.returns.NullReturnValsMutator index=16 block=5]
CrosstuneScreen.kt:1674  survived: removed call to com/astrovm/crosstune/CrosstuneScreenKt::DestinationIcon-6a0pyJM [class=com.astrovm.crosstune.CrosstuneScreenKt method=MainButton$lambda$4$1$2(Landroidx/compose/ui/text/TextStyle;Lcom/astrovm/crosstune/UiState;Landroidx/compose/animation/AnimatedContentScope;Lcom/astrovm/crosstune/MainAction;Landroidx/compose/runtime/Composer;I)Lkotlin/Unit; mutator=org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator index=510 block=88]
CrosstuneScreen.kt:1675  survived: removed call to com/astrovm/crosstune/ComponentsKt::AppIcon-ww6aTOc [class=com.astrovm.crosstune.CrosstuneScreenKt method=MainButton$lambda$4$1$2(Landroidx/compose/ui/text/TextStyle;Lcom/astrovm/crosstune/UiState;Landroidx/compose/animation/AnimatedContentScope;Lcom/astrovm/crosstune/MainAction;Landroidx/compose/runtime/Composer;I)Lkotlin/Unit; mutator=org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator index=542 block=97]
CrosstuneScreen.kt:1676  survived: removed call to androidx/compose/foundation/layout/SpacerKt::Spacer [class=com.astrovm.crosstune.CrosstuneScreenKt method=MainButton$lambda$4$1$2(Landroidx/compose/ui/text/TextStyle;Lcom/astrovm/crosstune/UiState;Landroidx/compose/animation/AnimatedContentScope;Lcom/astrovm/crosstune/MainAction;Landroidx/compose/runtime/Composer;I)Lkotlin/Unit; mutator=org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator index=569 block=105]
CrosstuneScreen.kt:1703  survived: removed call to com/astrovm/crosstune/CrosstuneScreenKt::DestinationIcon-6a0pyJM [class=com.astrovm.crosstune.CrosstuneScreenKt method=MainButton$lambda$4$2$2(Lcom/astrovm/crosstune/UiState;Landroidx/compose/runtime/MutableState;Landroidx/compose/runtime/Composer;I)Lkotlin/Unit; mutator=org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator index=325 block=49]
CrosstuneScreen.kt:1707  no coverage: removed call to com/astrovm/crosstune/CrosstuneScreenKt::MainButton$lambda$2 [class=com.astrovm.crosstune.CrosstuneScreenKt method=MainButton$lambda$4$2$3$0(Landroidx/compose/runtime/MutableState;)Lkotlin/Unit; mutator=org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator index=5 block=0]
CrosstuneScreen.kt:1738  no coverage: removed call to com/astrovm/crosstune/CrosstuneScreenKt::MoreTools$lambda$2 [class=com.astrovm.crosstune.CrosstuneScreenKt method=MoreTools$lambda$3$2$0(Landroidx/compose/runtime/MutableState;)Lkotlin/Unit; mutator=org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator index=5 block=0]
CrosstuneScreen.kt:1743  survived: removed call to androidx/compose/material3/IconKt::Icon-ww6aTOc [class=com.astrovm.crosstune.CrosstuneScreenKt method=MoreTools$lambda$3$3$0$2(Lcom/astrovm/crosstune/Tool;Landroidx/compose/runtime/Composer;I)Lkotlin/Unit; mutator=org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator index=70 block=15]
CrosstuneScreen.kt:1898  survived: Replaced bitwise AND with OR [class=com.astrovm.crosstune.CrosstuneScreenKt method=ToolAction(ILjava/lang/String;Lkotlin/jvm/functions/Function0;ZLjava/lang/String;ZLjava/lang/Object;Landroidx/compose/runtime/Composer;II)V mutator=org.pitest.mutationtest.engine.gregor.mutators.MathMutator index=251 block=66]

Each one is a change to the code no test noticed. Not a blocker: real gaps get their own PR. Full report

@astrovm
astrovm marked this pull request as ready for review November 28, 2026 21:03
@astrovm
astrovm merged commit 5bb3884 into main Nov 28, 2026
23 checks passed
@astrovm
astrovm deleted the feat/main-card-tidy branch November 28, 2026 21:04
astrovm added a commit that referenced this pull request Nov 28, 2026
… listen (#1311)

A song heard on a radio app that names only its station (VRadio) did not
stay on the bar, and took two listens to name after Crosstune came back
in sight. A user reported the station shown as the song in 2.26.0. The
song is named now; this PR makes it stay.

## Causes and fixes

Measured on the Samsung with VRadio playing Mía FM.

### 1. The station's cover was dropped each time its app said it again

1. VRadio says its station again every 30 to 60 seconds: the same name
and logo, with a longer length.
2. On each one, `PlaybackCovers.forget` dropped the logo saved for that
session. The next read had no cover until the same picture was saved
again.
3. What plays went from "station with cover" to "station without cover"
and back. `MainViewModel` took each as another station, dropped the song
heard and listened again.

Fix: `PlaybackCovers` keeps the cover a session had, under the same
name, until the new one is saved. A new picture still replaces the old
one. This also stops a song's bitmap cover from blinking out when its
app resends the same song.

### 2. The first listen after the app is watched anew was thrown away

1. When what plays is watched anew (Crosstune back in sight), the listen
by ear started before the app's `follow` said how it plays.
2. The song heard then had nothing to be checked by. When the follow
arrived, `checkHeard` saw "nothing" become "something" and dropped the
hearing. Naming took two listens, about 10 s in place of 5 s.

Fix: `nameByEar` waits up to 1 s (`FOLLOW_SAID_MS`) for the follow of
the station it is about to hear. The wait is skipped for apps that
report no state, for Radio Garden and when no station plays. It is
cleared each time a station is followed anew.

## Other changes

1. `PlaybackCovers.of` is split into `known` and `saveLater` (detekt's
complexity limit).
2. The 2.29.0 changelog is rewritten to fit Play's 500 characters (457),
with the card redesign of PR #1309 and "A song heard on a radio app
stays named."

## Tests

1. `PlaybackTest.aStationSaidAgainKeepsItsCoverSoItStaysTheSameStation`:
fails without fix 1.
2.
`PlaybackTest.aCoverKeptWhileItsSavedAgainIsOnlyForItsOwnSessionAndName`:
the kept cover is never given to another name or session.
3. `MainViewModelTest.aStationWatchedAgainIsNamedByItsFirstListen`:
fails without fix 2 ("expected 1 but was 2"). Its last step (station,
then a song its app names, then the station again) fails without the
reset in `collectLatest` ("expected 4 but was 5").
4.
`comingBackToCrosstuneDropsTheSongHeardThenListensAgainAtOnceOnceTheBarIsInSight`:
with the follow held, the listen comes after `FOLLOW_SAID_MS`.

## Done when

- [x] `:app:ci` passes locally (7d472e7: BUILD SUCCESSFUL, 16m 38s;
the merge of `main` after it touched none of this PR's files)
- [x] CI and mutation testing pass (da6d0ae: 20 of 20 checks; 53 of 55
mutants caught, the two left are explained under **Mutants**)
- [x] Checked on the Samsung with VRadio, perf build of da6d0ae,
screen kept on: named 7 s after opening by the first listen; the song
stayed 51 s and 44 s through VRadio's resends, changing only when the
station went to its next song; after leaving and coming back, named
again within 8 s by one listen. The song card of PR #1309 shows as
designed in the same build. No crash in the log.
- [x] Agent review

## Mutants

Two survived, and neither is a test gap:

1. `MainViewModel.kt:1138`, the reset of `followSaid` in
`watchPlayingNow`, removed. The reset at the start of each follow covers
the same case in the tests. This one stays as a guard for a listen that
could start before the follow does.
2. `MainViewModel.kt:1234`, the value of the wait's block set to null.
The value is never read, so the change does nothing.

## Review

Three Sonnet reviews.

1. Review 1 (cover fix): no defect. Its suggested tests were added (test
2).
2. Review 2 (wait for the follow): two defects, both fixed. The wait
came after the joins of the other listeners, so time could pass between
it and the listen. `followSaid` was not cleared when a station was
followed anew, so a stale value skipped the wait.
3. Review 3 (those fixes): no defect. Rejected findings:
a. "No test fails without the reset": measured, the test fails without
it (4 expected, 5 listens).
b. "1 s per listen if the follow never says anything": the follow always
says a first value on registration; if it said nothing, the cost is 1 s
on listens 30 s or more apart, and the hearing is kept.
c. "A late write from an old follow job": the old watch is cancelled on
the main thread before the new one resets the value, so a cancelled
collector cannot write after it.

## Known issues

1. A song heard is not kept across a screen off and on: it costs one
listen (about 5 s) on return. Kept as it is on purpose, since the
station may have moved to another song meanwhile.
2. When a station's session ends, its follow can end a moment before the
station does, which starts one listen that is cancelled at once. `main`
does the same.
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.

1 participant