Skip to content

Conversation

@anhnd3005-infinity
Copy link

Support Blur for SDK 24 to 32

Introduces `LiquidGlassLegacyImpl` to provide a blur effect for devices running Android N (API 24) up to Android S (API 31). This implementation uses a CPU-based box blur for older versions and `RenderNode` for Android S.

The main `LiquidGlass` view now selects `LiquidGlassLegacyImpl` for devices between Android N and Android Tiramisu, falling back to no-op for versions below N. A default blur radius is set for this legacy implementation.
@QmDeve QmDeve self-requested a review December 9, 2025 15:41
Copy link
Owner

@QmDeve QmDeve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support Blur for SDK 24 to 32

Hello, first of all, thank you for submitting the pull request, but when I tested it on an Android 9 virtual machine, it had problems

image

@anhnd3005-infinity
Copy link
Author

anhnd3005-infinity commented Dec 10, 2025

Thank you, but I don't have an Android 9 device here right now. I'll find out why. I tested several other devices running Android 10 but didn't encounter this problem.

@QmDeve
Copy link
Owner

QmDeve commented Dec 10, 2025

I also tested it on an Android 11 device, and the same problem occurred

- Implement LiquidGlassLegacyImpl with CPU box blur for API 24-30
- Use RenderNode with RenderEffect for API 31-32
- Support blur background views below LiquidGlass
- Fix box blur algorithm to prevent color bleeding
@QmDeve QmDeve self-requested a review December 10, 2025 06:44
@QmDeve
Copy link
Owner

QmDeve commented Dec 10, 2025

The blur effect seems not perfect on devices with API 32 or lower

trim.2E39E7C8-0A3D-421C-BDE6-EFA78F57F58D.MOV

@anhnd3005-infinity
Copy link
Author

Ok let's me fix on next commit

This commit introduces a `borderWidth` property to the LiquidGlass effect, allowing the effect to be constrained to a border area, leaving the center transparent.

It also adds a new `LiquidGlassListActivity` to demonstrate the usage of `LiquidGlassView` within a `RecyclerView`.

Key changes:
-   Updated AGSL shader to support `borderWidth`.
-   Added `setBorderWidth` method to `LiquidGlassView`.
-   Implemented `LiquidGlassListActivity` with a `RecyclerView` and adapter.
-   Optimized drawing and update logic to improve performance, especially in lists.
-   Added Vietnamese translations.
@QmDeve
Copy link
Owner

QmDeve commented Dec 12, 2025

Thank you for commit the changes again. However, the blur algorithm needs to be optimized

image

Since I don’t have time right now, you can refer to my another repository: QmBlurView

Once again, thank you for your contributions

@QmDeve QmDeve closed this Dec 16, 2025
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.

2 participants