[Android] Allow sheet customization#382
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
e8f12f1 to
3d10bac
Compare
27ea7db to
29973d9
Compare
3d10bac to
e98db56
Compare
29973d9 to
c66c0e4
Compare
8fe0fe2 to
c8efa2e
Compare
c66c0e4 to
33688c9
Compare
c8efa2e to
b381393
Compare
33688c9 to
3e920bb
Compare
b381393 to
e3ef5ef
Compare
3e920bb to
568a78a
Compare
e3ef5ef to
2e67be1
Compare
568a78a to
fe0e2e8
Compare
2e67be1 to
8d13f41
Compare
8d13f41 to
99b2d1c
Compare
5a4e62e to
33b1303
Compare
de950ef to
f000a91
Compare
33b1303 to
f6c2458
Compare
90d60c5 to
429d910
Compare
f6c2458 to
aba1a8c
Compare
429d910 to
9578921
Compare
Package Size
Android file breakdown
Measured from the PR base SHA and PR head SHA. The file breakdown shows uncompressed sizes within each package artifact, so individual files do not sum to the compressed artifact total. This comment reports package artifact sizes only; it is not a final app binary-size report. |
9578921 to
4252bcb
Compare
aba1a8c to
b02925f
Compare
| } | ||
| it.sheetStyle = CheckoutSheetStyle( | ||
| topGapDp = 24f, | ||
| cornerRadiusDp = 32f, |
There was a problem hiding this comment.
tossed up between tokens (NONE, SMALL, MEDIUM, LARGE) and float values.
This looks more consistent with accelerated checkouts and gives best possibility of matching a consumer app
| Use `closeIcon = DrawableResource(R.drawable.ic_checkout_close)` to provide a custom close drawable. If both | ||
| `closeIcon` and `closeIconTint` are set, the custom drawable takes precedence. | ||
|
|
||
| Set `dragHandleVisible = true` to show a fixed, visual-only drag handle at the top of the sheet. The handle is hidden |
There was a problem hiding this comment.
https://m3.material.io/components/bottom-sheets/overview
see little drag handle at the top of the image
4252bcb to
d60c4c5
Compare
kieran-osgood-shopify
left a comment
There was a problem hiding this comment.
Just a though during tophatting, as we're adding dragToDismissEnabled we might want to also add in the tapAwayToDismissEnabled just to avoid accidental checkout closures (e.g. could easily happen whilst user swipes down to see a notification)?
| * cancellation remain enabled. | ||
| * @property dragHandleVisible Whether to show a visual-only drag handle at the top of the sheet. The handle is hidden | ||
| * when [dragToDismissEnabled] is false. | ||
| * @property topGapDp Space above the sheet content, excluding the status bar inset. Must be finite and non-negative. |
There was a problem hiding this comment.
I was going to ask whether Dp is the right unit here, most sheet implementations I've seen opt for a percentage based approach however:
Looking at the material sheet design https://m3.material.io/components/bottom-sheets/specs they have some specs including it being in dp (top margin being 72dp) -
Wondering whether it's worth aligning along these lines?
Granted it's now more legacy but just to make the default design of the sheet look somewhat idiomatic, in lieu of any jetpack compose style sheets
Would it make sense from an extensibility perspective to support an array here?
snappoints is pretty common in the react-native sheet implementations, would give us the room to support multiple snap point locations without a singular "dp" from top position
| findViewById<TextView>(R.id.checkoutKitHeaderTitle) | ||
| ?.setTextColor(headerFontColor) | ||
| findViewById<View>(R.id.checkoutKitDragHandle)?.applyCheckoutSheetDragHandleStyle( | ||
| color = headerFontColor, |
There was a problem hiding this comment.
Is the headerFontColor the right color to apply here?
b02925f to
c746257
Compare
d60c4c5 to
6a324dc
Compare
Assisted-By: devx/6db0ff39-6d19-4074-ab7f-a027dc8b067f
6a324dc to
7fcd2f0
Compare
c746257 to
3e70d57
Compare

What changes are you making?
Introduces
CheckoutSheetStyle, a new configuration type that decouples native sheet chrome styling fromColorScheme. Previously, properties likecloseIconandcloseIconTintwere embedded in color scheme definitions, making it awkward to style sheet chrome independently of checkout colors.CheckoutSheetStyleexposes the following properties:cornerRadiusDp— controls the top corner radius of the sheet header (defaults to32f)titleAlignment— aligns the sheet title toSTARTorCENTER(defaults toCENTER)toolbarElevationDp— sets the toolbar shadow elevation (defaults to0f)closeIcon— optional custom close button drawablecloseIconTint— optional tint applied to the default close iconcloseIconandcloseIconTintare moved out ofColorScheme/Colorsand intoCheckoutSheetStyle. ThecloseIcontakes precedence overcloseIconTintwhen both are set. The hardcodedcheckout_sheet_corner_radiusdimension resource is removed in favour of the runtime value fromCheckoutSheetStyle.Configurationgains asheetStylefield (defaulting toCheckoutSheetStyle()) alongsidecolorScheme. The demo app's settings screen is updated with aCheckoutSheetStyleSectionthat lets users switch between aNewDefaultspreset and aLegacyDialogpreset (square corners, start-aligned title, elevated toolbar), persisted viaDataStore.How to test
sheetStylein your app:LegacyDialogpreset in the demo app settings and confirm the sheet renders with square corners, a start-aligned title, and visible toolbar elevation.closeIconandcloseIconTintand confirm the custom drawable takes precedence.Before you merge
Important
platforms/swift/README.mdand/orplatforms/android/README.md)Releasing a new Swift version?
ShopifyCheckoutKit.podspecplatforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swiftplatforms/swift/README.md(major version only)Releasing a new Embedded Checkout Protocol version?
embeddedCheckoutProtocolAndroidinplatforms/android/gradle/libs.versions.tomlprotocol/languages/kotlin/embedded-checkout-protocol/api/embedded-checkout-protocol.apiif the public API changedReleasing a new Android version?
checkoutKitAndroidinplatforms/android/gradle/libs.versions.tomlplatforms/android/README.mdTip
See the Contributing documentation for the full release process per platform.