use of android.graphics.drawable.RippleDrawable in project GreenHouse by utsanjan.
the class Chip method updateFrameworkRippleBackground.
private void updateFrameworkRippleBackground() {
this.ripple = new RippleDrawable(RippleUtils.sanitizeRippleDrawableColor(this.chipDrawable.getRippleColor()), getBackgroundDrawable(), null);
this.chipDrawable.setUseCompatRipple(false);
ViewCompat.setBackground(this, this.ripple);
}
use of android.graphics.drawable.RippleDrawable in project GreenHouse by utsanjan.
the class BottomNavigationView method setItemRippleColor.
public void setItemRippleColor(ColorStateList itemRippleColor) {
if (this.itemRippleColor != itemRippleColor) {
this.itemRippleColor = itemRippleColor;
if (itemRippleColor == null) {
this.menuView.setItemBackground(null);
return;
}
ColorStateList rippleDrawableColor = RippleUtils.convertToRippleDrawableColor(itemRippleColor);
if (Build.VERSION.SDK_INT >= 21) {
this.menuView.setItemBackground(new RippleDrawable(rippleDrawableColor, null, null));
return;
}
GradientDrawable rippleDrawable = new GradientDrawable();
rippleDrawable.setCornerRadius(1.0E-5f);
Drawable rippleDrawableCompat = DrawableCompat.wrap(rippleDrawable);
DrawableCompat.setTintList(rippleDrawableCompat, rippleDrawableColor);
this.menuView.setItemBackground(rippleDrawableCompat);
} else if (itemRippleColor == null && this.menuView.getItemBackground() != null) {
this.menuView.setItemBackground(null);
}
}
use of android.graphics.drawable.RippleDrawable in project GreenHouse by utsanjan.
the class MaterialButtonHelper method createBackground.
private Drawable createBackground() {
MaterialShapeDrawable backgroundDrawable = new MaterialShapeDrawable(this.shapeAppearanceModel);
Context context = this.materialButton.getContext();
backgroundDrawable.initializeElevationOverlay(context);
DrawableCompat.setTintList(backgroundDrawable, this.backgroundTint);
PorterDuff.Mode mode = this.backgroundTintMode;
if (mode != null) {
DrawableCompat.setTintMode(backgroundDrawable, mode);
}
backgroundDrawable.setStroke(this.strokeWidth, this.strokeColor);
MaterialShapeDrawable surfaceColorStrokeDrawable = new MaterialShapeDrawable(this.shapeAppearanceModel);
surfaceColorStrokeDrawable.setTint(0);
surfaceColorStrokeDrawable.setStroke(this.strokeWidth, this.shouldDrawSurfaceColorStroke ? MaterialColors.getColor(this.materialButton, R.attr.colorSurface) : 0);
if (IS_LOLLIPOP) {
MaterialShapeDrawable materialShapeDrawable = new MaterialShapeDrawable(this.shapeAppearanceModel);
this.maskDrawable = materialShapeDrawable;
DrawableCompat.setTint(materialShapeDrawable, -1);
RippleDrawable rippleDrawable = new RippleDrawable(RippleUtils.sanitizeRippleDrawableColor(this.rippleColor), wrapDrawableWithInset(new LayerDrawable(new Drawable[] { surfaceColorStrokeDrawable, backgroundDrawable })), this.maskDrawable);
this.rippleDrawable = rippleDrawable;
return rippleDrawable;
}
RippleDrawableCompat rippleDrawableCompat = new RippleDrawableCompat(this.shapeAppearanceModel);
this.maskDrawable = rippleDrawableCompat;
DrawableCompat.setTintList(rippleDrawableCompat, RippleUtils.sanitizeRippleDrawableColor(this.rippleColor));
LayerDrawable layerDrawable = new LayerDrawable(new Drawable[] { surfaceColorStrokeDrawable, backgroundDrawable, this.maskDrawable });
this.rippleDrawable = layerDrawable;
return wrapDrawableWithInset(layerDrawable);
}
use of android.graphics.drawable.RippleDrawable in project GreenHouse by utsanjan.
the class CalendarItemStyle method styleItem.
/* JADX INFO: Access modifiers changed from: package-private */
public void styleItem(TextView item) {
Drawable d;
MaterialShapeDrawable backgroundDrawable = new MaterialShapeDrawable();
MaterialShapeDrawable shapeMask = new MaterialShapeDrawable();
backgroundDrawable.setShapeAppearanceModel(this.itemShape);
shapeMask.setShapeAppearanceModel(this.itemShape);
backgroundDrawable.setFillColor(this.backgroundColor);
backgroundDrawable.setStroke(this.strokeWidth, this.strokeColor);
item.setTextColor(this.textColor);
if (Build.VERSION.SDK_INT >= 21) {
d = new RippleDrawable(this.textColor.withAlpha(30), backgroundDrawable, shapeMask);
} else {
d = backgroundDrawable;
}
ViewCompat.setBackground(item, new InsetDrawable(d, this.insets.left, this.insets.top, this.insets.right, this.insets.bottom));
}
use of android.graphics.drawable.RippleDrawable in project GreenHouse by utsanjan.
the class FloatingActionButtonImplLollipop method initializeBackgroundDrawable.
/* JADX INFO: Access modifiers changed from: package-private */
// com.google.android.material.floatingactionbutton.FloatingActionButtonImpl
@Override
public void initializeBackgroundDrawable(ColorStateList backgroundTint, PorterDuff.Mode backgroundTintMode, ColorStateList rippleColor, int borderWidth) {
Drawable rippleContent;
this.shapeDrawable = createShapeDrawable();
this.shapeDrawable.setTintList(backgroundTint);
if (backgroundTintMode != null) {
this.shapeDrawable.setTintMode(backgroundTintMode);
}
this.shapeDrawable.initializeElevationOverlay(this.view.getContext());
if (borderWidth > 0) {
this.borderDrawable = createBorderDrawable(borderWidth, backgroundTint);
rippleContent = new LayerDrawable(new Drawable[] { (Drawable) Preconditions.checkNotNull(this.borderDrawable), (Drawable) Preconditions.checkNotNull(this.shapeDrawable) });
} else {
this.borderDrawable = null;
rippleContent = this.shapeDrawable;
}
this.rippleDrawable = new RippleDrawable(RippleUtils.sanitizeRippleDrawableColor(rippleColor), rippleContent, null);
this.contentBackground = this.rippleDrawable;
}
Aggregations