feat(tips): frost the tip card with a translucent fill and blurred backdrop#1150
Merged
Conversation
…ckdrop Unify the tip card's color/opacity and give it a frosted-glass look over the content behind it. - Fix the differing per-usage colors: the card rendered as two opaque near-blacks (theme Brand vs a hardcoded 0xFF101011 override in the My Tip Card screen). It now uses a single translucent fill (theme black) with one shared alpha applied in TipCard, so it reads identically everywhere. - Add a backdrop hook (LocalTipCardBackdrop) rendered under the fill and clipped to the card's rounded bounds; Haze is wired into shared:bills for future Compose-content backdrops. - Scanner: Haze can't blur the camera (an AndroidView outside the Compose layer), so snapshot PreviewView.bitmap once when the card appears and draw it blurred behind the card. A single frozen frame avoids the per-frame main-thread readback that stuttered the live preview even on flagship hardware. - Gate the frosted backdrop to capable devices (API 31+ and not low-RAM); elsewhere the card renders an opaque approximation of the frosted tone.
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.
What & why
The tip card rendered with two different opaque near-blacks depending on where it appeared — the theme
Brandcolor in most places and a hardcoded0xFF101011override on the My Tip Card screen. Per the design (Figma:#000000fill @ 36%, radius 30, background blur 40), the intent is a single translucent fill with a frosted-glass backdrop, not solid opaque colors.Changes
tipCard→ black; removed the0xFF101011override.TipCardapplies one shared alpha to the fill, so translucency is identical at every call site by construction.LocalTipCardBackdroprenders an optional layer under the fill, clipped to the card's rounded bounds. Haze (dev.chrisbanes.haze) is added toshared:billsfor Compose-content backdrops.PreviewView/AndroidView, outside the Compose layer), soCodeScannerexposes itsPreviewViewand the scanner snapshotsPreviewView.bitmaponce when a tip card appears, drawing it blurred behind the card.getBitmapreadback stuttered the live preview even on flagship hardware (e.g. S25). One readback, masked by the card's enter animation.Modifier.blurneeds API 31+; below that (and on low-RAM devices) the card renders an opaque approximation of the frosted tone (TipCardOpaqueFallback) with no camera capture at all.Who sees what
Tuning knobs (single constants)
TipCardAlpha(frosted card default alpha), the0.36foverride on the My Tip Card screen,TipCardBlurRadius, andTipCardOpaqueFallback.Testing notes
shared:bills,features:scanner,features:tipping,ui:scanner,ui:theme).