Skip to content

Commit 85bec58

Browse files
ymariangsajith
authored andcommitted
Add a constructor that takesdefault cornersize in ShapeAppearanceModel
PiperOrigin-RevId: 219308037
1 parent 1becd65 commit 85bec58

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ public ShapeAppearanceModel(ShapeAppearanceModel shapeAppearanceModel) {
6666

6767
public ShapeAppearanceModel(
6868
Context context, AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) {
69+
this(context, attrs, defStyleAttr, defStyleRes, 0);
70+
}
71+
72+
public ShapeAppearanceModel(
73+
Context context,
74+
AttributeSet attrs,
75+
@AttrRes int defStyleAttr,
76+
@StyleRes int defStyleRes,
77+
int defaultCornerSize) {
6978
TypedArray a =
7079
ThemeEnforcement.obtainStyledAttributes(
7180
context, attrs, R.styleable.MaterialShape, defStyleAttr, defStyleRes);
@@ -93,7 +102,8 @@ public ShapeAppearanceModel(
93102
int cornerFamilyBottomLeft =
94103
a.getInt(R.styleable.ShapeAppearance_cornerFamilyBottomLeft, cornerFamily);
95104

96-
int cornerSize = a.getDimensionPixelSize(R.styleable.ShapeAppearance_cornerSize, 0);
105+
int cornerSize =
106+
a.getDimensionPixelSize(R.styleable.ShapeAppearance_cornerSize, defaultCornerSize);
97107
int cornerSizeTopLeft =
98108
a.getDimensionPixelSize(R.styleable.ShapeAppearance_cornerSizeTopLeft, cornerSize);
99109
int cornerSizeTopRight =

0 commit comments

Comments
 (0)