package com.google.android.material.internal; import android.animation.TimeInterpolator; import android.content.res.ColorStateList; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Typeface; import android.text.TextPaint; import android.text.TextUtils; import android.view.View; import androidx.core.view.n0; import androidx.core.view.s; import com.igaworks.ssp.R; import m3.a; import x.o; /* loaded from: classes2.dex */ public final class a { private static final boolean V = false; private static final Paint W = null; private boolean A; private Bitmap B; private Paint C; private float D; private float E; private float F; private float G; private int[] H; private boolean I; private final TextPaint J; private final TextPaint K; private TimeInterpolator L; private TimeInterpolator M; private float N; private float O; private float P; private ColorStateList Q; private float R; private float S; private float T; private ColorStateList U; /* renamed from: a, reason: collision with root package name */ private final View f4589a; /* renamed from: b, reason: collision with root package name */ private boolean f4590b; /* renamed from: c, reason: collision with root package name */ private float f4591c; /* renamed from: d, reason: collision with root package name */ private final Rect f4592d; /* renamed from: e, reason: collision with root package name */ private final Rect f4593e; /* renamed from: f, reason: collision with root package name */ private final RectF f4594f; /* renamed from: g, reason: collision with root package name */ private int f4595g = 16; /* renamed from: h, reason: collision with root package name */ private int f4596h = 16; /* renamed from: i, reason: collision with root package name */ private float f4597i = 15.0f; /* renamed from: j, reason: collision with root package name */ private float f4598j = 15.0f; /* renamed from: k, reason: collision with root package name */ private ColorStateList f4599k; /* renamed from: l, reason: collision with root package name */ private ColorStateList f4600l; /* renamed from: m, reason: collision with root package name */ private float f4601m; /* renamed from: n, reason: collision with root package name */ private float f4602n; /* renamed from: o, reason: collision with root package name */ private float f4603o; /* renamed from: p, reason: collision with root package name */ private float f4604p; /* renamed from: q, reason: collision with root package name */ private float f4605q; /* renamed from: r, reason: collision with root package name */ private float f4606r; /* renamed from: s, reason: collision with root package name */ private Typeface f4607s; /* renamed from: t, reason: collision with root package name */ private Typeface f4608t; /* renamed from: u, reason: collision with root package name */ private Typeface f4609u; /* renamed from: v, reason: collision with root package name */ private m3.a f4610v; /* renamed from: w, reason: collision with root package name */ private m3.a f4611w; /* renamed from: x, reason: collision with root package name */ private CharSequence f4612x; /* renamed from: y, reason: collision with root package name */ private CharSequence f4613y; /* renamed from: z, reason: collision with root package name */ private boolean f4614z; /* renamed from: com.google.android.material.internal.a$a, reason: collision with other inner class name */ class C0072a implements a.InterfaceC0188a { C0072a() { } @Override // m3.a.InterfaceC0188a public void a(Typeface typeface) { a.this.G(typeface); } } public a(View view) { this.f4589a = view; TextPaint textPaint = new TextPaint(129); this.J = textPaint; this.K = new TextPaint(textPaint); this.f4593e = new Rect(); this.f4592d = new Rect(); this.f4594f = new RectF(); } private static boolean A(Rect rect, int i10, int i11, int i12, int i13) { return rect.left == i10 && rect.top == i11 && rect.right == i12 && rect.bottom == i13; } private boolean H(Typeface typeface) { m3.a aVar = this.f4611w; if (aVar != null) { aVar.c(); } if (this.f4607s == typeface) { return false; } this.f4607s = typeface; return true; } private boolean N(Typeface typeface) { m3.a aVar = this.f4610v; if (aVar != null) { aVar.c(); } if (this.f4608t == typeface) { return false; } this.f4608t = typeface; return true; } private void P(float f10) { g(f10); boolean z10 = V && this.F != 1.0f; this.A = z10; if (z10) { j(); } n0.e0(this.f4589a); } private static int a(int i10, int i11, float f10) { float f11 = 1.0f - f10; return Color.argb((int) ((Color.alpha(i10) * f11) + (Color.alpha(i11) * f10)), (int) ((Color.red(i10) * f11) + (Color.red(i11) * f10)), (int) ((Color.green(i10) * f11) + (Color.green(i11) * f10)), (int) ((Color.blue(i10) * f11) + (Color.blue(i11) * f10))); } private void b() { float f10 = this.G; g(this.f4598j); CharSequence charSequence = this.f4613y; float measureText = charSequence != null ? this.J.measureText(charSequence, 0, charSequence.length()) : 0.0f; int b10 = s.b(this.f4596h, this.f4614z ? 1 : 0); int i10 = b10 & R.styleable.AppCompatTheme_toolbarNavigationButtonStyle; if (i10 == 48) { this.f4602n = this.f4593e.top - this.J.ascent(); } else if (i10 != 80) { this.f4602n = this.f4593e.centerY() + (((this.J.descent() - this.J.ascent()) / 2.0f) - this.J.descent()); } else { this.f4602n = this.f4593e.bottom; } int i11 = b10 & 8388615; if (i11 == 1) { this.f4604p = this.f4593e.centerX() - (measureText / 2.0f); } else if (i11 != 5) { this.f4604p = this.f4593e.left; } else { this.f4604p = this.f4593e.right - measureText; } g(this.f4597i); CharSequence charSequence2 = this.f4613y; float measureText2 = charSequence2 != null ? this.J.measureText(charSequence2, 0, charSequence2.length()) : 0.0f; int b11 = s.b(this.f4595g, this.f4614z ? 1 : 0); int i12 = b11 & R.styleable.AppCompatTheme_toolbarNavigationButtonStyle; if (i12 == 48) { this.f4601m = this.f4592d.top - this.J.ascent(); } else if (i12 != 80) { this.f4601m = this.f4592d.centerY() + (((this.J.descent() - this.J.ascent()) / 2.0f) - this.J.descent()); } else { this.f4601m = this.f4592d.bottom; } int i13 = b11 & 8388615; if (i13 == 1) { this.f4603o = this.f4592d.centerX() - (measureText2 / 2.0f); } else if (i13 != 5) { this.f4603o = this.f4592d.left; } else { this.f4603o = this.f4592d.right - measureText2; } h(); P(f10); } private void d() { f(this.f4591c); } private boolean e(CharSequence charSequence) { return (n0.B(this.f4589a) == 1 ? o.f15240d : o.f15239c).a(charSequence, 0, charSequence.length()); } private void f(float f10) { u(f10); this.f4605q = x(this.f4603o, this.f4604p, f10, this.L); this.f4606r = x(this.f4601m, this.f4602n, f10, this.L); P(x(this.f4597i, this.f4598j, f10, this.M)); if (this.f4600l != this.f4599k) { this.J.setColor(a(p(), n(), f10)); } else { this.J.setColor(n()); } this.J.setShadowLayer(x(this.R, this.N, f10, null), x(this.S, this.O, f10, null), x(this.T, this.P, f10, null), a(o(this.U), o(this.Q), f10)); n0.e0(this.f4589a); } private void g(float f10) { boolean z10; float f11; boolean z11; if (this.f4612x == null) { return; } float width = this.f4593e.width(); float width2 = this.f4592d.width(); if (v(f10, this.f4598j)) { f11 = this.f4598j; this.F = 1.0f; Typeface typeface = this.f4609u; Typeface typeface2 = this.f4607s; if (typeface != typeface2) { this.f4609u = typeface2; z11 = true; } else { z11 = false; } } else { float f12 = this.f4597i; Typeface typeface3 = this.f4609u; Typeface typeface4 = this.f4608t; if (typeface3 != typeface4) { this.f4609u = typeface4; z10 = true; } else { z10 = false; } if (v(f10, f12)) { this.F = 1.0f; } else { this.F = f10 / this.f4597i; } float f13 = this.f4598j / this.f4597i; width = width2 * f13 > width ? Math.min(width / f13, width2) : width2; f11 = f12; z11 = z10; } if (width > 0.0f) { z11 = this.G != f11 || this.I || z11; this.G = f11; this.I = false; } if (this.f4613y == null || z11) { this.J.setTextSize(this.G); this.J.setTypeface(this.f4609u); this.J.setLinearText(this.F != 1.0f); CharSequence ellipsize = TextUtils.ellipsize(this.f4612x, this.J, width, TextUtils.TruncateAt.END); if (TextUtils.equals(ellipsize, this.f4613y)) { return; } this.f4613y = ellipsize; this.f4614z = e(ellipsize); } } private void h() { Bitmap bitmap = this.B; if (bitmap != null) { bitmap.recycle(); this.B = null; } } private void j() { if (this.B != null || this.f4592d.isEmpty() || TextUtils.isEmpty(this.f4613y)) { return; } f(0.0f); this.D = this.J.ascent(); this.E = this.J.descent(); TextPaint textPaint = this.J; CharSequence charSequence = this.f4613y; int round = Math.round(textPaint.measureText(charSequence, 0, charSequence.length())); int round2 = Math.round(this.E - this.D); if (round <= 0 || round2 <= 0) { return; } this.B = Bitmap.createBitmap(round, round2, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(this.B); CharSequence charSequence2 = this.f4613y; canvas.drawText(charSequence2, 0, charSequence2.length(), 0.0f, round2 - this.J.descent(), this.J); if (this.C == null) { this.C = new Paint(3); } } private int o(ColorStateList colorStateList) { if (colorStateList == null) { return 0; } int[] iArr = this.H; return iArr != null ? colorStateList.getColorForState(iArr, 0) : colorStateList.getDefaultColor(); } private int p() { return o(this.f4599k); } private void s(TextPaint textPaint) { textPaint.setTextSize(this.f4598j); textPaint.setTypeface(this.f4607s); } private void t(TextPaint textPaint) { textPaint.setTextSize(this.f4597i); textPaint.setTypeface(this.f4608t); } private void u(float f10) { this.f4594f.left = x(this.f4592d.left, this.f4593e.left, f10, this.L); this.f4594f.top = x(this.f4601m, this.f4602n, f10, this.L); this.f4594f.right = x(this.f4592d.right, this.f4593e.right, f10, this.L); this.f4594f.bottom = x(this.f4592d.bottom, this.f4593e.bottom, f10, this.L); } private static boolean v(float f10, float f11) { return Math.abs(f10 - f11) < 0.001f; } private static float x(float f10, float f11, float f12, TimeInterpolator timeInterpolator) { if (timeInterpolator != null) { f12 = timeInterpolator.getInterpolation(f12); } return d3.a.a(f10, f11, f12); } public void B(int i10, int i11, int i12, int i13) { if (A(this.f4593e, i10, i11, i12, i13)) { return; } this.f4593e.set(i10, i11, i12, i13); this.I = true; y(); } public void C(Rect rect) { B(rect.left, rect.top, rect.right, rect.bottom); } public void D(int i10) { m3.d dVar = new m3.d(this.f4589a.getContext(), i10); ColorStateList colorStateList = dVar.f11814b; if (colorStateList != null) { this.f4600l = colorStateList; } float f10 = dVar.f11813a; if (f10 != 0.0f) { this.f4598j = f10; } ColorStateList colorStateList2 = dVar.f11821i; if (colorStateList2 != null) { this.Q = colorStateList2; } this.O = dVar.f11822j; this.P = dVar.f11823k; this.N = dVar.f11824l; m3.a aVar = this.f4611w; if (aVar != null) { aVar.c(); } this.f4611w = new m3.a(new C0072a(), dVar.e()); dVar.h(this.f4589a.getContext(), this.f4611w); z(); } public void E(ColorStateList colorStateList) { if (this.f4600l != colorStateList) { this.f4600l = colorStateList; z(); } } public void F(int i10) { if (this.f4596h != i10) { this.f4596h = i10; z(); } } public void G(Typeface typeface) { if (H(typeface)) { z(); } } public void I(int i10, int i11, int i12, int i13) { if (A(this.f4592d, i10, i11, i12, i13)) { return; } this.f4592d.set(i10, i11, i12, i13); this.I = true; y(); } public void J(Rect rect) { I(rect.left, rect.top, rect.right, rect.bottom); } public void K(ColorStateList colorStateList) { if (this.f4599k != colorStateList) { this.f4599k = colorStateList; z(); } } public void L(int i10) { if (this.f4595g != i10) { this.f4595g = i10; z(); } } public void M(float f10) { if (this.f4597i != f10) { this.f4597i = f10; z(); } } public void O(float f10) { float a10 = t.a.a(f10, 0.0f, 1.0f); if (a10 != this.f4591c) { this.f4591c = a10; d(); } } public void Q(TimeInterpolator timeInterpolator) { this.L = timeInterpolator; z(); } public final boolean R(int[] iArr) { this.H = iArr; if (!w()) { return false; } z(); return true; } public void S(CharSequence charSequence) { if (charSequence == null || !TextUtils.equals(this.f4612x, charSequence)) { this.f4612x = charSequence; this.f4613y = null; h(); z(); } } public void T(TimeInterpolator timeInterpolator) { this.M = timeInterpolator; z(); } public void U(Typeface typeface) { boolean H = H(typeface); boolean N = N(typeface); if (H || N) { z(); } } public float c() { if (this.f4612x == null) { return 0.0f; } s(this.K); TextPaint textPaint = this.K; CharSequence charSequence = this.f4612x; return textPaint.measureText(charSequence, 0, charSequence.length()); } public void i(Canvas canvas) { float ascent; int save = canvas.save(); if (this.f4613y != null && this.f4590b) { float f10 = this.f4605q; float f11 = this.f4606r; boolean z10 = this.A && this.B != null; if (z10) { ascent = this.D * this.F; } else { ascent = this.J.ascent() * this.F; this.J.descent(); } if (z10) { f11 += ascent; } float f12 = f11; float f13 = this.F; if (f13 != 1.0f) { canvas.scale(f13, f13, f10, f12); } if (z10) { canvas.drawBitmap(this.B, f10, f12, this.C); } else { CharSequence charSequence = this.f4613y; canvas.drawText(charSequence, 0, charSequence.length(), f10, f12, this.J); } } canvas.restoreToCount(save); } public void k(RectF rectF) { boolean e10 = e(this.f4612x); Rect rect = this.f4593e; float c10 = !e10 ? rect.left : rect.right - c(); rectF.left = c10; Rect rect2 = this.f4593e; rectF.top = rect2.top; rectF.right = !e10 ? c10 + c() : rect2.right; rectF.bottom = this.f4593e.top + m(); } public ColorStateList l() { return this.f4600l; } public float m() { s(this.K); return -this.K.ascent(); } public int n() { return o(this.f4600l); } public float q() { t(this.K); return -this.K.ascent(); } public float r() { return this.f4591c; } public final boolean w() { ColorStateList colorStateList; ColorStateList colorStateList2 = this.f4600l; return (colorStateList2 != null && colorStateList2.isStateful()) || ((colorStateList = this.f4599k) != null && colorStateList.isStateful()); } void y() { this.f4590b = this.f4593e.width() > 0 && this.f4593e.height() > 0 && this.f4592d.width() > 0 && this.f4592d.height() > 0; } public void z() { if (this.f4589a.getHeight() <= 0 || this.f4589a.getWidth() <= 0) { return; } b(); d(); } }