Skip to content

feat: stretch playlist hero cover while pulling to refresh - #8

Open
PicoHug wants to merge 1 commit into
ColdP:mainfrom
PicoHug:feat/playlist-hero-pull-stretch
Open

PicoHug wants to merge 1 commit into
ColdP:mainfrom
PicoHug:feat/playlist-hero-pull-stretch

Conversation

@PicoHug

@PicoHug PicoHug commented Dec 2, 2026 •

Copy link
Copy Markdown

What

Opening a playlist and pulling down left a blank strip above the hero. PullToRefresh shifts the whole list down by the header height, and the page surface colour (white in light theme) showed through that gap.

This keeps the blurred cover filling the strip, growing as the user pulls, and shrinking back on release.

Screenshots

Both captured on the same device, Android 17, light theme, mid-pull.

Before: blank strip above the hero After: cover stretches up

How

  • New PlaylistHeroStretchBackdrop, painted under PullToRefresh so the refresh indicator stays on top. Its height is gap + heroHeight (both read during layout, so dragging does not recompose the page), and the artwork is scaled around its bottom edge by (heroHeight + gap) / heroHeight with translationY = gap. That puts the top edge exactly at the window top while the bottom edge stays welded to the hero.
  • PlaylistHeroHeader hides its own backdrop (alpha = 0) as soon as the stretch layer is active. Keeping both copies on screen shows the same cover at two different scales, which reads as a doubled, misaligned image right at the seam.
  • CollectionPage measures the page top, hero top and hero height with onGloballyPositioned to drive the above.

Only LibraryPages.kt changes. No user-facing strings, so en.json / ja.json / example.json are untouched. Light and dark themes both work because the layer reuses the existing banner theme surface colours and scrim.

Testing

  • ./gradlew :app:assembleDebug passes.
  • Verified on a Xiaomi device running Android 17: the strip stays filled while pulling, no seam or misalignment, no flicker on release, and the refresh indicator remains on top and still triggers.

Unrelated: testDebugUnitTest is currently red on main

Heads-up, not caused by this PR — ./gradlew :app:testDebugUnitTest does not compile on main as-is:

e: CloudMetadataCacheTest.kt:86:91 Argument type mismatch:
   actual type is 'CloudMetadataCache', but 'String' was expected.

OfficialNeteaseClient takes (cookie, client, webOrigin, streamOrigin, eapiOrigin, clientlogOrigin, clientlog3Origin, metadataCache), but that test still passes the cache as the 5th positional argument. Looks like a leftover from ff00e1d. Making it metadataCache = CloudMetadataCache(...) lets the task compile.

With that one line patched, on JDK 23, 344 tests run and 6 fail, all unrelated to this PR:

  • AuraAudioProcessorTest.antiClippingTamesInterSampleOversInBypassWhileLeavingNormalSignalsUntouched — BufferUnderflowException
  • CloudMetadataCacheTest.boundedCacheEvictsAndSelectiveInvalidationKeepsOtherPlaylists — expected null, was {"id":1}
  • CloudMetadataCacheTest.repeatedPagesUseDiskButRefreshAndDifferentAccountsUseNetwork — expected 2, was 1
  • OfficialNeteaseClientTest.requestsPlaybackAtOfficialEapiWithoutPuttingSessionInUrl — expected /eapi/..., was /weapi/...
  • OfficialNeteaseClientTest.musicDetailUsesEapiFirstAndFallsBackToWeapiWhenEmpty
  • QqMusicApiTest.customAndOfficialArtistAlbumsAndTrackListsClassifyConsistently — expected cover URL, was empty

(With JDK 17 another 8 fail on UnsupportedClassVersionError, so JDK 21+ is required to read the results.)

Happy to open a separate PR for the one-line test compile fix if you want it.

PullToRefresh pushes the whole list down while dragging, so a playlist
page showed a blank strip in the page surface colour above the blurred
hero cover. Paint the artwork instead: a single backdrop under
PullToRefresh, bottom-aligned with the hero and scaled up so its top
edge reaches the window top, and hide the hero's own backdrop once that
layer takes over so the same cover is never drawn twice at different
scales.

Sizes are read during layout/draw only, so dragging does not recompose
the page.
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