refactor(FormatEntity): centralize format display helpers and fix container naming#814
Closed
adam-adrian wants to merge 5 commits into
Closed
refactor(FormatEntity): centralize format display helpers and fix container naming#814adam-adrian wants to merge 5 commits into
adam-adrian wants to merge 5 commits into
Conversation
… labeling Move codecLabel(), containerLabel(), formattedBitrate(), formattedSampleRate(), and formattedFileSize() into FormatEntity.kt as public extensions, replacing ~70 lines of duplicated inline parsing scattered across 6 queue composables and the private codecLabel() in PlayerComponents.kt. The inline parsing in QueueComponents named its variable 'codec' while actually extracting the container from mimeType (e.g. 'WEBM' instead of 'opus'). Variable is now honestly named 'container'. User-facing display is unchanged. Bonus: bitrate formatting now returns 'Unknown' instead of '0 kbps' for local files where bitrate is not available.
Extract the duplicated title/artist tap behavior into a single rememberPlayerTitleActions() helper, and add a reusable ClickableArtists primitive that makes each artist name individually tappable. Classic, V7, V8 and V9 now share this behavior instead of each hand-rolling its own lambdas, removing prior feature drift (per-artist navigation previously existed only in the classic style). Visual rendering stays per-style: adding a new player style no longer requires touching shared title/artist code.
Tapping the song title navigated to the album but used snapTo to move the sheet, which jumps without animation and — crucially — does not update the sheet's internal anchor. The anchor could then go stale (e.g. still EXPANDED), so on the next recomposition the sheet snapped back open, making "tap title to collapse" appear broken on the home screen while it worked elsewhere. Use collapseSoft() instead, which animates and updates the anchor, matching the artist-tap behavior.
- Remove unused PlayerTitleActions.onFirstArtistClick (dead code) - ClickableArtists: use detectTapGestures instead of a standing awaitPointerEventScope loop; memoize the AnnotatedString; restore per-artist annotation tags; document the marquee hit-test caveat - Drop the now-unused clipboardManager/context params threaded through PlayerTitleSection / PlayerControlsContent (and remove dead imports)
Refactor/player title artist
76 tasks
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.
Summary
Extracts 5 reusable extension functions (
containerLabel,codecLabel,formattedBitrate,formattedSampleRate,formattedFileSize) intoFormatEntity.kt, replacing ~70 lines of duplicated inline formatting/parsing logic scattered across 6 queue composables inQueueComponents.ktand aprivateduplicate inPlayerComponents.kt.The inline parsing was naming its variable
codecwhile actually extracting the container frommimeType— variables are now honestly namedcontainer.No user-facing display changes; the player still shows the same
WEBM • 141 kbps • 3 MBrow.Linked Work
Change Type
Affected Surfaces
:app:innertube:betterlyrics:kugou:lrclib:lastfm:simpmusic:paxsenix:unison:canvas:shazamkit:spotifycoreserverfastlane.githubScreenshots / Recordings
No visual changes. Display output is identical before and after.
WEBM • 141 kbps • 3 MBWEBM • 141 kbps • 3 MBBehavior Notes
val codec = mimeType.substringAfter("/")was extracting the container, not the codec. Nowval container = currentFormat.containerLabel().formattedBitrate()returns"Unknown"whenbitrate == 0(local files fromLocalSongScanner), instead of the previous"0 kbps".formattedSampleRate()returnsnullandformattedFileSize()returns""when data is absent, matching the oldlistOfNotNulljoin logic.""to preserve the minimal display style.Architecture Checklist
Loading,Success,Empty, andErrorwhere this PR introduces or changes screen state.FormatEntityare pure and side-effect-free.)runBlockingis introduced in app execution paths.Compose / Material Checklist
collectAsStateWithLifecycle().@Immutableor@Stable. (N/A — no new UI models.)keyvalues and explicitcontentType.derivedStateOfwhere appropriate.stringResource()and duplicated visible strings on the same screen are avoided. (No new user-facing strings.)WindowInsetscorrectly when this PR changes screen layout.Concurrency / Performance Checklist
viewModelScopeor an existing lifecycle-owned application/service scope.Dispatchers.IOorDispatchers.Default.Data / Persistence Checklist
app/schemas. (N/A — no schema changes, only extension functions added to existing entity file.)Playback / Integration Checklist
universal,arm64,armeabi,x86, andx86_64variants.Localization / Assets Checklist
Privacy / Security Checklist
Verification
git apply --checkon cleandevtree.)V8QualityChip,codecLabel()import resolution.Reviewer Focus
FormatEntity.kt: ConfirmcodecLabel()logic matches the originalprivateversion exactly (it was moved verbatim).QueueComponents.ktV2 (QueueCollapsedContentV2): Thecodec/container/codecLabelbranching logic is preserved — only the formatting calls were extracted to helpers.QueueComponents.ktV3/V5: ConfirmfileSize = ""is intentionally kept (not an oversight).PlayerComponents.kt: Confirm the removedprivate fun FormatEntity.codecLabel()is the only call site that now resolves via import —V8QualityChipat line ~2576.Release Notes
Internal refactor: no user-facing changes. Player codec/format display is unchanged.