package androidx.constraintlayout.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import androidx.constraintlayout.widget.j;
import defpackage.cd1;
import defpackage.o60;
import java.util.HashMap;

/* JADX INFO: loaded from: classes.dex */
public class Barrier extends b {
    public int k;
    public int l;
    public o60 m;

    public Barrier(Context context) {
        super(context);
        this.a = new int[32];
        this.i = null;
        this.j = new HashMap();
        this.c = context;
        j(null);
        super.setVisibility(8);
    }

    public boolean getAllowsGoneWidget() {
        return this.m.bu;
    }

    public int getMargin() {
        return this.m.bv;
    }

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

    @Override // androidx.constraintlayout.widget.b
    public final void j(AttributeSet attributeSet) {
        super.j(attributeSet);
        o60 o60Var = new o60();
        o60Var.bt = 0;
        o60Var.bu = true;
        o60Var.bv = 0;
        o60Var.bw = false;
        this.m = o60Var;
        if (attributeSet != null) {
            TypedArray typedArrayObtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, j.m.b);
            int indexCount = typedArrayObtainStyledAttributes.getIndexCount();
            for (int i = 0; i < indexCount; i++) {
                int index = typedArrayObtainStyledAttributes.getIndex(i);
                if (index == 26) {
                    setType(typedArrayObtainStyledAttributes.getInt(index, 0));
                } else if (index == 25) {
                    this.m.bu = typedArrayObtainStyledAttributes.getBoolean(index, true);
                } else if (index == 27) {
                    this.m.bv = typedArrayObtainStyledAttributes.getDimensionPixelSize(index, 0);
                }
            }
            typedArrayObtainStyledAttributes.recycle();
        }
        this.d = this.m;
        n();
    }

    @Override // androidx.constraintlayout.widget.b
    public final void k(cd1 cd1Var, boolean z) {
        int i = this.k;
        this.l = i;
        if (z) {
            if (i == 5) {
                this.l = 1;
            } else if (i == 6) {
                this.l = 0;
            }
        } else if (i == 5) {
            this.l = 0;
        } else if (i == 6) {
            this.l = 1;
        }
        if (cd1Var instanceof o60) {
            ((o60) cd1Var).bt = this.l;
        }
    }

    public void setAllowsGoneWidget(boolean z) {
        this.m.bu = z;
    }

    public void setDpMargin(int i) {
        this.m.bv = (int) ((i * getResources().getDisplayMetrics().density) + 0.5f);
    }

    public void setMargin(int i) {
        this.m.bv = i;
    }

    public void setType(int i) {
        this.k = i;
    }

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