package o; import android.content.Context; 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 android.util.TypedValue; import androidx.core.view.ViewCompat; import com.google.android.material.button.MaterialButton; import o.C17052tZT; /* loaded from: classes2.dex */ public final class DjZ { public static final boolean e = true; public PorterDuff.Mode a; public boolean b; public ColorStateList c; public int g; public int h; public int i; public int j; public int k; public FLD l; public final MaterialButton m; public ColorStateList n; /* renamed from: o, reason: collision with root package name */ public int f8132o; public int p; public ColorStateList q; private Drawable r; private LayerDrawable y; public boolean s = false; public boolean d = false; public boolean f = false; public boolean t = true; public DjZ(MaterialButton materialButton, FLD fld) { this.m = materialButton; this.l = fld; } public final void b() { this.m.Il_(Im_()); C4363bXv e2 = e(false); if (e2 != null) { e2.n(this.i); e2.setState(this.m.getDrawableState()); } } public final void e() { this.d = true; this.m.setSupportBackgroundTintList(this.c); this.m.setSupportBackgroundTintMode(this.a); } private Drawable Im_() { int i; C4363bXv c4363bXv = new C4363bXv(this.l); c4363bXv.d(this.m.getContext()); Tlu.pF_(c4363bXv, this.c); PorterDuff.Mode mode = this.a; if (mode != null) { Tlu.pG_(c4363bXv, mode); } float f = this.p; ColorStateList colorStateList = this.q; c4363bXv.B.p = f; c4363bXv.invalidateSelf(); if (c4363bXv.B.r != colorStateList) { c4363bXv.B.r = colorStateList; c4363bXv.onStateChange(c4363bXv.getState()); } C4363bXv c4363bXv2 = new C4363bXv(this.l); c4363bXv2.setTint(0); float f2 = this.p; if (this.s) { MaterialButton materialButton = this.m; int i2 = C17052tZT.IeS.colorSurface; Context context = materialButton.getContext(); TypedValue Kt_ = TZc.Kt_(materialButton.getContext(), i2, materialButton.getClass().getCanonicalName()); if (Kt_.resourceId != 0) { i = nMh.getColor(context, Kt_.resourceId); } else { i = Kt_.data; } } else { i = 0; } c4363bXv2.B.p = f2; c4363bXv2.invalidateSelf(); ColorStateList valueOf = ColorStateList.valueOf(i); if (c4363bXv2.B.r != valueOf) { c4363bXv2.B.r = valueOf; c4363bXv2.onStateChange(c4363bXv2.getState()); } if (e) { C4363bXv c4363bXv3 = new C4363bXv(this.l); this.r = c4363bXv3; Tlu.pE_(c4363bXv3, -1); RippleDrawable rippleDrawable = new RippleDrawable(C0459HUs.KI_(this.n), new InsetDrawable((Drawable) new LayerDrawable(new Drawable[]{c4363bXv2, c4363bXv}), this.g, this.k, this.f8132o, this.h), this.r); this.y = rippleDrawable; return rippleDrawable; } Vdh vdh = new Vdh(this.l); this.r = vdh; Tlu.pF_(vdh, C0459HUs.KI_(this.n)); LayerDrawable layerDrawable = new LayerDrawable(new Drawable[]{c4363bXv2, c4363bXv, this.r}); this.y = layerDrawable; return new InsetDrawable((Drawable) layerDrawable, this.g, this.k, this.f8132o, this.h); } public final C4363bXv e(boolean z) { LayerDrawable layerDrawable = this.y; if (layerDrawable == null || layerDrawable.getNumberOfLayers() <= 0) { return null; } if (e) { return (C4363bXv) ((LayerDrawable) ((InsetDrawable) this.y.getDrawable(0)).getDrawable()).getDrawable(!z ? 1 : 0); } return (C4363bXv) this.y.getDrawable(!z ? 1 : 0); } private Jaq d() { LayerDrawable layerDrawable = this.y; if (layerDrawable == null || layerDrawable.getNumberOfLayers() <= 1) { return null; } if (this.y.getNumberOfLayers() > 2) { return (Jaq) this.y.getDrawable(2); } return (Jaq) this.y.getDrawable(1); } public final void a(int i, int i2) { int q = ViewCompat.q(this.m); int paddingTop = this.m.getPaddingTop(); int r = ViewCompat.r(this.m); int paddingBottom = this.m.getPaddingBottom(); int i3 = this.k; int i4 = this.h; this.h = i2; this.k = i; if (!this.d) { b(); } ViewCompat.a(this.m, q, (paddingTop + i) - i3, r, (paddingBottom + i2) - i4); } public final void c(FLD fld) { if (e(false) != null) { e(false).setShapeAppearanceModel(fld); } if (e(true) != null) { e(true).setShapeAppearanceModel(fld); } if (d() != null) { d().setShapeAppearanceModel(fld); } } public final void a() { int i = 0; C4363bXv e2 = e(false); C4363bXv e3 = e(true); if (e2 != null) { float f = this.p; ColorStateList colorStateList = this.q; e2.B.p = f; e2.invalidateSelf(); if (e2.B.r != colorStateList) { e2.B.r = colorStateList; e2.onStateChange(e2.getState()); } if (e3 != null) { float f2 = this.p; if (this.s) { MaterialButton materialButton = this.m; int i2 = C17052tZT.IeS.colorSurface; Context context = materialButton.getContext(); TypedValue Kt_ = TZc.Kt_(materialButton.getContext(), i2, materialButton.getClass().getCanonicalName()); if (Kt_.resourceId != 0) { i = nMh.getColor(context, Kt_.resourceId); } else { i = Kt_.data; } } e3.B.p = f2; e3.invalidateSelf(); ColorStateList valueOf = ColorStateList.valueOf(i); if (e3.B.r != valueOf) { e3.B.r = valueOf; e3.onStateChange(e3.getState()); } } } } }