package o; import android.content.Context; import android.content.res.ColorStateList; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.graphics.drawable.RippleDrawable; import android.util.AttributeSet; import android.widget.ImageView; import androidx.core.view.ViewCompat; import o.SYO; /* loaded from: classes.dex */ public class zwp { private C16821rXR a; private C16821rXR b; private final ImageView c; private C16821rXR d; private int e = 0; public zwp(ImageView imageView) { this.c = imageView; } public void gs_(AttributeSet attributeSet, int i) { Context context = this.c.getContext(); C0683McA c0683McA = new C0683McA(context, context.obtainStyledAttributes(attributeSet, SYO.ZqN.AppCompatImageView, i, 0)); ImageView imageView = this.c; ViewCompat.sm_(imageView, imageView.getContext(), SYO.ZqN.AppCompatImageView, attributeSet, c0683McA.d, i, 0); try { Drawable drawable = this.c.getDrawable(); if (drawable == null) { int resourceId = c0683McA.d.getResourceId(SYO.ZqN.AppCompatImageView_srcCompat, -1); if (resourceId != -1 && (drawable = AgY.dT_(this.c.getContext(), resourceId)) != null) { this.c.setImageDrawable(drawable); } } if (drawable != null) { FIj.hX_(drawable); } if (c0683McA.d.hasValue(SYO.ZqN.AppCompatImageView_tint)) { C16034kdZ.vs_(this.c, c0683McA.jK_(SYO.ZqN.AppCompatImageView_tint)); } if (c0683McA.d.hasValue(SYO.ZqN.AppCompatImageView_tintMode)) { C16034kdZ.vt_(this.c, FIj.hZ_(c0683McA.d.getInt(SYO.ZqN.AppCompatImageView_tintMode, -1), null)); } } finally { c0683McA.d.recycle(); } } public void a(int i) { if (i != 0) { Drawable dT_ = AgY.dT_(this.c.getContext(), i); if (dT_ != null) { FIj.hX_(dT_); } this.c.setImageDrawable(dT_); } else { this.c.setImageDrawable(null); } e(); } public boolean a() { return !(this.c.getBackground() instanceof RippleDrawable); } public void gu_(ColorStateList colorStateList) { if (this.a == null) { this.a = new C16821rXR(); } this.a.c = colorStateList; this.a.b = true; e(); } public ColorStateList gq_() { C16821rXR c16821rXR = this.a; if (c16821rXR != null) { return c16821rXR.c; } return null; } public void gv_(PorterDuff.Mode mode) { if (this.a == null) { this.a = new C16821rXR(); } this.a.d = mode; this.a.a = true; e(); } public PorterDuff.Mode gr_() { C16821rXR c16821rXR = this.a; if (c16821rXR != null) { return c16821rXR.d; } return null; } public void e() { Drawable drawable = this.c.getDrawable(); if (drawable != null) { FIj.hX_(drawable); } if (drawable != null) { if (j() && gp_(drawable)) { return; } C16821rXR c16821rXR = this.a; if (c16821rXR != null) { RXZ.fN_(drawable, c16821rXR, this.c.getDrawableState()); return; } C16821rXR c16821rXR2 = this.d; if (c16821rXR2 != null) { RXZ.fN_(drawable, c16821rXR2, this.c.getDrawableState()); } } } private boolean gp_(Drawable drawable) { if (this.b == null) { this.b = new C16821rXR(); } C16821rXR c16821rXR = this.b; c16821rXR.c = null; c16821rXR.b = false; c16821rXR.d = null; c16821rXR.a = false; ColorStateList vq_ = C16034kdZ.vq_(this.c); if (vq_ != null) { c16821rXR.b = true; c16821rXR.c = vq_; } PorterDuff.Mode vr_ = C16034kdZ.vr_(this.c); if (vr_ != null) { c16821rXR.a = true; c16821rXR.d = vr_; } if (!c16821rXR.b && !c16821rXR.a) { return false; } RXZ.fN_(drawable, c16821rXR, this.c.getDrawableState()); return true; } public void gt_(Drawable drawable) { this.e = drawable.getLevel(); } public void b() { if (this.c.getDrawable() != null) { this.c.getDrawable().setLevel(this.e); } } private boolean j() { return this.d != null; } }