|
51 | 51 | @RestrictTo(LIBRARY_GROUP) |
52 | 52 | class MaterialButtonHelper { |
53 | 53 |
|
54 | | - private static final boolean IS_LOLLIPOP = VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP; |
| 54 | + private static final boolean IS_MIN_LOLLIPOP = VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP; |
| 55 | + private static final boolean IS_LOLLIPOP = VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP && |
| 56 | + VERSION.SDK_INT <= VERSION_CODES.LOLLIPOP_MR1; |
55 | 57 | private final MaterialButton materialButton; |
56 | 58 | @NonNull private ShapeAppearanceModel shapeAppearanceModel; |
57 | 59 |
|
@@ -219,7 +221,7 @@ private Drawable createBackground() { |
219 | 221 | ? MaterialColors.getColor(materialButton, R.attr.colorSurface) |
220 | 222 | : Color.TRANSPARENT); |
221 | 223 |
|
222 | | - if (IS_LOLLIPOP) { |
| 224 | + if (IS_MIN_LOLLIPOP) { |
223 | 225 | maskDrawable = new MaterialShapeDrawable(shapeAppearanceModel); |
224 | 226 | DrawableCompat.setTint(maskDrawable, Color.WHITE); |
225 | 227 | rippleDrawable = |
@@ -256,10 +258,10 @@ void setBackgroundColor(int color) { |
256 | 258 | void setRippleColor(@Nullable ColorStateList rippleColor) { |
257 | 259 | if (this.rippleColor != rippleColor) { |
258 | 260 | this.rippleColor = rippleColor; |
259 | | - if (IS_LOLLIPOP && materialButton.getBackground() instanceof RippleDrawable) { |
| 261 | + if (IS_MIN_LOLLIPOP && materialButton.getBackground() instanceof RippleDrawable) { |
260 | 262 | ((RippleDrawable) materialButton.getBackground()) |
261 | 263 | .setColor(RippleUtils.sanitizeRippleDrawableColor(rippleColor)); |
262 | | - } else if (!IS_LOLLIPOP && materialButton.getBackground() instanceof RippleDrawableCompat) { |
| 264 | + } else if (!IS_MIN_LOLLIPOP && materialButton.getBackground() instanceof RippleDrawableCompat) { |
263 | 265 | ((RippleDrawableCompat) materialButton.getBackground()).setTintList( |
264 | 266 | RippleUtils.sanitizeRippleDrawableColor(rippleColor)); |
265 | 267 | } |
@@ -327,7 +329,7 @@ int getCornerRadius() { |
327 | 329 | @Nullable |
328 | 330 | private MaterialShapeDrawable getMaterialShapeDrawable(boolean getSurfaceColorStrokeDrawable) { |
329 | 331 | if (rippleDrawable != null && rippleDrawable.getNumberOfLayers() > 0) { |
330 | | - if (IS_LOLLIPOP) { |
| 332 | + if (IS_MIN_LOLLIPOP) { |
331 | 333 | InsetDrawable insetDrawable = (InsetDrawable) rippleDrawable.getDrawable(0); |
332 | 334 | LayerDrawable layerDrawable = (LayerDrawable) insetDrawable.getDrawable(); |
333 | 335 | return (MaterialShapeDrawable) |
|
0 commit comments