Skip to content

Commit e802eca

Browse files
Material Design Teamdsn5ft
Material Design Team
authored andcommitted
Add documentation to clarify percent units.
Otherwise it's pretty ambiguous, a percent logically is out of 100 but this unit is actually a fraction of the height intended to be in range 0-1. PiperOrigin-RevId: 306281351
1 parent 9543ed5 commit e802eca

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.google.android.material.shape;
1818

1919
import android.graphics.RectF;
20+
import androidx.annotation.FloatRange;
2021
import androidx.annotation.NonNull;
2122
import java.util.Arrays;
2223

@@ -28,11 +29,16 @@ public final class RelativeCornerSize implements CornerSize {
2829

2930
private final float percent;
3031

31-
public RelativeCornerSize(float percent) {
32+
/**
33+
* @param percent The relative size of the corner in range [0,1] where 0 is no size and 1 is the
34+
* full bounds height.
35+
*/
36+
public RelativeCornerSize(@FloatRange(from = 0.0f, to = 1.0f) float percent) {
3237
this.percent = percent;
3338
}
3439

35-
/** Returns the relative percent used for this {@link CornerSize} */
40+
/** Returns the relative percent used for this {@link CornerSize} in range [0,1]. */
41+
@FloatRange(from = 0.0f, to = 1.0f)
3642
public float getRelativePercent() {
3743
return percent;
3844
}

0 commit comments

Comments
 (0)