package androidx.constraintlayout.widget;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.view.View;
import androidx.constraintlayout.widget.ConstraintLayout;
import p049q.C1550e;

/* renamed from: androidx.constraintlayout.widget.g */
/* loaded from: classes.dex */
public class C0202g extends View {

    /* renamed from: d */
    public int f1005d;

    /* renamed from: e */
    public View f1006e;

    /* renamed from: f */
    public int f1007f;

    /* renamed from: a */
    public void m4501a(ConstraintLayout constraintLayout) {
        if (this.f1006e == null) {
            return;
        }
        ConstraintLayout.C0184b c0184b = (ConstraintLayout.C0184b) getLayoutParams();
        ConstraintLayout.C0184b c0184b2 = (ConstraintLayout.C0184b) this.f1006e.getLayoutParams();
        c0184b2.f812v0.m987g1(0);
        C1550e.EnumC1552b m953y = c0184b.f812v0.m953y();
        C1550e.EnumC1552b enumC1552b = C1550e.EnumC1552b.FIXED;
        if (m953y != enumC1552b) {
            c0184b.f812v0.m985h1(c0184b2.f812v0.m1015U());
        }
        if (c0184b.f812v0.m1021R() != enumC1552b) {
            c0184b.f812v0.m1037I0(c0184b2.f812v0.m959v());
        }
        c0184b2.f812v0.m987g1(8);
    }

    /* renamed from: b */
    public void m4500b(ConstraintLayout constraintLayout) {
        if (this.f1005d == -1 && !isInEditMode()) {
            setVisibility(this.f1007f);
        }
        View findViewById = constraintLayout.findViewById(this.f1005d);
        this.f1006e = findViewById;
        if (findViewById != null) {
            ((ConstraintLayout.C0184b) findViewById.getLayoutParams()).f788j0 = true;
            this.f1006e.setVisibility(0);
            setVisibility(0);
        }
    }

    public View getContent() {
        return this.f1006e;
    }

    public int getEmptyVisibility() {
        return this.f1007f;
    }

    @Override // android.view.View
    public void onDraw(Canvas canvas) {
        if (isInEditMode()) {
            canvas.drawRGB(223, 223, 223);
            Paint paint = new Paint();
            paint.setARGB(255, 210, 210, 210);
            paint.setTextAlign(Paint.Align.CENTER);
            paint.setTypeface(Typeface.create(Typeface.DEFAULT, 0));
            Rect rect = new Rect();
            canvas.getClipBounds(rect);
            paint.setTextSize(rect.height());
            int height = rect.height();
            int width = rect.width();
            paint.setTextAlign(Paint.Align.LEFT);
            paint.getTextBounds("?", 0, 1, rect);
            canvas.drawText("?", ((width / 2.0f) - (rect.width() / 2.0f)) - rect.left, ((height / 2.0f) + (rect.height() / 2.0f)) - rect.bottom, paint);
        }
    }

    public void setContentId(int i) {
        View findViewById;
        if (this.f1005d == i) {
            return;
        }
        View view = this.f1006e;
        if (view != null) {
            view.setVisibility(0);
            ((ConstraintLayout.C0184b) this.f1006e.getLayoutParams()).f788j0 = false;
            this.f1006e = null;
        }
        this.f1005d = i;
        if (i == -1 || (findViewById = ((View) getParent()).findViewById(i)) == null) {
            return;
        }
        findViewById.setVisibility(8);
    }

    public void setEmptyVisibility(int i) {
        this.f1007f = i;
    }
}