package android.support.constraint;

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

/* JADX INFO: compiled from: Barrier.java */
/* JADX INFO: loaded from: classes.dex */
public class a extends b {
    private int h;
    private int i;
    private android.support.constraint.i.j.b j;

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

    @Override // android.support.constraint.b
    protected void b(AttributeSet attributeSet) {
        super.b(attributeSet);
        this.j = new android.support.constraint.i.j.b();
        if (attributeSet != null) {
            TypedArray typedArrayObtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, h.ConstraintLayout_Layout);
            int indexCount = typedArrayObtainStyledAttributes.getIndexCount();
            for (int i = 0; i < indexCount; i++) {
                int index = typedArrayObtainStyledAttributes.getIndex(i);
                if (index == h.ConstraintLayout_Layout_barrierDirection) {
                    setType(typedArrayObtainStyledAttributes.getInt(index, 0));
                } else if (index == h.ConstraintLayout_Layout_barrierAllowsGoneWidgets) {
                    this.j.K0(typedArrayObtainStyledAttributes.getBoolean(index, true));
                }
            }
        }
        this.f393e = this.j;
        f();
    }

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

    public void setAllowsGoneWidget(boolean z) {
        this.j.K0(z);
    }

    public void setType(int i) {
        this.h = i;
        this.i = i;
        if (Build.VERSION.SDK_INT >= 17) {
            if (1 == getResources().getConfiguration().getLayoutDirection()) {
                int i2 = this.h;
                if (i2 == 5) {
                    this.i = 1;
                } else if (i2 == 6) {
                    this.i = 0;
                }
            } else {
                int i3 = this.h;
                if (i3 == 5) {
                    this.i = 0;
                } else if (i3 == 6) {
                    this.i = 1;
                }
            }
        } else if (i == 5) {
            this.i = 0;
        } else if (i == 6) {
            this.i = 1;
        }
        this.j.L0(this.i);
    }
}
