Repository navigation
Conversation
sang765
force-pushed
the
feat/api30-backdrop-blur-stackblur
branch
4 times, most recently
from
October 20, 2026 16:05
34df937 to
893fc23
Compare
RenderEffect/Haze cannot blur live content below Android 12 (API 31), so the floating navigation bar and top-app-bar overflow menu degraded to a flat tint there. On API < 31, record the hazeSource content into a GraphicsLayer, read it back, downscale it and blur it with the existing pure-Kotlin ImageBlurUtils stack blur, then render it behind the bar/menu. The capture modifier is a no-op on API >= 31, keeping the modern Haze/RenderEffect path untouched at zero cost.
sang765
force-pushed
the
feat/api30-backdrop-blur-stackblur
branch
from
October 21, 2026 02:11
893fc23 to
727a951
Compare
Contributor
Author
|
Drop |
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
RenderEffect/Haze cannot blur live content below Android 12 (API 31), so on those devices the new floating navigation bar and the top-app-bar overflow menu degraded to a flat tint.This makes them show a real backdrop blur there by capturing the
hazeSourcecontent into aGraphicsLayer, reading it back, downscaling it and blurring it with the existing pure-KotlinImageBlurUtilsstack blur, then rendering it behind the bar/menu.The capture modifier is a no-op on API >= 31, so the modern Haze/RenderEffect path is untouched and pays zero cost.
Changes
ui/component/BackdropSnapshot.kt(new) —BackdropSnapshotholder +Modifier.backdropSnapshotSource(), which records the node, reads it back on a throttled loop (periodic for the navbar, gated onexpandedfor the menu), downscales to <= 480px and stack-blurs into the holder.ui/component/FloatingBarBlurBackground.kt— API < 31 branch renders the blurred snapshot (ContentScale.Crop,BottomCenter) + tint. Adds optionalbackdropparam (defaultnull, so the MiniPlayer path is unchanged).ui/component/FloatingNavigationToolbar.kt— passesbackdropthrough toFloatingBarBlurBackground.ui/component/TopAppBarOverflowMenu.kt— API < 31 branch renders the blurred snapshot (ContentScale.Crop,TopEnd) + tint; extracts the shared menu items intoOverflowMenuItems.MainActivity.kt— creates the two holders, attaches the capture to the twohazeSourcenodes, gates the menu holder onexpanded, and passesbackdropto the two consumers.Notes / limitations