package o;

import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.InsetDrawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.RippleDrawable;
import com.google.android.gms.common.R;
import com.google.android.material.button.MaterialButton;
import java.util.WeakHashMap;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class NN {
    public final MaterialButton a;
    public N70 b;
    public int c;
    public int d;
    public int e;
    public int f;
    public int g;
    public int h;
    public PorterDuff.Mode i;
    public ColorStateList j;
    public ColorStateList k;
    public ColorStateList l;
    public C1092eO m;
    public boolean q;
    public RippleDrawable s;
    public int t;
    public boolean n = false;

    /* renamed from: o, reason: collision with root package name */
    public boolean f256o = false;
    public boolean p = false;
    public boolean r = true;

    public NN(MaterialButton materialButton, N70 n70) {
        this.a = materialButton;
        this.b = n70;
    }

    public final InterfaceC0693a80 a() {
        RippleDrawable rippleDrawable = this.s;
        if (rippleDrawable == null || rippleDrawable.getNumberOfLayers() <= 1) {
            return null;
        }
        return this.s.getNumberOfLayers() > 2 ? (InterfaceC0693a80) this.s.getDrawable(2) : (InterfaceC0693a80) this.s.getDrawable(1);
    }

    public final C1092eO b(boolean z) {
        RippleDrawable rippleDrawable = this.s;
        if (rippleDrawable == null || rippleDrawable.getNumberOfLayers() <= 0) {
            return null;
        }
        return (C1092eO) ((LayerDrawable) ((InsetDrawable) this.s.getDrawable(0)).getDrawable()).getDrawable(!z ? 1 : 0);
    }

    public final void c(N70 n70) {
        this.b = n70;
        if (b(false) != null) {
            b(false).setShapeAppearanceModel(n70);
        }
        if (b(true) != null) {
            b(true).setShapeAppearanceModel(n70);
        }
        if (a() != null) {
            a().setShapeAppearanceModel(n70);
        }
    }

    public final void d(int i, int i2) {
        WeakHashMap weakHashMap = Oj0.a;
        MaterialButton materialButton = this.a;
        int paddingStart = materialButton.getPaddingStart();
        int paddingTop = materialButton.getPaddingTop();
        int paddingEnd = materialButton.getPaddingEnd();
        int paddingBottom = materialButton.getPaddingBottom();
        int i3 = this.e;
        int i4 = this.f;
        this.f = i2;
        this.e = i;
        if (!this.f256o) {
            e();
        }
        materialButton.setPaddingRelative(paddingStart, (paddingTop + i) - i3, paddingEnd, (paddingBottom + i2) - i4);
    }

    public final void e() {
        C1092eO c1092eO = new C1092eO(this.b);
        MaterialButton materialButton = this.a;
        c1092eO.h(materialButton.getContext());
        c1092eO.setTintList(this.j);
        PorterDuff.Mode mode = this.i;
        if (mode != null) {
            c1092eO.setTintMode(mode);
        }
        float f = this.h;
        ColorStateList colorStateList = this.k;
        c1092eO.l.j = f;
        c1092eO.invalidateSelf();
        C0997dO c0997dO = c1092eO.l;
        if (c0997dO.d != colorStateList) {
            c0997dO.d = colorStateList;
            c1092eO.onStateChange(c1092eO.getState());
        }
        C1092eO c1092eO2 = new C1092eO(this.b);
        c1092eO2.setTint(0);
        float f2 = this.h;
        int iS = this.n ? AbstractC1692kh0.s(materialButton, R.attr.colorSurface) : 0;
        c1092eO2.l.j = f2;
        c1092eO2.invalidateSelf();
        ColorStateList colorStateListValueOf = ColorStateList.valueOf(iS);
        C0997dO c0997dO2 = c1092eO2.l;
        if (c0997dO2.d != colorStateListValueOf) {
            c0997dO2.d = colorStateListValueOf;
            c1092eO2.onStateChange(c1092eO2.getState());
        }
        C1092eO c1092eO3 = new C1092eO(this.b);
        this.m = c1092eO3;
        c1092eO3.setTint(-1);
        RippleDrawable rippleDrawable = new RippleDrawable(AbstractC1904ms0.u(this.l), new InsetDrawable((Drawable) new LayerDrawable(new Drawable[]{c1092eO2, c1092eO}), this.c, this.e, this.d, this.f), this.m);
        this.s = rippleDrawable;
        materialButton.setInternalBackground(rippleDrawable);
        C1092eO c1092eOB = b(false);
        if (c1092eOB != null) {
            c1092eOB.i(this.t);
            c1092eOB.setState(materialButton.getDrawableState());
        }
    }

    public final void f() {
        C1092eO c1092eOB = b(false);
        C1092eO c1092eOB2 = b(true);
        if (c1092eOB != null) {
            float f = this.h;
            ColorStateList colorStateList = this.k;
            c1092eOB.l.j = f;
            c1092eOB.invalidateSelf();
            C0997dO c0997dO = c1092eOB.l;
            if (c0997dO.d != colorStateList) {
                c0997dO.d = colorStateList;
                c1092eOB.onStateChange(c1092eOB.getState());
            }
            if (c1092eOB2 != null) {
                float f2 = this.h;
                int iS = this.n ? AbstractC1692kh0.s(this.a, R.attr.colorSurface) : 0;
                c1092eOB2.l.j = f2;
                c1092eOB2.invalidateSelf();
                ColorStateList colorStateListValueOf = ColorStateList.valueOf(iS);
                C0997dO c0997dO2 = c1092eOB2.l;
                if (c0997dO2.d != colorStateListValueOf) {
                    c0997dO2.d = colorStateListValueOf;
                    c1092eOB2.onStateChange(c1092eOB2.getState());
                }
            }
        }
    }
}
