package androidx.constraintlayout.widget;

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 {

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

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

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    private g.d.a.j.b f247k;

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

    @Override // androidx.constraintlayout.widget.b
    protected void b(AttributeSet attributeSet) {
        super.b(attributeSet);
        this.f247k = new g.d.a.j.b();
        if (attributeSet != null) {
            TypedArray typedArrayObtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, h.ConstraintLayout_Layout);
            int indexCount = typedArrayObtainStyledAttributes.getIndexCount();
            for (int i2 = 0; i2 < indexCount; i2++) {
                int index = typedArrayObtainStyledAttributes.getIndex(i2);
                if (index == h.ConstraintLayout_Layout_barrierDirection) {
                    setType(typedArrayObtainStyledAttributes.getInt(index, 0));
                } else if (index == h.ConstraintLayout_Layout_barrierAllowsGoneWidgets) {
                    this.f247k.K0(typedArrayObtainStyledAttributes.getBoolean(index, true));
                }
            }
        }
        this.f = this.f247k;
        f();
    }

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

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

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