package com.vungle.warren.ui.view; import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.os.Handler; import android.os.Looper; import android.text.TextUtils; import android.util.Log; import android.view.ContextThemeWrapper; import com.vungle.warren.utility.a; import java.util.concurrent.atomic.AtomicReference; /* loaded from: classes2.dex */ public abstract class a implements m8.a { /* renamed from: a, reason: collision with root package name */ private final l8.e f8464a; /* renamed from: b, reason: collision with root package name */ private final l8.a f8465b; /* renamed from: c, reason: collision with root package name */ protected Handler f8466c = new Handler(Looper.getMainLooper()); /* renamed from: d, reason: collision with root package name */ protected final String f8467d = getClass().getSimpleName(); /* renamed from: e, reason: collision with root package name */ protected final f f8468e; /* renamed from: f, reason: collision with root package name */ protected final Context f8469f; /* renamed from: g, reason: collision with root package name */ protected Dialog f8470g; /* renamed from: com.vungle.warren.ui.view.a$a, reason: collision with other inner class name */ class DialogInterfaceOnClickListenerC0125a implements DialogInterface.OnClickListener { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ DialogInterface.OnClickListener f8471a; DialogInterfaceOnClickListenerC0125a(DialogInterface.OnClickListener onClickListener) { this.f8471a = onClickListener; } @Override // android.content.DialogInterface.OnClickListener public void onClick(DialogInterface dialogInterface, int i10) { a.this.f8470g = null; DialogInterface.OnClickListener onClickListener = this.f8471a; if (onClickListener != null) { onClickListener.onClick(dialogInterface, i10); } } } class b implements DialogInterface.OnDismissListener { b() { } @Override // android.content.DialogInterface.OnDismissListener public void onDismiss(DialogInterface dialogInterface) { a.this.f8470g = null; } } class c implements DialogInterface.OnDismissListener { c() { } @Override // android.content.DialogInterface.OnDismissListener public void onDismiss(DialogInterface dialogInterface) { a aVar = a.this; aVar.f8470g.setOnDismissListener(aVar.s()); } } private static class d implements DialogInterface.OnClickListener, DialogInterface.OnDismissListener { /* renamed from: a, reason: collision with root package name */ private AtomicReference f8475a = new AtomicReference(); /* renamed from: b, reason: collision with root package name */ private AtomicReference f8476b = new AtomicReference(); public d(DialogInterface.OnClickListener onClickListener, DialogInterface.OnDismissListener onDismissListener) { this.f8475a.set(onClickListener); this.f8476b.set(onDismissListener); } /* JADX INFO: Access modifiers changed from: private */ public void b(Dialog dialog) { dialog.setOnDismissListener(this); } @Override // android.content.DialogInterface.OnClickListener public void onClick(DialogInterface dialogInterface, int i10) { dialogInterface.dismiss(); DialogInterface.OnClickListener onClickListener = (DialogInterface.OnClickListener) this.f8475a.get(); if (onClickListener != null) { onClickListener.onClick(dialogInterface, i10); } } @Override // android.content.DialogInterface.OnDismissListener public void onDismiss(DialogInterface dialogInterface) { DialogInterface.OnDismissListener onDismissListener = (DialogInterface.OnDismissListener) this.f8476b.get(); if (onDismissListener != null) { onDismissListener.onDismiss(dialogInterface); } this.f8476b.set(null); this.f8475a.set(null); } } public a(Context context, f fVar, l8.e eVar, l8.a aVar) { this.f8468e = fVar; this.f8469f = context; this.f8464a = eVar; this.f8465b = aVar; } public boolean b() { return this.f8470g != null; } @Override // m8.a public void c() { this.f8468e.w(); } @Override // m8.a public void close() { this.f8465b.close(); } @Override // m8.a public void d() { this.f8468e.E(true); } @Override // m8.a public void f(String str, String str2, a.f fVar, l8.f fVar2) { Log.d(this.f8467d, "Opening " + str2); if (com.vungle.warren.utility.h.b(str, str2, this.f8469f, fVar, false, fVar2)) { return; } Log.e(this.f8467d, "Cannot open url " + str2); } @Override // m8.a public void g() { this.f8468e.p(0L); } @Override // m8.a public String getWebsiteUrl() { return this.f8468e.getUrl(); } @Override // m8.a public void h() { this.f8468e.B(); } @Override // m8.a public void k(String str, String str2, String str3, String str4, DialogInterface.OnClickListener onClickListener) { Context context = this.f8469f; AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(context, context.getApplicationInfo().theme)); d dVar = new d(new DialogInterfaceOnClickListenerC0125a(onClickListener), s()); if (!TextUtils.isEmpty(str)) { builder.setTitle(str); } if (!TextUtils.isEmpty(str2)) { builder.setMessage(str2); } builder.setPositiveButton(str3, dVar); builder.setNegativeButton(str4, dVar); builder.setCancelable(false); AlertDialog create = builder.create(); this.f8470g = create; dVar.b(create); this.f8470g.show(); } @Override // m8.a public boolean n() { return this.f8468e.q(); } @Override // m8.a public void p() { this.f8468e.C(); } @Override // m8.a public void q(long j10) { this.f8468e.z(j10); } @Override // m8.a public void r() { if (b()) { this.f8470g.setOnDismissListener(new c()); this.f8470g.dismiss(); this.f8470g.show(); } } protected DialogInterface.OnDismissListener s() { return new b(); } @Override // m8.a public void setOrientation(int i10) { this.f8464a.setOrientation(i10); } }