From 85bec581d75abfb9d7dc804ace28df71006b488b Mon Sep 17 00:00:00 2001 From: marianomartin Date: Tue, 30 Oct 2018 08:57:04 -0700 Subject: [PATCH] Add a constructor that takesdefault cornersize in ShapeAppearanceModel PiperOrigin-RevId: 219308037 --- .../android/material/shape/ShapeAppearanceModel.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/java/com/google/android/material/shape/ShapeAppearanceModel.java b/lib/java/com/google/android/material/shape/ShapeAppearanceModel.java index eef6f0912..4ff6c8689 100644 --- a/lib/java/com/google/android/material/shape/ShapeAppearanceModel.java +++ b/lib/java/com/google/android/material/shape/ShapeAppearanceModel.java @@ -66,6 +66,15 @@ public class ShapeAppearanceModel { public ShapeAppearanceModel( Context context, AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) { + this(context, attrs, defStyleAttr, defStyleRes, 0); + } + + public ShapeAppearanceModel( + Context context, + AttributeSet attrs, + @AttrRes int defStyleAttr, + @StyleRes int defStyleRes, + int defaultCornerSize) { TypedArray a = ThemeEnforcement.obtainStyledAttributes( context, attrs, R.styleable.MaterialShape, defStyleAttr, defStyleRes); @@ -93,7 +102,8 @@ public class ShapeAppearanceModel { int cornerFamilyBottomLeft = a.getInt(R.styleable.ShapeAppearance_cornerFamilyBottomLeft, cornerFamily); - int cornerSize = a.getDimensionPixelSize(R.styleable.ShapeAppearance_cornerSize, 0); + int cornerSize = + a.getDimensionPixelSize(R.styleable.ShapeAppearance_cornerSize, defaultCornerSize); int cornerSizeTopLeft = a.getDimensionPixelSize(R.styleable.ShapeAppearance_cornerSizeTopLeft, cornerSize); int cornerSizeTopRight =