package o;

import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.RippleDrawable;
import android.net.Uri;
import android.util.AttributeSet;
import android.widget.ImageButton;
import android.widget.ImageView;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public class Z7 extends ImageButton {
    public final C2689v7 l;
    public final C0692a8 m;
    public boolean n;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public Z7(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        Gf0.a(context);
        this.n = false;
        AbstractC1498if0.a(this, getContext());
        C2689v7 c2689v7 = new C2689v7(this);
        this.l = c2689v7;
        c2689v7.m(attributeSet, i);
        C0692a8 c0692a8 = new C0692a8(this);
        this.m = c0692a8;
        c0692a8.i(attributeSet, i);
    }

    @Override // android.widget.ImageView, android.view.View
    public final void drawableStateChanged() {
        super.drawableStateChanged();
        C2689v7 c2689v7 = this.l;
        if (c2689v7 != null) {
            c2689v7.i();
        }
        C0692a8 c0692a8 = this.m;
        if (c0692a8 != null) {
            c0692a8.a();
        }
    }

    public ColorStateList getSupportBackgroundTintList() {
        C2689v7 c2689v7 = this.l;
        if (c2689v7 != null) {
            return c2689v7.j();
        }
        return null;
    }

    public PorterDuff.Mode getSupportBackgroundTintMode() {
        C2689v7 c2689v7 = this.l;
        if (c2689v7 != null) {
            return c2689v7.k();
        }
        return null;
    }

    public ColorStateList getSupportImageTintList() {
        C1794ll c1794ll;
        C0692a8 c0692a8 = this.m;
        if (c0692a8 == null || (c1794ll = (C1794ll) c0692a8.d) == null) {
            return null;
        }
        return (ColorStateList) c1794ll.c;
    }

    public PorterDuff.Mode getSupportImageTintMode() {
        C1794ll c1794ll;
        C0692a8 c0692a8 = this.m;
        if (c0692a8 == null || (c1794ll = (C1794ll) c0692a8.d) == null) {
            return null;
        }
        return (PorterDuff.Mode) c1794ll.d;
    }

    @Override // android.widget.ImageView, android.view.View
    public final boolean hasOverlappingRendering() {
        return !(((ImageView) this.m.c).getBackground() instanceof RippleDrawable) && super.hasOverlappingRendering();
    }

    @Override // android.view.View
    public void setBackgroundDrawable(Drawable drawable) {
        super.setBackgroundDrawable(drawable);
        C2689v7 c2689v7 = this.l;
        if (c2689v7 != null) {
            c2689v7.o();
        }
    }

    @Override // android.view.View
    public void setBackgroundResource(int i) {
        super.setBackgroundResource(i);
        C2689v7 c2689v7 = this.l;
        if (c2689v7 != null) {
            c2689v7.p(i);
        }
    }

    @Override // android.widget.ImageView
    public void setImageBitmap(Bitmap bitmap) {
        super.setImageBitmap(bitmap);
        C0692a8 c0692a8 = this.m;
        if (c0692a8 != null) {
            c0692a8.a();
        }
    }

    @Override // android.widget.ImageView
    public void setImageDrawable(Drawable drawable) {
        C0692a8 c0692a8 = this.m;
        if (c0692a8 != null && drawable != null && !this.n) {
            c0692a8.b = drawable.getLevel();
        }
        super.setImageDrawable(drawable);
        if (c0692a8 != null) {
            c0692a8.a();
            if (this.n) {
                return;
            }
            ImageView imageView = (ImageView) c0692a8.c;
            if (imageView.getDrawable() != null) {
                imageView.getDrawable().setLevel(c0692a8.b);
            }
        }
    }

    @Override // android.widget.ImageView
    public void setImageLevel(int i) {
        super.setImageLevel(i);
        this.n = true;
    }

    @Override // android.widget.ImageView
    public void setImageResource(int i) {
        C0692a8 c0692a8 = this.m;
        ImageView imageView = (ImageView) c0692a8.c;
        if (i != 0) {
            Drawable drawableX = C80.x(imageView.getContext(), i);
            if (drawableX != null) {
                AbstractC2949xt.a(drawableX);
            }
            imageView.setImageDrawable(drawableX);
        } else {
            imageView.setImageDrawable(null);
        }
        c0692a8.a();
    }

    @Override // android.widget.ImageView
    public void setImageURI(Uri uri) {
        super.setImageURI(uri);
        C0692a8 c0692a8 = this.m;
        if (c0692a8 != null) {
            c0692a8.a();
        }
    }

    public void setSupportBackgroundTintList(ColorStateList colorStateList) {
        C2689v7 c2689v7 = this.l;
        if (c2689v7 != null) {
            c2689v7.r(colorStateList);
        }
    }

    public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
        C2689v7 c2689v7 = this.l;
        if (c2689v7 != null) {
            c2689v7.s(mode);
        }
    }

    public void setSupportImageTintList(ColorStateList colorStateList) {
        C0692a8 c0692a8 = this.m;
        if (c0692a8 != null) {
            if (((C1794ll) c0692a8.d) == null) {
                c0692a8.d = new C1794ll();
            }
            C1794ll c1794ll = (C1794ll) c0692a8.d;
            c1794ll.c = colorStateList;
            c1794ll.b = true;
            c0692a8.a();
        }
    }

    public void setSupportImageTintMode(PorterDuff.Mode mode) {
        C0692a8 c0692a8 = this.m;
        if (c0692a8 != null) {
            if (((C1794ll) c0692a8.d) == null) {
                c0692a8.d = new C1794ll();
            }
            C1794ll c1794ll = (C1794ll) c0692a8.d;
            c1794ll.d = mode;
            c1794ll.a = true;
            c0692a8.a();
        }
    }
}
