package androidx.constraintlayout.widget;

import X6FRs_4.X6FRs_4.KQgRr5e_0.XnFJ5_9.XnFJ5_9;
import X6FRs_4.X6FRs_4.QxJ9d_1.PGPF6hQ_2;
import X6FRs_4.X6FRs_4.QxJ9d_1.QxJ9d_1;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.transition.Transition;
import java.util.Arrays;
/* loaded from: classes.dex */
public abstract class ConstraintHelper extends View {
    public int KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public XnFJ5_9 f2178KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Context f2179KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public String f2180KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public int[] f2181KQgRr5e_0;
    public boolean QxJ9d_1;

    public ConstraintHelper(Context context) {
        super(context);
        this.f2181KQgRr5e_0 = new int[32];
        this.QxJ9d_1 = false;
        this.f2179KQgRr5e_0 = context;
        KQgRr5e_0((AttributeSet) null);
    }

    private void setIds(String str) {
        if (str == null) {
            return;
        }
        int i = 0;
        while (true) {
            int indexOf = str.indexOf(44, i);
            if (indexOf == -1) {
                KQgRr5e_0(str.substring(i));
                return;
            } else {
                KQgRr5e_0(str.substring(i, indexOf));
                i = indexOf + 1;
            }
        }
    }

    public void KQgRr5e_0(AttributeSet attributeSet) {
        if (attributeSet != null) {
            TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(attributeSet, PGPF6hQ_2.ConstraintLayout_Layout);
            int indexCount = obtainStyledAttributes.getIndexCount();
            for (int i = 0; i < indexCount; i++) {
                int index = obtainStyledAttributes.getIndex(i);
                if (index == PGPF6hQ_2.ConstraintLayout_Layout_constraint_referenced_ids) {
                    String string = obtainStyledAttributes.getString(index);
                    this.f2180KQgRr5e_0 = string;
                    setIds(string);
                }
            }
        }
    }

    public void KQgRr5e_0(ConstraintLayout constraintLayout) {
    }

    public void PGPF6hQ_2(ConstraintLayout constraintLayout) {
        if (isInEditMode()) {
            setIds(this.f2180KQgRr5e_0);
        }
        XnFJ5_9 xnFJ5_9 = this.f2178KQgRr5e_0;
        if (xnFJ5_9 == null) {
            return;
        }
        xnFJ5_9.FSaI4_7();
        for (int i = 0; i < this.KQgRr5e_0; i++) {
            View m854KQgRr5e_0 = constraintLayout.m854KQgRr5e_0(this.f2181KQgRr5e_0[i]);
            if (m854KQgRr5e_0 != null) {
                this.f2178KQgRr5e_0.QxJ9d_1(constraintLayout.KQgRr5e_0(m854KQgRr5e_0));
            }
        }
    }

    public void QxJ9d_1(ConstraintLayout constraintLayout) {
    }

    public int[] getReferencedIds() {
        return Arrays.copyOf(this.f2181KQgRr5e_0, this.KQgRr5e_0);
    }

    @Override // android.view.View
    public void onDraw(Canvas canvas) {
    }

    @Override // android.view.View
    public void onMeasure(int i, int i2) {
        if (this.QxJ9d_1) {
            super.onMeasure(i, i2);
        } else {
            setMeasuredDimension(0, 0);
        }
    }

    public void setReferencedIds(int[] iArr) {
        this.KQgRr5e_0 = 0;
        for (int i : iArr) {
            setTag(i, null);
        }
    }

    @Override // android.view.View
    public void setTag(int i, Object obj) {
        int i2 = this.KQgRr5e_0 + 1;
        int[] iArr = this.f2181KQgRr5e_0;
        if (i2 > iArr.length) {
            this.f2181KQgRr5e_0 = Arrays.copyOf(iArr, iArr.length * 2);
        }
        int[] iArr2 = this.f2181KQgRr5e_0;
        int i3 = this.KQgRr5e_0;
        iArr2[i3] = i;
        this.KQgRr5e_0 = i3 + 1;
    }

    public ConstraintHelper(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.f2181KQgRr5e_0 = new int[32];
        this.QxJ9d_1 = false;
        this.f2179KQgRr5e_0 = context;
        KQgRr5e_0(attributeSet);
    }

    public void KQgRr5e_0() {
        if (this.f2178KQgRr5e_0 == null) {
            return;
        }
        ViewGroup.LayoutParams layoutParams = getLayoutParams();
        if (layoutParams instanceof ConstraintLayout.LayoutParams) {
            ((ConstraintLayout.LayoutParams) layoutParams).f2197KQgRr5e_0 = this.f2178KQgRr5e_0;
        }
    }

    public ConstraintHelper(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.f2181KQgRr5e_0 = new int[32];
        this.QxJ9d_1 = false;
        this.f2179KQgRr5e_0 = context;
        KQgRr5e_0(attributeSet);
    }

    public final void KQgRr5e_0(String str) {
        int i;
        Object KQgRr5e_0;
        if (str == null || this.f2179KQgRr5e_0 == null) {
            return;
        }
        String trim = str.trim();
        try {
            i = QxJ9d_1.class.getField(trim).getInt(null);
        } catch (Exception unused) {
            i = 0;
        }
        if (i == 0) {
            i = this.f2179KQgRr5e_0.getResources().getIdentifier(trim, Transition.MATCH_ID_STR, this.f2179KQgRr5e_0.getPackageName());
        }
        if (i == 0 && isInEditMode() && (getParent() instanceof ConstraintLayout) && (KQgRr5e_0 = ((ConstraintLayout) getParent()).KQgRr5e_0(0, trim)) != null && (KQgRr5e_0 instanceof Integer)) {
            i = ((Integer) KQgRr5e_0).intValue();
        }
        if (i != 0) {
            setTag(i, null);
            return;
        }
        Log.w("ConstraintHelper", "Could not find id of \"" + trim + "\"");
    }
}
