material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[ProgressIndicator] Fix corner radius calculation

Open whitipet opened this issue 9 months ago • 0 comments

Because trackCornerRadius is passed as an int and not a float, rounded corners may not be displayed correctly with a certain combination of screen size, trackThickness, and trackCornerRadius. In my case, view.getResources().getDisplayMetrics().density = 2.25. So trackThickness = 4dp = 9px and trackCornerRadius = 2dp = 4.5px. Because of type casting, the 0.5f fraction is lost and the corners are rounded incorrectly.

Comparison
Before After
before after

whitipet avatar May 19 '24 11:05 whitipet