package com.google.android.material.datepicker;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.InsetDrawable;
import android.graphics.drawable.RippleDrawable;
import android.os.Build;
import android.widget.TextView;
import androidx.core.view.y;

/* JADX INFO: compiled from: CalendarItemStyle.java */
/* JADX INFO: loaded from: classes.dex */
final class b {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private final Rect f3830a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final ColorStateList f3831b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private final ColorStateList f3832c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private final ColorStateList f3833d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private final int f3834e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private final c1.k f3835f;

    private b(ColorStateList colorStateList, ColorStateList colorStateList2, ColorStateList colorStateList3, int i3, c1.k kVar, Rect rect) {
        androidx.core.util.h.c(rect.left);
        androidx.core.util.h.c(rect.top);
        androidx.core.util.h.c(rect.right);
        androidx.core.util.h.c(rect.bottom);
        this.f3830a = rect;
        this.f3831b = colorStateList2;
        this.f3832c = colorStateList;
        this.f3833d = colorStateList3;
        this.f3834e = i3;
        this.f3835f = kVar;
    }

    static b a(Context context, int i3) {
        androidx.core.util.h.a(i3 != 0, "Cannot create a CalendarItemStyle with a styleResId of 0");
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(i3, l0.k.C1);
        Rect rect = new Rect(typedArrayObtainStyledAttributes.getDimensionPixelOffset(l0.k.D1, 0), typedArrayObtainStyledAttributes.getDimensionPixelOffset(l0.k.F1, 0), typedArrayObtainStyledAttributes.getDimensionPixelOffset(l0.k.E1, 0), typedArrayObtainStyledAttributes.getDimensionPixelOffset(l0.k.G1, 0));
        ColorStateList colorStateListA = z0.c.a(context, typedArrayObtainStyledAttributes, l0.k.H1);
        ColorStateList colorStateListA2 = z0.c.a(context, typedArrayObtainStyledAttributes, l0.k.M1);
        ColorStateList colorStateListA3 = z0.c.a(context, typedArrayObtainStyledAttributes, l0.k.K1);
        int dimensionPixelSize = typedArrayObtainStyledAttributes.getDimensionPixelSize(l0.k.L1, 0);
        c1.k kVarM = c1.k.b(context, typedArrayObtainStyledAttributes.getResourceId(l0.k.I1, 0), typedArrayObtainStyledAttributes.getResourceId(l0.k.J1, 0)).m();
        typedArrayObtainStyledAttributes.recycle();
        return new b(colorStateListA, colorStateListA2, colorStateListA3, dimensionPixelSize, kVarM, rect);
    }

    int b() {
        return this.f3830a.bottom;
    }

    int c() {
        return this.f3830a.top;
    }

    void d(TextView textView) {
        c1.g gVar = new c1.g();
        c1.g gVar2 = new c1.g();
        gVar.setShapeAppearanceModel(this.f3835f);
        gVar2.setShapeAppearanceModel(this.f3835f);
        gVar.X(this.f3832c);
        gVar.d0(this.f3834e, this.f3833d);
        textView.setTextColor(this.f3831b);
        Drawable rippleDrawable = Build.VERSION.SDK_INT >= 21 ? new RippleDrawable(this.f3831b.withAlpha(30), gVar, gVar2) : gVar;
        Rect rect = this.f3830a;
        y.v0(textView, new InsetDrawable(rippleDrawable, rect.left, rect.top, rect.right, rect.bottom));
    }
}
