package o; import android.content.Context; import android.content.res.ColorStateList; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.View; import androidx.core.view.ViewCompat; import o.SYO; /* loaded from: classes.dex */ public class WpN { private C16821rXR a; private C16821rXR b; private C16821rXR c; private final View h; private int e = -1; private final RXZ d = RXZ.c(); public WpN(View view) { this.h = view; } public void fy_(AttributeSet attributeSet, int i) { Context context = this.h.getContext(); C0683McA c0683McA = new C0683McA(context, context.obtainStyledAttributes(attributeSet, SYO.ZqN.ViewBackgroundHelper, i, 0)); View view = this.h; ViewCompat.sm_(view, view.getContext(), SYO.ZqN.ViewBackgroundHelper, attributeSet, c0683McA.d, i, 0); try { if (c0683McA.d.hasValue(SYO.ZqN.ViewBackgroundHelper_android_background)) { this.e = c0683McA.d.getResourceId(SYO.ZqN.ViewBackgroundHelper_android_background, -1); ColorStateList fQ_ = this.d.fQ_(this.h.getContext(), this.e); if (fQ_ != null) { fA_(fQ_); } } if (c0683McA.d.hasValue(SYO.ZqN.ViewBackgroundHelper_backgroundTint)) { ViewCompat.so_(this.h, c0683McA.jK_(SYO.ZqN.ViewBackgroundHelper_backgroundTint)); } if (c0683McA.d.hasValue(SYO.ZqN.ViewBackgroundHelper_backgroundTintMode)) { ViewCompat.sp_(this.h, FIj.hZ_(c0683McA.d.getInt(SYO.ZqN.ViewBackgroundHelper_backgroundTintMode, -1), null)); } } finally { c0683McA.d.recycle(); } } public void c(int i) { this.e = i; RXZ rxz = this.d; fA_(rxz != null ? rxz.fQ_(this.h.getContext(), i) : null); a(); } public void fz_(Drawable drawable) { this.e = -1; fA_(null); a(); } public void fB_(ColorStateList colorStateList) { if (this.b == null) { this.b = new C16821rXR(); } this.b.c = colorStateList; this.b.b = true; a(); } public ColorStateList fw_() { C16821rXR c16821rXR = this.b; if (c16821rXR != null) { return c16821rXR.c; } return null; } public void fC_(PorterDuff.Mode mode) { if (this.b == null) { this.b = new C16821rXR(); } this.b.d = mode; this.b.a = true; a(); } public PorterDuff.Mode fx_() { C16821rXR c16821rXR = this.b; if (c16821rXR != null) { return c16821rXR.d; } return null; } public void a() { Drawable background = this.h.getBackground(); if (background != null) { if (b() && fv_(background)) { return; } C16821rXR c16821rXR = this.b; if (c16821rXR != null) { RXZ.fN_(background, c16821rXR, this.h.getDrawableState()); return; } C16821rXR c16821rXR2 = this.a; if (c16821rXR2 != null) { RXZ.fN_(background, c16821rXR2, this.h.getDrawableState()); } } } void fA_(ColorStateList colorStateList) { if (colorStateList != null) { if (this.a == null) { this.a = new C16821rXR(); } this.a.c = colorStateList; this.a.b = true; } else { this.a = null; } a(); } private boolean fv_(Drawable drawable) { if (this.c == null) { this.c = new C16821rXR(); } C16821rXR c16821rXR = this.c; c16821rXR.c = null; c16821rXR.b = false; c16821rXR.d = null; c16821rXR.a = false; ColorStateList sh_ = ViewCompat.sh_(this.h); if (sh_ != null) { c16821rXR.b = true; c16821rXR.c = sh_; } PorterDuff.Mode si_ = ViewCompat.si_(this.h); if (si_ != null) { c16821rXR.a = true; c16821rXR.d = si_; } if (!c16821rXR.b && !c16821rXR.a) { return false; } RXZ.fN_(drawable, c16821rXR, this.h.getDrawableState()); return true; } private boolean b() { return this.a != null; } }