package com.applovin.exoplayer2.ui; import android.content.Context; import android.text.Layout; import android.util.AttributeSet; import android.view.MotionEvent; import android.webkit.WebView; import android.widget.FrameLayout; import com.applovin.exoplayer2.ui.SubtitleView; import com.applovin.impl.b5; import com.applovin.impl.x2; import com.applovin.impl.xp; import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode; import java.util.ArrayList; import java.util.Collections; import java.util.List; /* loaded from: classes.dex */ final class j extends FrameLayout implements SubtitleView.a { private final com.applovin.exoplayer2.ui.a a; private final WebView b; private List c; private x2 d; private float f; private int g; private float h; public class a extends WebView { public a(Context context, AttributeSet attributeSet) { super(context, attributeSet); } @Override // android.webkit.WebView, android.view.View public boolean onTouchEvent(MotionEvent motionEvent) { super.onTouchEvent(motionEvent); return false; } @Override // android.view.View public boolean performClick() { super.performClick(); return false; } } public static /* synthetic */ class b { static final /* synthetic */ int[] a; static { int[] iArr = new int[Layout.Alignment.values().length]; a = iArr; try { iArr[Layout.Alignment.ALIGN_NORMAL.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { a[Layout.Alignment.ALIGN_OPPOSITE.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { a[Layout.Alignment.ALIGN_CENTER.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } } } public j(Context context) { this(context, null); } private static int a(int i) { if (i != 1) { return i != 2 ? 0 : -100; } return -50; } private static String b(int i) { return i != 1 ? i != 2 ? "horizontal-tb" : "vertical-lr" : "vertical-rl"; } /* JADX WARN: Code restructure failed: missing block: B:53:0x013b, code lost: if (r8 != false) goto L42; */ /* JADX WARN: Code restructure failed: missing block: B:54:0x013e, code lost: r10 = "left"; */ /* JADX WARN: Code restructure failed: missing block: B:55:0x013f, code lost: r19 = r10; r17 = "top"; */ /* JADX WARN: Code restructure failed: missing block: B:56:0x0144, code lost: if (r8 != false) goto L41; */ /* JADX WARN: Removed duplicated region for block: B:17:0x00ee */ /* JADX WARN: Removed duplicated region for block: B:21:0x0119 */ /* JADX WARN: Removed duplicated region for block: B:24:0x0130 */ /* JADX WARN: Removed duplicated region for block: B:35:0x017d */ /* JADX WARN: Removed duplicated region for block: B:47:0x01d7 */ /* JADX WARN: Removed duplicated region for block: B:50:0x01f1 */ /* JADX WARN: Removed duplicated region for block: B:56:0x0144 */ /* JADX WARN: Removed duplicated region for block: B:57:0x011c */ /* JADX WARN: Removed duplicated region for block: B:58:0x00fe */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private void b() { /* Method dump skipped, instructions count: 613 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.applovin.exoplayer2.ui.j.b():void"); } @Override // android.widget.FrameLayout, android.view.ViewGroup, android.view.View public void onLayout(boolean z, int i, int i2, int i3, int i4) { super.onLayout(z, i, i2, i3, i4); if (!z || this.c.isEmpty()) { return; } b(); } public j(Context context, AttributeSet attributeSet) { super(context, attributeSet); this.c = Collections.emptyList(); this.d = x2.g; this.f = 0.0533f; this.g = 0; this.h = 0.08f; com.applovin.exoplayer2.ui.a aVar = new com.applovin.exoplayer2.ui.a(context, attributeSet); this.a = aVar; a aVar2 = new a(context, attributeSet); this.b = aVar2; aVar2.setBackgroundColor(0); addView(aVar); addView(aVar2); } private static String a(x2 x2Var) { int i = x2Var.d; if (i == 1) { return xp.a("1px 1px 0 %1$s, 1px -1px 0 %1$s, -1px 1px 0 %1$s, -1px -1px 0 %1$s", c.a(x2Var.e)); } if (i == 2) { return xp.a("0.1em 0.12em 0.15em %s", c.a(x2Var.e)); } if (i != 3) { return i != 4 ? "unset" : xp.a("-0.05em -0.05em 0.15em %s", c.a(x2Var.e)); } return xp.a("0.06em 0.08em 0.15em %s", c.a(x2Var.e)); } private static String a(b5 b5Var) { float f = b5Var.r; if (f == 0.0f) { return ""; } int i = b5Var.q; return xp.a("%s(%.2fdeg)", (i == 2 || i == 1) ? "skewY" : "skewX", Float.valueOf(f)); } @Override // com.applovin.exoplayer2.ui.SubtitleView.a public void a(List list, x2 x2Var, float f, int i, float f2) { this.d = x2Var; this.f = f; this.g = i; this.h = f2; ArrayList arrayList = new ArrayList(); ArrayList arrayList2 = new ArrayList(); for (int i2 = 0; i2 < list.size(); i2++) { b5 b5Var = (b5) list.get(i2); if (b5Var.d != null) { arrayList.add(b5Var); } else { arrayList2.add(b5Var); } } if (!this.c.isEmpty() || !arrayList2.isEmpty()) { this.c = arrayList2; b(); } this.a.a(arrayList, x2Var, f, i, f2); invalidate(); } public void a() { this.b.destroy(); } private String a(int i, float f) { float a2 = h.a(i, f, getHeight(), (getHeight() - getPaddingTop()) - getPaddingBottom()); return a2 == -3.4028235E38f ? "unset" : xp.a("%.2fpx", Float.valueOf(a2 / getContext().getResources().getDisplayMetrics().density)); } private static String a(Layout.Alignment alignment) { if (alignment == null) { return "center"; } int i = b.a[alignment.ordinal()]; return i != 1 ? i != 2 ? "center" : TtmlNode.END : "start"; } }