package p037.p041.p051;

import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
import p037.p041.C1477;
import p037.p065.p078.C1920;

/* JADX INFO: renamed from: މ.ؠ.ގ.ނ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C1610 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final View f5227;

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public C1687 f5230;

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public C1687 f5231;

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public C1687 f5232;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public int f5229 = -1;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final C1615 f5228 = C1615.m3156();

    public C1610(View view) {
        this.f5227 = view;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m3144() {
        Drawable background = this.f5227.getBackground();
        if (background != null) {
            int i = Build.VERSION.SDK_INT;
            boolean z = true;
            if (i <= 21 ? i == 21 : this.f5230 != null) {
                if (this.f5232 == null) {
                    this.f5232 = new C1687();
                }
                C1687 c1687 = this.f5232;
                c1687.f5491 = null;
                c1687.f5494 = false;
                c1687.f5492 = null;
                c1687.f5493 = false;
                ColorStateList colorStateListM3755 = C1920.m3755(this.f5227);
                if (colorStateListM3755 != null) {
                    c1687.f5494 = true;
                    c1687.f5491 = colorStateListM3755;
                }
                PorterDuff.Mode backgroundTintMode = this.f5227.getBackgroundTintMode();
                if (backgroundTintMode != null) {
                    c1687.f5493 = true;
                    c1687.f5492 = backgroundTintMode;
                }
                if (c1687.f5494 || c1687.f5493) {
                    C1615.m3157(background, c1687, this.f5227.getDrawableState());
                } else {
                    z = false;
                }
                if (z) {
                    return;
                }
            }
            C1687 c16872 = this.f5231;
            if (c16872 != null) {
                C1615.m3157(background, c16872, this.f5227.getDrawableState());
                return;
            }
            C1687 c16873 = this.f5230;
            if (c16873 != null) {
                C1615.m3157(background, c16873, this.f5227.getDrawableState());
            }
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m3145(int i) {
        this.f5229 = i;
        C1615 c1615 = this.f5228;
        m3146(c1615 != null ? c1615.m3162(this.f5227.getContext(), i) : null);
        m3144();
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m3146(ColorStateList colorStateList) {
        if (colorStateList != null) {
            if (this.f5230 == null) {
                this.f5230 = new C1687();
            }
            C1687 c1687 = this.f5230;
            c1687.f5491 = colorStateList;
            c1687.f5494 = true;
        } else {
            this.f5230 = null;
        }
        m3144();
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m3147(PorterDuff.Mode mode) {
        if (this.f5231 == null) {
            this.f5231 = new C1687();
        }
        C1687 c1687 = this.f5231;
        c1687.f5492 = mode;
        c1687.f5493 = true;
        m3144();
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m3148(AttributeSet attributeSet, int i) {
        C1689 c1689M3294 = C1689.m3294(this.f5227.getContext(), attributeSet, C1477.ViewBackgroundHelper, i, 0);
        View view = this.f5227;
        C1920.m3742(view, view.getContext(), C1477.ViewBackgroundHelper, attributeSet, c1689M3294.f5496, i, 0);
        try {
            if (c1689M3294.m3307(C1477.ViewBackgroundHelper_android_background)) {
                this.f5229 = c1689M3294.m3305(C1477.ViewBackgroundHelper_android_background, -1);
                ColorStateList colorStateListM3162 = this.f5228.m3162(this.f5227.getContext(), this.f5229);
                if (colorStateListM3162 != null) {
                    m3146(colorStateListM3162);
                }
            }
            if (c1689M3294.m3307(C1477.ViewBackgroundHelper_backgroundTint)) {
                View view2 = this.f5227;
                view2.setBackgroundTintList(c1689M3294.m3296(C1477.ViewBackgroundHelper_backgroundTint));
                if (Build.VERSION.SDK_INT == 21) {
                    Drawable background = view2.getBackground();
                    boolean z = (view2.getBackgroundTintList() == null && view2.getBackgroundTintMode() == null) ? false : true;
                    if (background != null && z) {
                        if (background.isStateful()) {
                            background.setState(view2.getDrawableState());
                        }
                        view2.setBackground(background);
                    }
                }
            }
            if (c1689M3294.m3307(C1477.ViewBackgroundHelper_backgroundTintMode)) {
                View view3 = this.f5227;
                view3.setBackgroundTintMode(C1650.m3240(c1689M3294.m3301(C1477.ViewBackgroundHelper_backgroundTintMode, -1), null));
                if (Build.VERSION.SDK_INT == 21) {
                    Drawable background2 = view3.getBackground();
                    boolean z2 = (view3.getBackgroundTintList() == null && view3.getBackgroundTintMode() == null) ? false : true;
                    if (background2 != null && z2) {
                        if (background2.isStateful()) {
                            background2.setState(view3.getDrawableState());
                        }
                        view3.setBackground(background2);
                    }
                }
            }
            c1689M3294.f5496.recycle();
        } catch (Throwable th) {
            c1689M3294.f5496.recycle();
            throw th;
        }
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public ColorStateList m3149() {
        C1687 c1687 = this.f5231;
        if (c1687 != null) {
            return c1687.f5491;
        }
        return null;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public void m3150(ColorStateList colorStateList) {
        if (this.f5231 == null) {
            this.f5231 = new C1687();
        }
        C1687 c1687 = this.f5231;
        c1687.f5491 = colorStateList;
        c1687.f5494 = true;
        m3144();
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public PorterDuff.Mode m3151() {
        C1687 c1687 = this.f5231;
        if (c1687 != null) {
            return c1687.f5492;
        }
        return null;
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public void m3152() {
        this.f5229 = -1;
        m3146((ColorStateList) null);
        m3144();
    }
}
