package o; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Typeface; import android.text.TextPaint; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import o.C17052tZT; import o.kVs; /* loaded from: classes2.dex */ public class Rzh { boolean a = false; public final ColorStateList b; public final int c; public final float d; public Typeface e; public final float f; public ColorStateList g; public float h; public final float i; public final float j; private ColorStateList k; private boolean l; public final int m; private boolean n; /* renamed from: o, reason: collision with root package name */ private String f8353o; private int r; private ColorStateList s; public Rzh(Context context, int i) { TypedArray obtainStyledAttributes = context.obtainStyledAttributes(i, C17052tZT.jNh.TextAppearance); this.h = obtainStyledAttributes.getDimension(C17052tZT.jNh.TextAppearance_android_textSize, BitmapDescriptorFactory.HUE_RED); this.g = C14739fyr.Ku_(context, obtainStyledAttributes, C17052tZT.jNh.TextAppearance_android_textColor); this.k = C14739fyr.Ku_(context, obtainStyledAttributes, C17052tZT.jNh.TextAppearance_android_textColorHint); this.s = C14739fyr.Ku_(context, obtainStyledAttributes, C17052tZT.jNh.TextAppearance_android_textColorLink); this.m = obtainStyledAttributes.getInt(C17052tZT.jNh.TextAppearance_android_textStyle, 0); this.r = obtainStyledAttributes.getInt(C17052tZT.jNh.TextAppearance_android_typeface, 1); int i2 = C17052tZT.jNh.TextAppearance_fontFamily; i2 = obtainStyledAttributes.hasValue(i2) ? i2 : C17052tZT.jNh.TextAppearance_android_fontFamily; this.c = obtainStyledAttributes.getResourceId(i2, 0); this.f8353o = obtainStyledAttributes.getString(i2); this.l = obtainStyledAttributes.getBoolean(C17052tZT.jNh.TextAppearance_textAllCaps, false); this.b = C14739fyr.Ku_(context, obtainStyledAttributes, C17052tZT.jNh.TextAppearance_android_shadowColor); this.f = obtainStyledAttributes.getFloat(C17052tZT.jNh.TextAppearance_android_shadowDx, BitmapDescriptorFactory.HUE_RED); this.j = obtainStyledAttributes.getFloat(C17052tZT.jNh.TextAppearance_android_shadowDy, BitmapDescriptorFactory.HUE_RED); this.i = obtainStyledAttributes.getFloat(C17052tZT.jNh.TextAppearance_android_shadowRadius, BitmapDescriptorFactory.HUE_RED); obtainStyledAttributes.recycle(); TypedArray obtainStyledAttributes2 = context.obtainStyledAttributes(i, C17052tZT.jNh.MaterialTextAppearance); this.n = obtainStyledAttributes2.hasValue(C17052tZT.jNh.MaterialTextAppearance_android_letterSpacing); this.d = obtainStyledAttributes2.getFloat(C17052tZT.jNh.MaterialTextAppearance_android_letterSpacing, BitmapDescriptorFactory.HUE_RED); obtainStyledAttributes2.recycle(); } public final Typeface Ky_(Context context) { if (this.a) { return this.e; } if (!context.isRestricted()) { try { Typeface ob_ = kVs.ob_(context, this.c); this.e = ob_; if (ob_ != null) { this.e = Typeface.create(ob_, this.m); } } catch (Resources.NotFoundException | UnsupportedOperationException | Exception unused) { } } d(); this.a = true; return this.e; } public final void d() { String str; if (this.e == null && (str = this.f8353o) != null) { this.e = Typeface.create(str, this.m); } if (this.e == null) { int i = this.r; if (i == 1) { this.e = Typeface.SANS_SERIF; } else if (i == 2) { this.e = Typeface.SERIF; } else if (i == 3) { this.e = Typeface.MONOSPACE; } else { this.e = Typeface.DEFAULT; } this.e = Typeface.create(this.e, this.m); } } public final void Kz_(Context context, TextPaint textPaint, Dwp dwp) { d(); KB_(context, textPaint, this.e); b(context, new Dwp(this, context, textPaint, dwp) { // from class: o.Rzh.3 private TextPaint a; private Rzh c; private Context d; private Dwp e; { this.c = this; this.d = context; this.a = textPaint; this.e = dwp; } @Override // o.Dwp public final void KE_(Typeface typeface, boolean z) { this.c.KB_(this.d, this.a, typeface); this.e.KE_(typeface, z); } @Override // o.Dwp public final void c(int i) { this.e.c(i); } }); } public final void b(Context context, Dwp dwp) { int i = this.c; if ((i != 0 ? kVs.nW_(context, i) : null) != null) { Ky_(context); } else { d(); } int i2 = this.c; if (i2 == 0) { this.a = true; } if (this.a) { dwp.KE_(this.e, true); return; } try { kVs.od_(context, i2, new kVs.LWm(this, dwp) { // from class: o.Rzh.5 private Dwp b; private Rzh d; { this.d = this; this.b = dwp; } @Override // o.kVs.LWm /* renamed from: KC_ */ public final void oq_(Typeface typeface) { Rzh rzh = this.d; rzh.e = Typeface.create(typeface, rzh.m); this.d.a = true; this.b.KE_(this.d.e, false); } @Override // o.kVs.LWm /* renamed from: e */ public final void b(int i3) { this.d.a = true; this.b.c(i3); } }, null); } catch (Resources.NotFoundException unused) { this.a = true; dwp.c(1); } catch (Exception unused2) { this.a = true; dwp.c(-3); } } public final void KA_(Context context, TextPaint textPaint, Dwp dwp) { int i = this.c; if ((i != 0 ? kVs.nW_(context, i) : null) != null) { KB_(context, textPaint, Ky_(context)); } else { Kz_(context, textPaint, dwp); } ColorStateList colorStateList = this.g; textPaint.setColor(colorStateList != null ? colorStateList.getColorForState(textPaint.drawableState, this.g.getDefaultColor()) : -16777216); float f = this.i; float f2 = this.f; float f3 = this.j; ColorStateList colorStateList2 = this.b; textPaint.setShadowLayer(f, f2, f3, colorStateList2 != null ? colorStateList2.getColorForState(textPaint.drawableState, this.b.getDefaultColor()) : 0); } public final void KB_(Context context, TextPaint textPaint, Typeface typeface) { Typeface KF_ = FDA.KF_(context.getResources().getConfiguration(), typeface); if (KF_ != null) { typeface = KF_; } textPaint.setTypeface(typeface); int i = this.m & (~typeface.getStyle()); textPaint.setFakeBoldText((i & 1) != 0); textPaint.setTextSkewX((i & 2) != 0 ? -0.25f : BitmapDescriptorFactory.HUE_RED); textPaint.setTextSize(this.h); if (this.n) { textPaint.setLetterSpacing(this.d); } } }