-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ButtonCompositionGroupMapper crash when calculating the corner radius #2173
Fix ButtonCompositionGroupMapper crash when calculating the corner radius #2173
Conversation
f1ef9ee
to
ea6a88a
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature/sr_compose #2173 +/- ##
======================================================
+ Coverage 82.13% 82.27% +0.14%
======================================================
Files 512 512
Lines 18295 18289 -6
Branches 2814 2814
======================================================
+ Hits 15026 15047 +21
+ Misses 2506 2481 -25
+ Partials 763 761 -2
|
@@ -33,13 +33,19 @@ internal class ButtonCompositionGroupMapper( | |||
var cornerRadius: Number? = null | |||
var colors: ButtonColors? = null | |||
|
|||
// Size of the button must be specified in order to calculate the corner radius, | |||
// when [CornerSize] is a percentage. |
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.
In which cases can a CornerSize
be a percentage (or not)?
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.
It totally depends on the choice of our clients (app developers) how they want to implement UI, either they can use a corner with specific dimension size, so no matter what the size of the button is, the corner keeps same. Either they can use percentage like I show in the screenshot, so the corner radius adapt with button size.
In this case, we must support both of them.
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.
Good catch
What does this PR do?
Fix the crash caused by ButtonCompositionGroupMapper when calculating the corner radius
Motivation
A crash is found when I test with an Android open source application,
here is the trace:
Demo
In the demo we can see the corner radius of the button is correct
Review checklist (to be filled by reviewers)