package o; import android.content.Context; import android.content.res.ColorStateList; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.Base64; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import androidx.core.view.ViewCompat; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.lang.ref.WeakReference; import java.nio.charset.StandardCharsets; import java.text.NumberFormat; import java.util.Locale; import o.C17052tZT; import o.FLD; import o.Tjw; import o.pMl; /* renamed from: o.byp, reason: case insensitive filesystem */ /* loaded from: classes2.dex */ public final class C5745byp extends Drawable implements pMl.LWm { public static final int a; public static final int d; private static byte p = 0; private static int s = 1; private static int t; public final Tjw b; WeakReference c; public final pMl e; private float f; private final WeakReference g; private final Rect h; private WeakReference i; private float j; private float k; private int l; private float m; private final C4363bXv n; /* renamed from: o, reason: collision with root package name */ private float f8591o; @Override // android.graphics.drawable.Drawable public final int getOpacity() { return -3; } @Override // android.graphics.drawable.Drawable public final boolean isStateful() { return false; } @Override // android.graphics.drawable.Drawable public final void setColorFilter(ColorFilter colorFilter) { } private void q(String str, Object[] objArr) { byte[] decode = Base64.decode(str, 0); byte[] bArr = new byte[decode.length]; for (int i = 0; i < decode.length; i++) { bArr[i] = (byte) (decode[(decode.length - i) - 1] ^ p); } objArr[0] = new String(bArr, StandardCharsets.UTF_8); } static { g(); a = C17052tZT.NHB.Widget_MaterialComponents_Badge; d = C17052tZT.IeS.badgeStyle; } public final void d(boolean z) { Tjw tjw = this.b; tjw.n.t = Boolean.valueOf(z); tjw.h.t = Boolean.valueOf(z); setVisible(this.b.h.t.booleanValue(), false); } public C5745byp(Context context, int i, int i2, Tjw.RVV rvv) { int intValue; int intValue2; Rzh rzh; WeakReference weakReference = new WeakReference<>(context); this.g = weakReference; uqW.b(context, uqW.e, "Theme.MaterialComponents"); this.h = new Rect(); pMl pml = new pMl(this); this.e = pml; pml.e.setTextAlign(Paint.Align.CENTER); Tjw tjw = new Tjw(context, i, i2, rvv); this.b = tjw; if (tjw.h.r != -1) { intValue = tjw.h.k.intValue(); } else { intValue = tjw.h.j.intValue(); } if (tjw.h.r != -1) { intValue2 = tjw.h.n.intValue(); } else { intValue2 = tjw.h.i.intValue(); } this.n = new C4363bXv(new FLD(FLD.d(context, intValue, intValue2, new C17525xWe(BitmapDescriptorFactory.HUE_RED)), (byte) 0)); a(); Context context2 = weakReference.get(); if (context2 != null && pml.b != (rzh = new Rzh(context2, tjw.h.f.intValue()))) { pml.e(rzh, context2); pml.e.setColor(tjw.h.h.intValue()); invalidateSelf(); c(); invalidateSelf(); } this.l = ((int) Math.pow(10.0d, tjw.h.p - 1.0d)) - 1; pml.i = true; c(); invalidateSelf(); pml.i = true; a(); c(); invalidateSelf(); pml.e.setAlpha(getAlpha()); invalidateSelf(); e(); pml.e.setColor(tjw.h.h.intValue()); invalidateSelf(); WeakReference weakReference2 = this.i; if (weakReference2 != null && weakReference2.get() != null) { View view = this.i.get(); WeakReference weakReference3 = this.c; HZ_(view, weakReference3 != null ? weakReference3.get() : null); } c(); setVisible(tjw.h.t.booleanValue(), false); } public final void HZ_(View view, FrameLayout frameLayout) { this.i = new WeakReference<>(view); this.c = new WeakReference<>(frameLayout); ViewGroup viewGroup = (ViewGroup) view.getParent(); viewGroup.setClipChildren(false); viewGroup.setClipToPadding(false); c(); invalidateSelf(); } public final void e() { ColorStateList valueOf = ColorStateList.valueOf(this.b.h.a.intValue()); if (this.n.B.d != valueOf) { C4363bXv c4363bXv = this.n; if (c4363bXv.B.d != valueOf) { c4363bXv.B.d = valueOf; c4363bXv.onStateChange(c4363bXv.getState()); } invalidateSelf(); } } @Override // android.graphics.drawable.Drawable public final int getAlpha() { return this.b.h.b; } @Override // android.graphics.drawable.Drawable public final void setAlpha(int i) { Tjw tjw = this.b; tjw.n.b = i; tjw.h.b = i; this.e.e.setAlpha(getAlpha()); invalidateSelf(); } @Override // android.graphics.drawable.Drawable public final int getIntrinsicHeight() { return this.h.height(); } @Override // android.graphics.drawable.Drawable public final int getIntrinsicWidth() { return this.h.width(); } @Override // android.graphics.drawable.Drawable public final void draw(Canvas canvas) { if (getBounds().isEmpty() || getAlpha() == 0 || !isVisible()) { return; } this.n.draw(canvas); if (this.b.h.r != -1) { Rect rect = new Rect(); String h = h(); this.e.e.getTextBounds(h, 0, h.length(), rect); canvas.drawText(h, this.j, this.f + (rect.height() / 2), this.e.e); } } @Override // o.pMl.LWm public final void d() { invalidateSelf(); } @Override // android.graphics.drawable.Drawable, o.pMl.LWm public final boolean onStateChange(int[] iArr) { return super.onStateChange(iArr); } public final CharSequence b() { Context context; if (!isVisible()) { return null; } if (this.b.h.r != -1) { if (this.b.h.m == 0 || (context = this.g.get()) == null) { return null; } if ((this.b.h.r != -1 ? this.b.h.r : 0) <= this.l) { return context.getResources().getQuantityString(this.b.h.m, this.b.h.r != -1 ? this.b.h.r : 0, Integer.valueOf(this.b.h.r != -1 ? this.b.h.r : 0)); } return context.getString(this.b.h.l, Integer.valueOf(this.l)); } return this.b.h.f8380o; } public final void a() { int intValue; int intValue2; Context context = this.g.get(); if (context == null) { return; } C4363bXv c4363bXv = this.n; if (this.b.h.r == -1) { intValue = this.b.h.j.intValue(); } else { intValue = this.b.h.k.intValue(); } if (this.b.h.r == -1) { intValue2 = this.b.h.i.intValue(); } else { intValue2 = this.b.h.n.intValue(); } c4363bXv.setShapeAppearanceModel(new FLD(FLD.d(context, intValue, intValue2, new C17525xWe(BitmapDescriptorFactory.HUE_RED)), (byte) 0)); invalidateSelf(); } public final void c() { Context context = this.g.get(); WeakReference weakReference = this.i; View view = weakReference != null ? weakReference.get() : null; if (context == null || view == null) { return; } Rect rect = new Rect(); rect.set(this.h); Rect rect2 = new Rect(); view.getDrawingRect(rect2); WeakReference weakReference2 = this.c; FrameLayout frameLayout = weakReference2 != null ? weakReference2.get() : null; if (frameLayout != null) { if (frameLayout == null) { frameLayout = (ViewGroup) view.getParent(); } frameLayout.offsetDescendantRectToMyCoords(view, rect2); } HY_(rect2, view); C6759cbV.Ia_(this.h, this.j, this.f, this.k, this.m); float f = this.f8591o; if (f != -1.0f) { C4363bXv c4363bXv = this.n; FLD.RVV rvv = new FLD.RVV(c4363bXv.B.l); rvv.f = new C17525xWe(f); rvv.k = new C17525xWe(f); rvv.d = new C17525xWe(f); rvv.e = new C17525xWe(f); c4363bXv.setShapeAppearanceModel(new FLD(rvv, (byte) 0)); } if (rect.equals(this.h)) { return; } this.n.setBounds(this.h); } private void HY_(Rect rect, View view) { float measureText; float f = this.b.h.r != -1 ? this.b.g : this.b.e; this.f8591o = f; if (f != -1.0f) { this.m = f; this.k = f; } else { this.m = Math.round((this.b.h.r != -1 ? this.b.b : this.b.d) / 2.0f); this.k = Math.round((this.b.h.r != -1 ? this.b.j : this.b.c) / 2.0f); } if (this.b.h.r != -1 && this.b.h.r > 9) { String h = h(); float f2 = this.k; pMl pml = this.e; if (pml.i) { measureText = h == null ? BitmapDescriptorFactory.HUE_RED : pml.e.measureText((CharSequence) h, 0, h.length()); pml.d = measureText; pml.i = false; } else { measureText = pml.d; } this.k = Math.max(f2, (measureText / 2.0f) + this.b.a); } int intValue = this.b.h.r != -1 ? this.b.h.u.intValue() : this.b.h.v.intValue(); if (this.b.m == 0) { intValue -= Math.round(this.m); } int intValue2 = intValue + this.b.h.c.intValue(); int intValue3 = this.b.h.d.intValue(); if (intValue3 == 8388691 || intValue3 == 8388693) { this.f = rect.bottom - intValue2; } else { this.f = rect.top + intValue2; } int intValue4 = this.b.h.r != -1 ? this.b.h.q.intValue() : this.b.h.s.intValue(); if (this.b.m == 1) { intValue4 += this.b.h.r != -1 ? this.b.f : this.b.i; } int intValue5 = intValue4 + this.b.h.e.intValue(); int intValue6 = this.b.h.d.intValue(); if (intValue6 == 8388659 || intValue6 == 8388691) { this.j = ViewCompat.m(view) == 0 ? (rect.left - this.k) + intValue5 : (rect.right + this.k) - intValue5; } else { this.j = ViewCompat.m(view) == 0 ? (rect.right + this.k) - intValue5 : (rect.left - this.k) + intValue5; } } private String h() { int i; int i2 = 2 % 2; int i3 = t + 95; s = i3 % 128; int i4 = i3 % 2; int i5 = 0; if (this.b.h.r != -1) { int i6 = t + 73; int i7 = i6 % 128; s = i7; int i8 = i6 % 2; int i9 = i7 + 79; t = i9 % 128; if (i9 % 2 != 0) { int i10 = this.b.h.r; throw null; } i = this.b.h.r; } else { i = 0; } if (i > this.l) { Context context = this.g.get(); if (context == null) { return ""; } Locale locale = this.b.h.y; String string = context.getString(C17052tZT.ojQ.mtrl_exceed_max_badge_number_suffix); if (string.startsWith(",*,)")) { int i11 = s + 115; t = i11 % 128; int i12 = i11 % 2; String substring = string.substring(4); Object[] objArr = new Object[1]; q(substring, objArr); string = ((String) objArr[0]).intern(); } return String.format(locale, string, Integer.valueOf(this.l), "+"); } int i13 = t + 103; s = i13 % 128; int i14 = i13 % 2; NumberFormat numberFormat = NumberFormat.getInstance(this.b.h.y); if (this.b.h.r != -1) { int i15 = t + 99; s = i15 % 128; int i16 = i15 % 2; i5 = this.b.h.r; int i17 = t + 63; s = i17 % 128; int i18 = i17 % 2; } String format = numberFormat.format(i5); int i19 = s + 41; t = i19 % 128; int i20 = i19 % 2; return format; } static void g() { p = (byte) 6; } }