feat: add Android gradient backgrounds#188
Merged
Merged
Conversation
Adds Android backgroundImage gradient parsing and bitmap rendering for Glance widgets. Includes generated short-name support and native parser/renderer coverage.
Adds an example app screen for previewing Android widget backgroundImage gradients through VoltraWidgetPreview.
Caps rendered gradient backgrounds by byte budget and moves the Android gradient example into the Others section.
Removes the solid backgroundColor card from the Android gradient playground so the screen focuses on backgroundImage gradients.
Documents Android backgroundImage gradient support and adds a legacy style compatibility guard.
Keeps Android gradient documentation in the website docs while removing it from the package README.
Clarifies that dynamic color tokens in Android gradients are resolved into generated bitmaps during widget rendering.
Contributor
|
@V3RON : Will |
Contributor
Author
No, it also works fine for Column and Row - probably for most components, if not all of them. |
Contributor
|
@V3RON : If you can release |
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 is this?
This PR adds Android support for gradient widget backgrounds through the existing
style.backgroundImageAPI shape. Android Voltra widgets can now render CSS gradient strings as bitmap-backed Glance backgrounds without changing layout structure, and the example app includes an Android gradient playground for previewing the behavior.How does it work?
backgroundImageis parsed into a native gradient model, rendered into a capped bitmap with Android shaders, and applied viaGlanceModifier.background(ImageProvider(bitmap), ContentScale.FillBounds). The implementation supports linear, radial, and conic gradients, keepsbackgroundColoras the layer behind transparent gradient pixels, and leaves the previousbackgroundColorpath unchanged when no gradient is present.The Android example screen mirrors the iOS gradient playground but renders through
VoltraWidgetPreviewandVoltraAndroid, so it exercises the Glance widget path and usesstyle.backgroundImageinstead of the iOSbackgroundColorgradient path.Why is this useful?
This brings gradient backgrounds to Android widgets while avoiding wrapper layouts, extra child nodes, and Glance child-count edge cases. It keeps the public API small, preserves compatibility for existing styles, bounds bitmap rendering so widget updates do not create oversized
RemoteViewspayloads, and gives developers a dedicated example screen for manual Android verification.