This repository was archived by the owner on Jul 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Support Android API < 28 #43
Draft
adamglin0
wants to merge
2
commits into
main
Choose a base branch
from
support-shadow-layout-in-android-below-than-api-28
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Support Android API < 28 #43
adamglin0
wants to merge
2
commits into
main
from
support-shadow-layout-in-android-below-than-api-28
Conversation
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
No solution to support innerShadow in android sdk < 28 |
@sourcery-ai review |
Reviewer's GuideThis PR adds support for Android API levels below 28 by introducing a software‐layer shadow solution: it lowers the min SDK, provides a SoftLayerShadowContainer that wraps Compose content in an AndroidView with LAYER_TYPE_SOFTWARE on older devices, implements a softLayerShadow modifier using drawWithCache and native setShadowLayer, and updates the sample app to demonstrate the new wrapper and modifier. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @adamglin0 - I've reviewed your changes - here's some feedback:
- Please add the original composeShadowPlus license header to the new Kotlin source files to ensure proper attribution.
- Consider giving
SoftLayerShadowContainer
amodifier: Modifier
parameter instead of always usingfillMaxSize()
so it can be sized flexibly by callers. - In
softLayerShadow
, the call toshape.createOutline
hard-codesLayoutDirection.Rtl
; it should use the currentlayoutDirection
from the Compose scope for correct mirroring behavior.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The initial code is copied from composeShadowPlus. (So I should add a license in the code file.)
If android sdk < 28, the content should be wrapped with AndroidView and the LayerType should be set to LAYER_TYPE_SOFTWARE.
compose-shadow
should provide a wrapper component to wrap content like ComposeShadowPlus.It seems that the shadow drawn by the composeShadowPlus solution is different in android 27 and android 28.
Summary by Sourcery
Enable backward-compatible soft shadows on pre-API 28 devices by introducing a software-rendered ComposeView wrapper and custom shadow modifier, and update the sample app accordingly.
New Features:
Enhancements:
Build: