package K;

import android.os.Build;
import android.text.PrecomputedText;
import android.text.TextDirectionHeuristic;
import android.text.TextPaint;
import android.text.TextUtils;
import java.util.Objects;

/* JADX INFO: loaded from: classes.dex */
public final class d {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final TextPaint f3518a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final TextDirectionHeuristic f3519b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final int f3520c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final int f3521d;

    public d(TextPaint textPaint, TextDirectionHeuristic textDirectionHeuristic, int i, int i5) {
        if (Build.VERSION.SDK_INT >= 29) {
            c.g(textPaint).setBreakStrategy(i).setHyphenationFrequency(i5).setTextDirection(textDirectionHeuristic).build();
        }
        this.f3518a = textPaint;
        this.f3519b = textDirectionHeuristic;
        this.f3520c = i;
        this.f3521d = i5;
    }

    public final boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj instanceof d) {
            d dVar = (d) obj;
            int i = Build.VERSION.SDK_INT;
            if (this.f3520c == dVar.f3520c && this.f3521d == dVar.f3521d) {
                TextPaint textPaint = this.f3518a;
                float textSize = textPaint.getTextSize();
                TextPaint textPaint2 = dVar.f3518a;
                if (textSize == textPaint2.getTextSize() && textPaint.getTextScaleX() == textPaint2.getTextScaleX() && textPaint.getTextSkewX() == textPaint2.getTextSkewX() && textPaint.getLetterSpacing() == textPaint2.getLetterSpacing() && TextUtils.equals(textPaint.getFontFeatureSettings(), textPaint2.getFontFeatureSettings()) && textPaint.getFlags() == textPaint2.getFlags() && (i < 24 ? textPaint.getTextLocale().equals(textPaint2.getTextLocale()) : textPaint.getTextLocales().equals(textPaint2.getTextLocales())) && (textPaint.getTypeface() != null ? textPaint.getTypeface().equals(textPaint2.getTypeface()) : textPaint2.getTypeface() == null) && this.f3519b == dVar.f3519b) {
                    return true;
                }
            }
            return false;
        }
        return false;
    }

    public final int hashCode() {
        TextDirectionHeuristic textDirectionHeuristic = this.f3519b;
        int i = Build.VERSION.SDK_INT;
        int i5 = this.f3521d;
        int i8 = this.f3520c;
        TextPaint textPaint = this.f3518a;
        return i >= 24 ? Objects.hash(Float.valueOf(textPaint.getTextSize()), Float.valueOf(textPaint.getTextScaleX()), Float.valueOf(textPaint.getTextSkewX()), Float.valueOf(textPaint.getLetterSpacing()), Integer.valueOf(textPaint.getFlags()), textPaint.getTextLocales(), textPaint.getTypeface(), Boolean.valueOf(textPaint.isElegantTextHeight()), textDirectionHeuristic, Integer.valueOf(i8), Integer.valueOf(i5)) : Objects.hash(Float.valueOf(textPaint.getTextSize()), Float.valueOf(textPaint.getTextScaleX()), Float.valueOf(textPaint.getTextSkewX()), Float.valueOf(textPaint.getLetterSpacing()), Integer.valueOf(textPaint.getFlags()), textPaint.getTextLocale(), textPaint.getTypeface(), Boolean.valueOf(textPaint.isElegantTextHeight()), textDirectionHeuristic, Integer.valueOf(i8), Integer.valueOf(i5));
    }

    public final String toString() {
        StringBuilder sb = new StringBuilder("{");
        StringBuilder sb2 = new StringBuilder("textSize=");
        TextPaint textPaint = this.f3518a;
        sb2.append(textPaint.getTextSize());
        sb.append(sb2.toString());
        sb.append(", textScaleX=" + textPaint.getTextScaleX());
        sb.append(", textSkewX=" + textPaint.getTextSkewX());
        int i = Build.VERSION.SDK_INT;
        sb.append(", letterSpacing=" + textPaint.getLetterSpacing());
        sb.append(", elegantTextHeight=" + textPaint.isElegantTextHeight());
        if (i >= 24) {
            sb.append(", textLocale=" + textPaint.getTextLocales());
        } else {
            sb.append(", textLocale=" + textPaint.getTextLocale());
        }
        sb.append(", typeface=" + textPaint.getTypeface());
        if (i >= 26) {
            sb.append(", variationSettings=" + textPaint.getFontVariationSettings());
        }
        sb.append(", textDir=" + this.f3519b);
        sb.append(", breakStrategy=" + this.f3520c);
        sb.append(", hyphenationFrequency=" + this.f3521d);
        sb.append("}");
        return sb.toString();
    }

    public d(PrecomputedText.Params params) {
        this.f3518a = params.getTextPaint();
        this.f3519b = params.getTextDirection();
        this.f3520c = params.getBreakStrategy();
        this.f3521d = params.getHyphenationFrequency();
    }
}
