package androidx.constraintlayout.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build;
import android.util.AttributeSet;

/* JADX INFO: loaded from: classes.dex */
public class Barrier extends b {

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    private int f1232n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    private int f1233o;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    private n.a f1234p;

    public Barrier(Context context) {
        super(context);
        super.setVisibility(8);
    }

    private void t(n.e eVar, int i3, boolean z2) {
        this.f1233o = i3;
        if (Build.VERSION.SDK_INT < 17) {
            int i4 = this.f1232n;
            if (i4 == 5) {
                this.f1233o = 0;
            } else if (i4 == 6) {
                this.f1233o = 1;
            }
        } else if (z2) {
            int i5 = this.f1232n;
            if (i5 == 5) {
                this.f1233o = 1;
            } else if (i5 == 6) {
                this.f1233o = 0;
            }
        } else {
            int i6 = this.f1232n;
            if (i6 == 5) {
                this.f1233o = 0;
            } else if (i6 == 6) {
                this.f1233o = 1;
            }
        }
        if (eVar instanceof n.a) {
            ((n.a) eVar).x1(this.f1233o);
        }
    }

    public boolean getAllowsGoneWidget() {
        return this.f1234p.r1();
    }

    public int getMargin() {
        return this.f1234p.t1();
    }

    public int getType() {
        return this.f1232n;
    }

    @Override // androidx.constraintlayout.widget.b
    protected void m(AttributeSet attributeSet) {
        super.m(attributeSet);
        this.f1234p = new n.a();
        if (attributeSet != null) {
            TypedArray typedArrayObtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, i.U0);
            int indexCount = typedArrayObtainStyledAttributes.getIndexCount();
            for (int i3 = 0; i3 < indexCount; i3++) {
                int index = typedArrayObtainStyledAttributes.getIndex(i3);
                if (index == i.f1473d1) {
                    setType(typedArrayObtainStyledAttributes.getInt(index, 0));
                } else if (index == i.f1469c1) {
                    this.f1234p.w1(typedArrayObtainStyledAttributes.getBoolean(index, true));
                } else if (index == i.f1477e1) {
                    this.f1234p.y1(typedArrayObtainStyledAttributes.getDimensionPixelSize(index, 0));
                }
            }
            typedArrayObtainStyledAttributes.recycle();
        }
        this.f1322h = this.f1234p;
        s();
    }

    @Override // androidx.constraintlayout.widget.b
    public void n(n.e eVar, boolean z2) {
        t(eVar, this.f1232n, z2);
    }

    public void setAllowsGoneWidget(boolean z2) {
        this.f1234p.w1(z2);
    }

    public void setDpMargin(int i3) {
        this.f1234p.y1((int) ((i3 * getResources().getDisplayMetrics().density) + 0.5f));
    }

    public void setMargin(int i3) {
        this.f1234p.y1(i3);
    }

    public void setType(int i3) {
        this.f1232n = i3;
    }

    public Barrier(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        super.setVisibility(8);
    }
}
