Search in sources :

Example 61 with RippleDrawable

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);
}
Also used : RippleDrawable(android.graphics.drawable.RippleDrawable)

Example 62 with RippleDrawable

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);
    }
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) BadgeDrawable(com.google.android.material.badge.BadgeDrawable) GradientDrawable(android.graphics.drawable.GradientDrawable) MaterialShapeDrawable(com.google.android.material.shape.MaterialShapeDrawable) RippleDrawable(android.graphics.drawable.RippleDrawable) ColorStateList(android.content.res.ColorStateList) GradientDrawable(android.graphics.drawable.GradientDrawable) RippleDrawable(android.graphics.drawable.RippleDrawable)

Example 63 with RippleDrawable

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);
}
Also used : Context(android.content.Context) MaterialShapeDrawable(com.google.android.material.shape.MaterialShapeDrawable) PorterDuff(android.graphics.PorterDuff) LayerDrawable(android.graphics.drawable.LayerDrawable) RippleDrawableCompat(com.google.android.material.ripple.RippleDrawableCompat) RippleDrawable(android.graphics.drawable.RippleDrawable)

Example 64 with RippleDrawable

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));
}
Also used : MaterialShapeDrawable(com.google.android.material.shape.MaterialShapeDrawable) InsetDrawable(android.graphics.drawable.InsetDrawable) Drawable(android.graphics.drawable.Drawable) MaterialShapeDrawable(com.google.android.material.shape.MaterialShapeDrawable) RippleDrawable(android.graphics.drawable.RippleDrawable) InsetDrawable(android.graphics.drawable.InsetDrawable) RippleDrawable(android.graphics.drawable.RippleDrawable)

Example 65 with RippleDrawable

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;
}
Also used : LayerDrawable(android.graphics.drawable.LayerDrawable) LayerDrawable(android.graphics.drawable.LayerDrawable) Drawable(android.graphics.drawable.Drawable) MaterialShapeDrawable(com.google.android.material.shape.MaterialShapeDrawable) RippleDrawable(android.graphics.drawable.RippleDrawable) RippleDrawable(android.graphics.drawable.RippleDrawable)

Aggregations

RippleDrawable (android.graphics.drawable.RippleDrawable)115 StateListDrawable (android.graphics.drawable.StateListDrawable)60 Drawable (android.graphics.drawable.Drawable)49 ColorStateList (android.content.res.ColorStateList)47 GradientDrawable (android.graphics.drawable.GradientDrawable)30 TargetApi (android.annotation.TargetApi)26 ShapeDrawable (android.graphics.drawable.ShapeDrawable)23 View (android.view.View)21 Paint (android.graphics.Paint)20 ColorDrawable (android.graphics.drawable.ColorDrawable)20 SuppressLint (android.annotation.SuppressLint)15 TextView (android.widget.TextView)15 FrameLayout (android.widget.FrameLayout)12 LayerDrawable (android.graphics.drawable.LayerDrawable)11 ImageView (android.widget.ImageView)11 RLottieDrawable (org.telegram.ui.Components.RLottieDrawable)11 CombinedDrawable (org.telegram.ui.Components.CombinedDrawable)10 ScamDrawable (org.telegram.ui.Components.ScamDrawable)10 Outline (android.graphics.Outline)9 BitmapDrawable (android.graphics.drawable.BitmapDrawable)9