Conversation
Cards, the hero (TV and phone), the featured trailer card, the Home backdrop preload and the details backdrop rewrite image.tmdb.org URLs to the smallest official TMDB width that covers the slot instead of 'original' (1-2 MB per card). Stored URLs stay unchanged, other hosts are untouched, and a URL is never rewritten to a larger size. A portrait card without a poster is sized for the backdrop it shows. The preload now uses the row's card width (TV 210 dp, phone 200 dp) and Compose's rounding, so preload and card share one cache entry. The TV details backdrop is sized like the Home hero, so both share one file. Once startup has settled, the focused item's hero logo moves from BACKGROUND to DEFERRED so it no longer waits behind the single-slot card-logo fan-out; during startup the initial rows keep DEFERRED. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qy4WX7LN7PngMAhsMQCJC8
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
Home cards requested every TMDB backdrop as
original(1.0–2.3 MB each, measured) although a card is only ~420–550 px wide. Each load site now asks for the smallest official TMDB width that covers what it draws.Measured on a phone, cold start (cache cleared), 3 runs each, before/after builds with temporary logcat lines on test branches only:
Times are when the response headers arrived, so the real gain for large bodies is rather bigger. Checked by eye on a phone and a TV: cards, the hero (portrait and landscape) and addon rows with non-TMDB posters look as before; on the TV everything on the first screen is there after ~4 s.
Changes
TmdbImageSizing.forSlot(url, widthPx, heightPx, kind): rewrites onlyimage.tmdb.org/t/p/<wN|original>/…, never to a larger size than the stored URL; other hosts,h632,w…_and_h…stay untouched. Stored URLs, the data model, cloud state and the Home cache are unchanged – only the load sites pick the size.originalonly above 1280 px. Backdrops/stillsw300/w780/w1280, postersw92…w780. The idea comes from Moviebase'sTmdbImageSize(MoviebaseApp/tmdb-kotlin, Apache 2.0) – no code copied.MediaCard(so Search, Watchlist, View all and Collections benefit too), the featured trailer card (sized from its 380 dp end width, so the spring never switches files), the TV hero, the phone hero carousel, the details backdrop (TV + phone) and the Home backdrop preload.imagefalls back to the backdrop file) is sized for the 16:9 image it shows.BACKGROUNDtoDEFERREDonce startup has settled, so it no longer waits behind the single-slot card-logo fan-out; during startup it staysBACKGROUND, so the initial rows keep their twoDEFERREDslots ("Initial rows must not wait for speculative artwork").Trade-offs
original, and a newly focused title downloads its hero image instead of reusing the card's. The TV details backdrop is sized exactly like the hero, so hero and details share one file again.w780cards, so far more covers survive between sessions.Not in this PR (happy to follow up)
originalbackdrops (a 3:4 card showing a 16:9 image needs ~1760 px), and the same file is sometimes downloaded twice at the same time. That was the same before; a poster in the portrait hero or coalescing the duplicate request would be the next big step – your call on the look.placeholderMemoryCacheKey), which would hide the hero download mentioned above.getLogoUrldoes not coalesce in-flight requests: the hero logo and a card logo for the same title can now run at the same time.toInt()while the card usesroundToPx()(memory-cache miss on 1.33x TVs).Testing
TmdbImageSizingTest(12 tests); fulltestSideloadDebugUnitTest: 1830 tests, 0 failures; detekt: no new findings.created by Claude (Anthropic) on behalf of @ReichiMD