Skip to content

Commit f52407e

Browse files
cketchamafohrman
authored andcommitted
Make cornerSize a private field
PiperOrigin-RevId: 266924741
1 parent 0ad0101 commit f52407e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/java/com/google/android/material/shape/CornerTreatment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class CornerTreatment {
3636

3737
private static final String TAG = "CornerTreatment";
3838

39-
protected final float cornerSize;
39+
private final float cornerSize;
4040

4141
public CornerTreatment() {
4242
// Default Constructor has no size. Using this treatment for all corners will draw a square

lib/java/com/google/android/material/shape/CutCornerTreatment.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ public CutCornerTreatment(float size) {
3737

3838
@Override
3939
public void getCornerPath(float angle, float interpolation, @NonNull ShapePath shapePath) {
40-
shapePath.reset(0, cornerSize * interpolation, ShapePath.ANGLE_LEFT, 180 - angle);
40+
shapePath.reset(0, getCornerSize() * interpolation, ShapePath.ANGLE_LEFT, 180 - angle);
4141
shapePath.lineTo(
42-
(float) (Math.sin(Math.toRadians(angle)) * cornerSize * interpolation),
42+
(float) (Math.sin(Math.toRadians(angle)) * getCornerSize() * interpolation),
4343
// Something about using cos() is causing rounding which prevents the path from being convex
4444
// on api levels 21 and 22. Using sin() with 90 - angle is helping for now.
45-
(float) (Math.sin(Math.toRadians(90 - angle)) * cornerSize * interpolation));
45+
(float) (Math.sin(Math.toRadians(90 - angle)) * getCornerSize() * interpolation));
4646
}
4747

4848
@NonNull

lib/java/com/google/android/material/shape/RoundedCornerTreatment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public RoundedCornerTreatment(float radius) {
3333

3434
@Override
3535
public void getCornerPath(float angle, float interpolation, @NonNull ShapePath shapePath) {
36-
float radius = cornerSize;
36+
float radius = getCornerSize();
3737
shapePath.reset(0, radius * interpolation, ShapePath.ANGLE_LEFT, 180 - angle);
3838
shapePath.addArc(0, 0, 2 * radius * interpolation, 2 * radius * interpolation, 180, angle);
3939
}

0 commit comments

Comments
 (0)