package o;

import android.text.TextPaint;
import java.lang.ref.WeakReference;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class Dd0 {
    public float c;
    public final WeakReference e;
    public C1016dd0 f;
    public final TextPaint a = new TextPaint(1);
    public final C0267Kh b = new C0267Kh(1, this);
    public boolean d = true;

    public Dd0(C0370Oh c0370Oh) {
        this.e = new WeakReference(null);
        this.e = new WeakReference(c0370Oh);
    }

    public final float a(String str) {
        if (!this.d) {
            return this.c;
        }
        TextPaint textPaint = this.a;
        this.c = str == null ? 0.0f : textPaint.measureText((CharSequence) str, 0, str.length());
        if (str != null) {
            Math.abs(textPaint.getFontMetrics().ascent);
        }
        this.d = false;
        return this.c;
    }
}
