package a.b.c.e;

import a.b.c.f.i;
import android.os.Build;
import android.text.PrecomputedText;
import android.text.Spannable;
import android.text.TextDirectionHeuristic;
import android.text.TextDirectionHeuristics;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.style.MetricAffectingSpan;

/* JADX INFO: compiled from: PrecomputedTextCompat.java */
/* JADX INFO: loaded from: classes.dex */
public class a implements Spannable {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final Spannable f164b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private final C0009a f165c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private final PrecomputedText f166d;

    public C0009a a() {
        return this.f165c;
    }

    public PrecomputedText b() {
        Spannable spannable = this.f164b;
        if (spannable instanceof PrecomputedText) {
            return (PrecomputedText) spannable;
        }
        return null;
    }

    @Override // java.lang.CharSequence
    public char charAt(int i) {
        return this.f164b.charAt(i);
    }

    @Override // android.text.Spanned
    public int getSpanEnd(Object obj) {
        return this.f164b.getSpanEnd(obj);
    }

    @Override // android.text.Spanned
    public int getSpanFlags(Object obj) {
        return this.f164b.getSpanFlags(obj);
    }

    @Override // android.text.Spanned
    public int getSpanStart(Object obj) {
        return this.f164b.getSpanStart(obj);
    }

    @Override // android.text.Spanned
    public <T> T[] getSpans(int i, int i2, Class<T> cls) {
        return Build.VERSION.SDK_INT >= 28 ? (T[]) this.f166d.getSpans(i, i2, cls) : (T[]) this.f164b.getSpans(i, i2, cls);
    }

    @Override // java.lang.CharSequence
    public int length() {
        return this.f164b.length();
    }

    @Override // android.text.Spanned
    public int nextSpanTransition(int i, int i2, Class cls) {
        return this.f164b.nextSpanTransition(i, i2, cls);
    }

    @Override // android.text.Spannable
    public void removeSpan(Object obj) {
        if (obj instanceof MetricAffectingSpan) {
            throw new IllegalArgumentException("MetricAffectingSpan can not be removed from PrecomputedText.");
        }
        if (Build.VERSION.SDK_INT >= 28) {
            this.f166d.removeSpan(obj);
        } else {
            this.f164b.removeSpan(obj);
        }
    }

    @Override // android.text.Spannable
    public void setSpan(Object obj, int i, int i2, int i3) {
        if (obj instanceof MetricAffectingSpan) {
            throw new IllegalArgumentException("MetricAffectingSpan can not be set to PrecomputedText.");
        }
        if (Build.VERSION.SDK_INT >= 28) {
            this.f166d.setSpan(obj, i, i2, i3);
        } else {
            this.f164b.setSpan(obj, i, i2, i3);
        }
    }

    @Override // java.lang.CharSequence
    public CharSequence subSequence(int i, int i2) {
        return this.f164b.subSequence(i, i2);
    }

    @Override // java.lang.CharSequence
    public String toString() {
        return this.f164b.toString();
    }

    /* JADX INFO: renamed from: a.b.c.e.a$a, reason: collision with other inner class name */
    /* JADX INFO: compiled from: PrecomputedTextCompat.java */
    public static final class C0009a {

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

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

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

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

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        final PrecomputedText.Params f171e;

        /* JADX INFO: renamed from: a.b.c.e.a$a$a, reason: collision with other inner class name */
        /* JADX INFO: compiled from: PrecomputedTextCompat.java */
        public static class C0010a {

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

            /* JADX INFO: renamed from: b, reason: collision with root package name */
            private TextDirectionHeuristic f173b;

            /* JADX INFO: renamed from: c, reason: collision with root package name */
            private int f174c;

            /* JADX INFO: renamed from: d, reason: collision with root package name */
            private int f175d;

            public C0010a(TextPaint textPaint) {
                this.f172a = textPaint;
                if (Build.VERSION.SDK_INT >= 23) {
                    this.f174c = 1;
                    this.f175d = 1;
                } else {
                    this.f175d = 0;
                    this.f174c = 0;
                }
                if (Build.VERSION.SDK_INT >= 18) {
                    this.f173b = TextDirectionHeuristics.FIRSTSTRONG_LTR;
                } else {
                    this.f173b = null;
                }
            }

            public C0009a a() {
                return new C0009a(this.f172a, this.f173b, this.f174c, this.f175d);
            }

            public C0010a b(int i) {
                this.f174c = i;
                return this;
            }

            public C0010a c(int i) {
                this.f175d = i;
                return this;
            }

            public C0010a d(TextDirectionHeuristic textDirectionHeuristic) {
                this.f173b = textDirectionHeuristic;
                return this;
            }
        }

        C0009a(TextPaint textPaint, TextDirectionHeuristic textDirectionHeuristic, int i, int i2) {
            if (Build.VERSION.SDK_INT >= 28) {
                this.f171e = new PrecomputedText.Params.Builder(textPaint).setBreakStrategy(i).setHyphenationFrequency(i2).setTextDirection(textDirectionHeuristic).build();
            } else {
                this.f171e = null;
            }
            this.f167a = textPaint;
            this.f168b = textDirectionHeuristic;
            this.f169c = i;
            this.f170d = i2;
        }

        public int a() {
            return this.f169c;
        }

        public int b() {
            return this.f170d;
        }

        public TextDirectionHeuristic c() {
            return this.f168b;
        }

        public TextPaint d() {
            return this.f167a;
        }

        public boolean equals(Object obj) {
            if (obj == this) {
                return true;
            }
            if (obj == null || !(obj instanceof C0009a)) {
                return false;
            }
            C0009a c0009a = (C0009a) obj;
            PrecomputedText.Params params = this.f171e;
            if (params != null) {
                return params.equals(c0009a.f171e);
            }
            if (Build.VERSION.SDK_INT >= 23 && (this.f169c != c0009a.a() || this.f170d != c0009a.b())) {
                return false;
            }
            if ((Build.VERSION.SDK_INT >= 18 && this.f168b != c0009a.c()) || this.f167a.getTextSize() != c0009a.d().getTextSize() || this.f167a.getTextScaleX() != c0009a.d().getTextScaleX() || this.f167a.getTextSkewX() != c0009a.d().getTextSkewX()) {
                return false;
            }
            if ((Build.VERSION.SDK_INT >= 21 && (this.f167a.getLetterSpacing() != c0009a.d().getLetterSpacing() || !TextUtils.equals(this.f167a.getFontFeatureSettings(), c0009a.d().getFontFeatureSettings()))) || this.f167a.getFlags() != c0009a.d().getFlags()) {
                return false;
            }
            int i = Build.VERSION.SDK_INT;
            if (i >= 24) {
                if (!this.f167a.getTextLocales().equals(c0009a.d().getTextLocales())) {
                    return false;
                }
            } else if (i >= 17 && !this.f167a.getTextLocale().equals(c0009a.d().getTextLocale())) {
                return false;
            }
            if (this.f167a.getTypeface() == null) {
                if (c0009a.d().getTypeface() != null) {
                    return false;
                }
            } else if (!this.f167a.getTypeface().equals(c0009a.d().getTypeface())) {
                return false;
            }
            return true;
        }

        public int hashCode() {
            int i = Build.VERSION.SDK_INT;
            return i >= 24 ? i.a(Float.valueOf(this.f167a.getTextSize()), Float.valueOf(this.f167a.getTextScaleX()), Float.valueOf(this.f167a.getTextSkewX()), Float.valueOf(this.f167a.getLetterSpacing()), Integer.valueOf(this.f167a.getFlags()), this.f167a.getTextLocales(), this.f167a.getTypeface(), Boolean.valueOf(this.f167a.isElegantTextHeight()), this.f168b, Integer.valueOf(this.f169c), Integer.valueOf(this.f170d)) : i >= 21 ? i.a(Float.valueOf(this.f167a.getTextSize()), Float.valueOf(this.f167a.getTextScaleX()), Float.valueOf(this.f167a.getTextSkewX()), Float.valueOf(this.f167a.getLetterSpacing()), Integer.valueOf(this.f167a.getFlags()), this.f167a.getTextLocale(), this.f167a.getTypeface(), Boolean.valueOf(this.f167a.isElegantTextHeight()), this.f168b, Integer.valueOf(this.f169c), Integer.valueOf(this.f170d)) : i >= 18 ? i.a(Float.valueOf(this.f167a.getTextSize()), Float.valueOf(this.f167a.getTextScaleX()), Float.valueOf(this.f167a.getTextSkewX()), Integer.valueOf(this.f167a.getFlags()), this.f167a.getTextLocale(), this.f167a.getTypeface(), this.f168b, Integer.valueOf(this.f169c), Integer.valueOf(this.f170d)) : i >= 17 ? i.a(Float.valueOf(this.f167a.getTextSize()), Float.valueOf(this.f167a.getTextScaleX()), Float.valueOf(this.f167a.getTextSkewX()), Integer.valueOf(this.f167a.getFlags()), this.f167a.getTextLocale(), this.f167a.getTypeface(), this.f168b, Integer.valueOf(this.f169c), Integer.valueOf(this.f170d)) : i.a(Float.valueOf(this.f167a.getTextSize()), Float.valueOf(this.f167a.getTextScaleX()), Float.valueOf(this.f167a.getTextSkewX()), Integer.valueOf(this.f167a.getFlags()), this.f167a.getTypeface(), this.f168b, Integer.valueOf(this.f169c), Integer.valueOf(this.f170d));
        }

        public String toString() {
            StringBuilder sb = new StringBuilder("{");
            sb.append("textSize=" + this.f167a.getTextSize());
            sb.append(", textScaleX=" + this.f167a.getTextScaleX());
            sb.append(", textSkewX=" + this.f167a.getTextSkewX());
            if (Build.VERSION.SDK_INT >= 21) {
                sb.append(", letterSpacing=" + this.f167a.getLetterSpacing());
                sb.append(", elegantTextHeight=" + this.f167a.isElegantTextHeight());
            }
            int i = Build.VERSION.SDK_INT;
            if (i >= 24) {
                sb.append(", textLocale=" + this.f167a.getTextLocales());
            } else if (i >= 17) {
                sb.append(", textLocale=" + this.f167a.getTextLocale());
            }
            sb.append(", typeface=" + this.f167a.getTypeface());
            if (Build.VERSION.SDK_INT >= 26) {
                sb.append(", variationSettings=" + this.f167a.getFontVariationSettings());
            }
            sb.append(", textDir=" + this.f168b);
            sb.append(", breakStrategy=" + this.f169c);
            sb.append(", hyphenationFrequency=" + this.f170d);
            sb.append("}");
            return sb.toString();
        }

        public C0009a(PrecomputedText.Params params) {
            this.f167a = params.getTextPaint();
            this.f168b = params.getTextDirection();
            this.f169c = params.getBreakStrategy();
            this.f170d = params.getHyphenationFrequency();
            this.f171e = params;
        }
    }
}
