package androidx.constraintlayout.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import java.util.HashMap;
import v.C1661a;
import v.d;
import x.b;
import x.n;

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

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

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

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public C1661a f7899y;

    public Barrier(Context context) {
        super(context);
        this.f18326q = new int[32];
        this.f18331v = new HashMap();
        this.f18328s = context;
        e(null);
        super.setVisibility(8);
    }

    @Override // x.b
    public final void e(AttributeSet attributeSet) {
        super.e(attributeSet);
        C1661a c1661a = new C1661a();
        c1661a.f17848f0 = 0;
        c1661a.f17849g0 = true;
        c1661a.f17850h0 = 0;
        this.f7899y = c1661a;
        if (attributeSet != null) {
            TypedArray typedArrayObtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, n.f18488b);
            int indexCount = typedArrayObtainStyledAttributes.getIndexCount();
            for (int i = 0; i < indexCount; i++) {
                int index = typedArrayObtainStyledAttributes.getIndex(i);
                if (index == 15) {
                    setType(typedArrayObtainStyledAttributes.getInt(index, 0));
                } else if (index == 14) {
                    this.f7899y.f17849g0 = typedArrayObtainStyledAttributes.getBoolean(index, true);
                } else if (index == 16) {
                    this.f7899y.f17850h0 = typedArrayObtainStyledAttributes.getDimensionPixelSize(index, 0);
                }
            }
        }
        this.f18329t = this.f7899y;
        h();
    }

    @Override // x.b
    public final void f(d dVar, boolean z8) {
        int i = this.f7897w;
        this.f7898x = i;
        if (z8) {
            if (i == 5) {
                this.f7898x = 1;
            } else if (i == 6) {
                this.f7898x = 0;
            }
        } else if (i == 5) {
            this.f7898x = 0;
        } else if (i == 6) {
            this.f7898x = 1;
        }
        if (dVar instanceof C1661a) {
            ((C1661a) dVar).f17848f0 = this.f7898x;
        }
    }

    public int getMargin() {
        return this.f7899y.f17850h0;
    }

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

    public void setAllowsGoneWidget(boolean z8) {
        this.f7899y.f17849g0 = z8;
    }

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

    public void setMargin(int i) {
        this.f7899y.f17850h0 = i;
    }

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

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