package androidx.constraintlayout.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.SparseArray;

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

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public int f1255j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public int f1256k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public w.a f1257l;

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

    public boolean getAllowsGoneWidget() {
        return this.f1257l.f34001y0;
    }

    public int getMargin() {
        return this.f1257l.z0;
    }

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

    @Override // androidx.constraintlayout.widget.ConstraintHelper
    public final void l(AttributeSet attributeSet) {
        super.l(attributeSet);
        this.f1257l = new w.a();
        if (attributeSet != null) {
            TypedArray typedArrayObtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, s.ConstraintLayout_Layout);
            int indexCount = typedArrayObtainStyledAttributes.getIndexCount();
            for (int i10 = 0; i10 < indexCount; i10++) {
                int index = typedArrayObtainStyledAttributes.getIndex(i10);
                if (index == s.ConstraintLayout_Layout_barrierDirection) {
                    setType(typedArrayObtainStyledAttributes.getInt(index, 0));
                } else if (index == s.ConstraintLayout_Layout_barrierAllowsGoneWidgets) {
                    this.f1257l.f34001y0 = typedArrayObtainStyledAttributes.getBoolean(index, true);
                } else if (index == s.ConstraintLayout_Layout_barrierMargin) {
                    this.f1257l.z0 = typedArrayObtainStyledAttributes.getDimensionPixelSize(index, 0);
                }
            }
            typedArrayObtainStyledAttributes.recycle();
        }
        this.f1270d = this.f1257l;
        r();
    }

    @Override // androidx.constraintlayout.widget.ConstraintHelper
    public final void m(j jVar, w.j jVar2, p pVar, SparseArray sparseArray) {
        super.m(jVar, jVar2, pVar, sparseArray);
        if (jVar2 instanceof w.a) {
            w.a aVar = (w.a) jVar2;
            boolean z10 = ((w.e) jVar2.V).A0;
            k kVar = jVar.f1391e;
            s(aVar, kVar.f1409g0, z10);
            aVar.f34001y0 = kVar.f1425o0;
            aVar.z0 = kVar.f1411h0;
        }
    }

    @Override // androidx.constraintlayout.widget.ConstraintHelper
    public final void n(w.d dVar, boolean z10) {
        s(dVar, this.f1255j, z10);
    }

    public final void s(w.d dVar, int i10, boolean z10) {
        this.f1256k = i10;
        if (z10) {
            int i11 = this.f1255j;
            if (i11 == 5) {
                this.f1256k = 1;
            } else if (i11 == 6) {
                this.f1256k = 0;
            }
        } else {
            int i12 = this.f1255j;
            if (i12 == 5) {
                this.f1256k = 0;
            } else if (i12 == 6) {
                this.f1256k = 1;
            }
        }
        if (dVar instanceof w.a) {
            ((w.a) dVar).f34000x0 = this.f1256k;
        }
    }

    public void setAllowsGoneWidget(boolean z10) {
        this.f1257l.f34001y0 = z10;
    }

    public void setDpMargin(int i10) {
        this.f1257l.z0 = (int) ((i10 * getResources().getDisplayMetrics().density) + 0.5f);
    }

    public void setMargin(int i10) {
        this.f1257l.z0 = i10;
    }

    public void setType(int i10) {
        this.f1255j = i10;
    }

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

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