package com.bytedance.sdk.openadsdk.core.widget;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import androidx.annotation.Nullable;

/* JADX INFO: loaded from: classes2.dex */
public class fhx extends com.bytedance.sdk.openadsdk.core.ajl.wu {
    private Paint fm;

    /* JADX INFO: renamed from: lb, reason: collision with root package name */
    private int f7331lb;
    private RectF ro;

    public fhx(Context context) {
        this(context, null);
    }

    private void fm() {
        setTextColor(-1);
        Paint paint = new Paint();
        this.fm = paint;
        paint.setStyle(Paint.Style.FILL_AND_STROKE);
        this.fm.setColor(Color.parseColor("#99333333"));
        this.fm.setAntiAlias(true);
        this.fm.setStrokeWidth(0.0f);
        this.ro = new RectF();
    }

    @Override // android.widget.TextView, android.view.View
    public void onDraw(Canvas canvas) {
        RectF rectF = this.ro;
        float f10 = rectF.bottom;
        canvas.drawRoundRect(rectF, f10 / 2.0f, f10 / 2.0f, this.fm);
        canvas.translate((this.ro.right / 2.0f) - (getPaint().measureText(getText().toString()) / 2.0f), 0.0f);
        super.onDraw(canvas);
    }

    @Override // com.bytedance.sdk.openadsdk.core.ajl.wu, android.widget.TextView, android.view.View
    public void onMeasure(int i10, int i11) {
        super.onMeasure(i10, i11);
        int measuredWidth = getMeasuredWidth();
        int measuredHeight = getMeasuredHeight();
        if (measuredWidth <= 0 || measuredHeight <= 0) {
            this.ro.set(0.0f, 0.0f, 0.0f, 0.0f);
            return;
        }
        int iMeasureText = (int) getPaint().measureText("00");
        this.f7331lb = iMeasureText;
        if (measuredWidth < iMeasureText) {
            measuredWidth = iMeasureText;
        }
        int i12 = ((measuredHeight / 2) * 2) + measuredWidth;
        setMeasuredDimension(i12, measuredHeight);
        this.ro.set(0.0f, 0.0f, i12, measuredHeight);
    }

    public fhx(Context context, @Nullable AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public fhx(Context context, @Nullable AttributeSet attributeSet, int i10) {
        super(context, attributeSet, i10);
        this.f7331lb = 0;
        fm();
    }
}
