package e.x.a.f2.j; import android.content.Context; import android.content.ContextWrapper; import android.content.res.Resources; import android.graphics.Bitmap; import android.media.MediaPlayer; import android.os.Build; import android.os.Handler; import android.os.Looper; import android.os.SystemClock; import android.util.TypedValue; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; import android.view.ViewTreeObserver; import android.view.Window; import android.view.WindowInsets; import android.view.WindowInsetsController; import android.webkit.WebView; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.VideoView; import com.vungle.warren.utility.ViewUtility$Asset; import com.yalantis.ucrop.view.CropImageView; import e.w.c.e.b.l; import e.w.e.a.b.l.b; import e.x.a.f2.j.i; import java.util.HashMap; import java.util.Map; public class c extends RelativeLayout { public static final String x = c.class.getSimpleName(); public Map<View, Integer> b = new HashMap(); public final RelativeLayout.LayoutParams c; public final Window d; /* renamed from: e reason: collision with root package name */ public final VideoView f13018e; /* renamed from: f reason: collision with root package name */ public final RelativeLayout f13019f; /* renamed from: g reason: collision with root package name */ public WebView f13020g; /* renamed from: h reason: collision with root package name */ public final ProgressBar f13021h; /* renamed from: i reason: collision with root package name */ public final ImageView f13022i; /* renamed from: j reason: collision with root package name */ public final ImageView f13023j; /* renamed from: k reason: collision with root package name */ public final ImageView f13024k; /* renamed from: l reason: collision with root package name */ public final ImageView f13025l; /* renamed from: m reason: collision with root package name */ public g f13026m; /* renamed from: n reason: collision with root package name */ public o f13027n; /* renamed from: o reason: collision with root package name */ public MediaPlayer.OnPreparedListener f13028o; /* renamed from: p reason: collision with root package name */ public MediaPlayer.OnErrorListener f13029p; /* renamed from: q reason: collision with root package name */ public MediaPlayer.OnCompletionListener f13030q; /* renamed from: r reason: collision with root package name */ public int f13031r; /* renamed from: s reason: collision with root package name */ public GestureDetector f13032s; /* renamed from: t reason: collision with root package name */ public Runnable f13033t; public GestureDetector.SimpleOnGestureListener u = new b(); public ViewTreeObserver.OnGlobalLayoutListener v = new ViewTreeObserver$OnGlobalLayoutListenerC0349c(); public View.OnClickListener w = new d(); public class a implements Runnable { public a() { } public void run() { c.a(c.this); } } public class b extends GestureDetector.SimpleOnGestureListener { public b() { } public boolean onSingleTapConfirmed(MotionEvent motionEvent) { c cVar = c.this; cVar.w.onClick(cVar.f13019f); return true; } } /* renamed from: e.x.a.f2.j.c$c reason: collision with other inner class name */ public class ViewTreeObserver$OnGlobalLayoutListenerC0349c implements ViewTreeObserver.OnGlobalLayoutListener { public ViewTreeObserver$OnGlobalLayoutListenerC0349c() { } public void onGlobalLayout() { c cVar = c.this; String str = c.x; ViewTreeObserver viewTreeObserver = cVar.getViewTreeObserver(); if (viewTreeObserver.isAlive()) { viewTreeObserver.removeOnGlobalLayoutListener(cVar.v); } c.a(c.this); } } public class d implements View.OnClickListener { public d() { } /* JADX WARNING: Code restructure failed: missing block: B:17:0x002c, code lost: if (r0.f13038k != false) goto L_0x0081; */ public void onClick(View view) { i iVar; String str; String str2; c cVar = c.this; g gVar = cVar.f13026m; if (gVar != null) { Integer num = cVar.b.get(view); int intValue = num == null ? -1 : num.intValue(); i.a aVar = (i.a) gVar; if (intValue != 1) { if (intValue == 2) { iVar = i.this; } else if (intValue == 3) { i iVar2 = i.this; MediaPlayer mediaPlayer = iVar2.f13037j; if (mediaPlayer != null) { boolean z = true ^ iVar2.f13036i; iVar2.f13036i = z; float f2 = z ? CropImageView.DEFAULT_ASPECT_RATIO : 1.0f; try { mediaPlayer.setVolume(f2, f2); } catch (IllegalStateException unused) { } i iVar3 = i.this; e.x.a.f2.g.c cVar2 = iVar3.f13035h; boolean z2 = iVar3.f13036i; e.x.a.f2.h.a aVar2 = (e.x.a.f2.h.a) cVar2; aVar2.f12987k = z2; if (z2) { str2 = "mute"; str = "true"; } else { str2 = "unmute"; str = "false"; } aVar2.h(str2, str); i iVar4 = i.this; iVar4.f13015e.setMuted(iVar4.f13036i); } } else if (intValue == 4) { e.x.a.f2.h.a aVar3 = (e.x.a.f2.h.a) i.this.f13035h; aVar3.f12990n.open(null, "https://vungle.com/privacy/", new e.x.a.f2.f(aVar3.f12995s, aVar3.f12982f), null); } else if (intValue == 5) { iVar = i.this; } ((e.x.a.f2.h.a) iVar.f13035h).e(); } else { ((e.x.a.f2.h.a) i.this.f13035h).handleExit(); } } b.C0315b.f12266a.s(view); } } public static class e extends ContextWrapper { public e(Context context) { super(context); } @Override // android.content.Context, android.content.ContextWrapper public Object getSystemService(String str) { return "audio".equals(str) ? getApplicationContext().getSystemService(str) : super.getSystemService(str); } } public static class f implements Runnable { public WebView b; public f(WebView webView) { this.b = webView; } public void run() { this.b.stopLoading(); this.b.setWebViewClient(null); if (Build.VERSION.SDK_INT >= 29) { this.b.setWebViewRenderProcessClient(null); } this.b.loadData("", null, null); this.b.destroy(); } } public interface g { } public c(Context context, Window window) throws InstantiationException { super(context); this.d = window; Resources resources = getResources(); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1); this.c = layoutParams; setLayoutParams(layoutParams); this.f13033t = new a(); VideoView videoView = new VideoView(new e(context)); this.f13018e = videoView; RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-1, -1); layoutParams2.addRule(13); videoView.setLayoutParams(layoutParams2); RelativeLayout relativeLayout = new RelativeLayout(context); this.f13019f = relativeLayout; relativeLayout.setTag("videoViewContainer"); relativeLayout.setLayoutParams(layoutParams); relativeLayout.addView(videoView, layoutParams2); addView(relativeLayout, layoutParams); this.f13032s = new GestureDetector(context, this.u); try { e.w.e.a.b.t.d.a.a aVar = new e.w.e.a.b.t.d.a.a(context); this.f13020g = aVar; aVar.setLayoutParams(layoutParams); this.f13020g.setTag("webView"); addView(this.f13020g, layoutParams); ProgressBar progressBar = new ProgressBar(context, null, 16842872); this.f13021h = progressBar; RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-1, (int) TypedValue.applyDimension(1, 4.0f, resources.getDisplayMetrics())); layoutParams3.addRule(12); progressBar.setLayoutParams(layoutParams3); progressBar.setMax(100); progressBar.setIndeterminate(false); progressBar.setVisibility(4); addView(progressBar); int applyDimension = (int) TypedValue.applyDimension(1, 24.0f, resources.getDisplayMetrics()); RelativeLayout.LayoutParams layoutParams4 = new RelativeLayout.LayoutParams(applyDimension, applyDimension); int applyDimension2 = (int) TypedValue.applyDimension(1, 12.0f, resources.getDisplayMetrics()); layoutParams4.setMargins(applyDimension2, applyDimension2, applyDimension2, applyDimension2); ImageView imageView = new ImageView(context); this.f13022i = imageView; imageView.setImageBitmap(l.o0(ViewUtility$Asset.unMute, context)); imageView.setLayoutParams(layoutParams4); imageView.setVisibility(8); addView(imageView); RelativeLayout.LayoutParams layoutParams5 = new RelativeLayout.LayoutParams(applyDimension, applyDimension); layoutParams5.setMargins(applyDimension2, applyDimension2, applyDimension2, applyDimension2); ImageView imageView2 = new ImageView(context); this.f13023j = imageView2; imageView2.setTag("closeButton"); imageView2.setImageBitmap(l.o0(ViewUtility$Asset.close, context)); layoutParams5.addRule(11); imageView2.setLayoutParams(layoutParams5); imageView2.setVisibility(8); addView(imageView2); RelativeLayout.LayoutParams layoutParams6 = new RelativeLayout.LayoutParams(applyDimension, applyDimension); layoutParams6.addRule(12); layoutParams6.addRule(11); layoutParams6.setMargins(applyDimension2, applyDimension2, applyDimension2, applyDimension2); ImageView imageView3 = new ImageView(context); this.f13024k = imageView3; imageView3.setTag("ctaOverlay"); imageView3.setLayoutParams(layoutParams6); imageView3.setImageBitmap(l.o0(ViewUtility$Asset.cta, getContext())); imageView3.setVisibility(8); addView(imageView3); RelativeLayout.LayoutParams layoutParams7 = new RelativeLayout.LayoutParams(applyDimension, applyDimension); layoutParams7.addRule(12); layoutParams7.addRule(9); layoutParams7.setMargins(applyDimension2, applyDimension2, applyDimension2, applyDimension2); ImageView imageView4 = new ImageView(context); this.f13025l = imageView4; imageView4.setLayoutParams(layoutParams7); imageView4.setVisibility(8); addView(imageView4); this.b.put(imageView2, 1); imageView2.setOnClickListener(this.w); this.b.put(imageView3, 2); imageView3.setOnClickListener(this.w); this.b.put(imageView, 3); imageView.setOnClickListener(this.w); this.b.put(imageView4, 4); imageView4.setOnClickListener(this.w); this.b.put(relativeLayout, 5); relativeLayout.setOnTouchListener(new d(this)); videoView.setOnPreparedListener(new e(this)); videoView.setOnErrorListener(new f(this)); videoView.setOnCompletionListener(new g(this)); WebView webView = this.f13020g; if (webView != null) { webView.setOnTouchListener(new h(this)); } WebView webView2 = this.f13020g; if (webView2 != null) { webView2.getSettings().setMediaPlaybackRequiresUserGesture(false); this.f13020g.setVisibility(8); } relativeLayout.setVisibility(8); } catch (Exception e2) { throw new InstantiationException(e2.getMessage()); } } public static void a(c cVar) { if (Build.VERSION.SDK_INT >= 30) { cVar.d.setDecorFitsSystemWindows(false); WindowInsetsController insetsController = cVar.d.getInsetsController(); if (insetsController != null) { insetsController.hide(WindowInsets.Type.statusBars() | WindowInsets.Type.navigationBars()); insetsController.setSystemBarsBehavior(2); return; } return; } cVar.d.getDecorView().setSystemUiVisibility(5894); } public void b(long j2) { WebView webView = this.f13020g; if (webView != null) { webView.removeJavascriptInterface("Android"); this.f13020g.setWebChromeClient(null); removeView(this.f13020g); this.f13020g.removeAllViews(); if (j2 <= 0) { new f(this.f13020g).run(); } else { new Handler(Looper.getMainLooper()).postAtTime(new f(this.f13020g), SystemClock.uptimeMillis() + j2); } this.f13020g = null; } } public void c(String str) { WebView webView = this.f13020g; if (webView != null) { webView.loadUrl(str); this.f13020g.setVisibility(0); this.f13019f.setVisibility(8); this.f13019f.setOnClickListener(null); this.f13021h.setVisibility(8); this.f13023j.setVisibility(8); this.f13022i.setVisibility(8); this.f13024k.setVisibility(8); this.f13025l.setVisibility(8); } } public int getCurrentVideoPosition() { return this.f13018e.getCurrentPosition(); } public String getUrl() { WebView webView = this.f13020g; if (webView == null) { return null; } return webView.getUrl(); } public int getVideoDuration() { return this.f13018e.getDuration(); } public WebView getWebView() { return this.f13020g; } public void setCtaEnabled(boolean z) { this.f13024k.setVisibility(z ? 0 : 8); } public void setMuted(boolean z) { Bitmap o0 = l.o0(ViewUtility$Asset.mute, getContext()); Bitmap o02 = l.o0(ViewUtility$Asset.unMute, getContext()); ImageView imageView = this.f13022i; if (!z) { o0 = o02; } imageView.setImageBitmap(o0); } public void setOnCompletionListener(MediaPlayer.OnCompletionListener onCompletionListener) { this.f13030q = onCompletionListener; } public void setOnErrorListener(MediaPlayer.OnErrorListener onErrorListener) { this.f13029p = onErrorListener; } public void setOnItemClickListener(g gVar) { this.f13026m = gVar; } public void setOnPreparedListener(MediaPlayer.OnPreparedListener onPreparedListener) { this.f13028o = onPreparedListener; } public void setOnViewTouchListener(o oVar) { this.f13027n = oVar; } }