package ῲ.ῲ.㴹;

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 androidx.appcompat.R$styleable;
import ῲ.ᨨ.ᨨ.C1729;

/* renamed from: ῲ.ῲ.㴹.㸾  reason: contains not printable characters */
/* compiled from: AppCompatBackgroundHelper */
public class C2048 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public int f6960 = -1;

    /* renamed from: ඓ  reason: contains not printable characters */
    public C2029 f6961;

    /* renamed from: ῲ  reason: contains not printable characters */
    public final C2044 f6962;

    /* renamed from: K  reason: contains not printable characters */
    public final View f6963;

    /* renamed from: 㴹  reason: contains not printable characters */
    public C2029 f6964;

    /* renamed from: 㸾  reason: contains not printable characters */
    public C2029 f6965;

    public C2048(View view) {
        this.f6963 = view;
        this.f6962 = C2044.m5313();
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public PorterDuff.Mode m5328() {
        C2029 r0 = this.f6961;
        if (r0 != null) {
            return r0.f6875;
        }
        return null;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public void m5330(ColorStateList colorStateList) {
        if (this.f6961 == null) {
            this.f6961 = new C2029();
        }
        C2029 r0 = this.f6961;
        r0.f6876 = colorStateList;
        r0.f6877 = true;
        m5331();
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5335(AttributeSet attributeSet, int i) {
        C2019 r0 = C2019.m5223(this.f6963.getContext(), attributeSet, R$styleable.ViewBackgroundHelper, i, 0);
        View view = this.f6963;
        C1729.m4475(view, view.getContext(), R$styleable.ViewBackgroundHelper, attributeSet, r0.f6846, i, 0);
        try {
            if (r0.m5237(R$styleable.ViewBackgroundHelper_android_background)) {
                this.f6960 = r0.m5230(R$styleable.ViewBackgroundHelper_android_background, -1);
                ColorStateList r9 = this.f6962.m5315(this.f6963.getContext(), this.f6960);
                if (r9 != null) {
                    m5333(r9);
                }
            }
            if (r0.m5237(R$styleable.ViewBackgroundHelper_backgroundTint)) {
                View view2 = this.f6963;
                ColorStateList r1 = r0.m5233(R$styleable.ViewBackgroundHelper_backgroundTint);
                int i2 = Build.VERSION.SDK_INT;
                view2.setBackgroundTintList(r1);
                int i3 = Build.VERSION.SDK_INT;
            }
            if (r0.m5237(R$styleable.ViewBackgroundHelper_backgroundTintMode)) {
                View view3 = this.f6963;
                PorterDuff.Mode r10 = C2021.m5242(r0.m5238(R$styleable.ViewBackgroundHelper_backgroundTintMode, -1), null);
                int i4 = Build.VERSION.SDK_INT;
                view3.setBackgroundTintMode(r10);
                int i5 = Build.VERSION.SDK_INT;
            }
            r0.f6846.recycle();
        } catch (Throwable th) {
            r0.f6846.recycle();
            throw th;
        }
    }

    /* renamed from: 㸾  reason: contains not printable characters */
    public void m5336() {
        this.f6960 = -1;
        m5333((ColorStateList) null);
        m5331();
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public ColorStateList m5329() {
        C2029 r0 = this.f6961;
        if (r0 != null) {
            return r0.f6876;
        }
        return null;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5332(int i) {
        this.f6960 = i;
        C2044 r0 = this.f6962;
        m5333(r0 != null ? r0.m5315(this.f6963.getContext(), i) : null);
        m5331();
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5334(PorterDuff.Mode mode) {
        if (this.f6961 == null) {
            this.f6961 = new C2029();
        }
        C2029 r0 = this.f6961;
        r0.f6875 = mode;
        r0.f6874 = true;
        m5331();
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5331() {
        Drawable background = this.f6963.getBackground();
        if (background != null) {
            int i = Build.VERSION.SDK_INT;
            boolean z = true;
            if (this.f6965 != null) {
                if (this.f6964 == null) {
                    this.f6964 = new C2029();
                }
                C2029 r1 = this.f6964;
                r1.m5261();
                ColorStateList r4 = C1729.m4502(this.f6963);
                if (r4 != null) {
                    r1.f6877 = true;
                    r1.f6876 = r4;
                }
                View view = this.f6963;
                int i2 = Build.VERSION.SDK_INT;
                PorterDuff.Mode backgroundTintMode = view.getBackgroundTintMode();
                if (backgroundTintMode != null) {
                    r1.f6874 = true;
                    r1.f6875 = backgroundTintMode;
                }
                if (r1.f6877 || r1.f6874) {
                    C2044.m5314(background, r1, this.f6963.getDrawableState());
                } else {
                    z = false;
                }
                if (z) {
                    return;
                }
            }
            C2029 r12 = this.f6961;
            if (r12 != null) {
                C2044.m5314(background, r12, this.f6963.getDrawableState());
                return;
            }
            C2029 r13 = this.f6965;
            if (r13 != null) {
                C2044.m5314(background, r13, this.f6963.getDrawableState());
            }
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5333(ColorStateList colorStateList) {
        if (colorStateList != null) {
            if (this.f6965 == null) {
                this.f6965 = new C2029();
            }
            C2029 r0 = this.f6965;
            r0.f6876 = colorStateList;
            r0.f6877 = true;
        } else {
            this.f6965 = null;
        }
        m5331();
    }
}
