package p037.p091.p095;

import android.R;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.LinearLayout;

/* JADX INFO: renamed from: މ.މ.ލ.ޔ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C2173 extends LinearLayout {

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

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public boolean f7082;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final Rect f7083;

    public C2173(Context context) {
        this(context, null);
    }

    public C2173(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public C2173(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.f7083 = new Rect();
        if (context.getApplicationInfo().targetSdkVersion < 23 || Build.VERSION.SDK_INT < 23) {
            TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, new int[]{R.attr.foreground});
            Drawable drawable = typedArrayObtainStyledAttributes.getDrawable(0);
            if (drawable != null) {
                int i2 = Build.VERSION.SDK_INT;
                if (i2 >= 23) {
                    if (i2 >= 23) {
                        setForeground(drawable);
                    }
                } else if (this.f7081 != drawable) {
                    this.f7081 = drawable;
                    this.f7082 = true;
                    setWillNotDraw(false);
                    this.f7081.setCallback(this);
                    if (this.f7081.isStateful()) {
                        this.f7081.setState(getDrawableState());
                    }
                }
            }
            typedArrayObtainStyledAttributes.recycle();
        }
    }

    @Override // android.view.View
    public void draw(Canvas canvas) {
        super.draw(canvas);
        Drawable drawable = this.f7081;
        if (drawable != null) {
            if (this.f7082) {
                this.f7082 = false;
                Rect rect = this.f7083;
                rect.set(0, 0, getRight() - getLeft(), getBottom() - getTop());
                drawable.setBounds(rect);
            }
            drawable.draw(canvas);
        }
    }

    @Override // android.view.ViewGroup, android.view.View
    public void drawableStateChanged() {
        super.drawableStateChanged();
        Drawable drawable = this.f7081;
        if (drawable == null || !drawable.isStateful()) {
            return;
        }
        this.f7081.setState(getDrawableState());
    }

    @Override // android.view.View
    public boolean hasOverlappingRendering() {
        return false;
    }

    @Override // android.view.ViewGroup, android.view.View
    public void jumpDrawablesToCurrentState() {
        super.jumpDrawablesToCurrentState();
        Drawable drawable = this.f7081;
        if (drawable != null) {
            drawable.jumpToCurrentState();
        }
    }

    @Override // android.widget.LinearLayout, android.view.ViewGroup, android.view.View
    public void onLayout(boolean z, int i, int i2, int i3, int i4) {
        super.onLayout(z, i, i2, i3, i4);
        this.f7082 = z | this.f7082;
    }

    @Override // android.view.View
    public boolean verifyDrawable(Drawable drawable) {
        return super.verifyDrawable(drawable) || drawable == this.f7081;
    }
}
