package com.mbridge.msdk.splash.signal; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.webkit.ValueCallback; import android.webkit.WebView; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; import com.google.android.gms.ads.AdError; import com.ironsource.nb; import com.mbridge.msdk.foundation.entity.CampaignEx; import com.mbridge.msdk.foundation.tools.ab; import com.mbridge.msdk.foundation.tools.af; import com.mbridge.msdk.foundation.tools.ak; import com.mbridge.msdk.mbsignalcommon.windvane.WindVaneWebView; import com.mbridge.msdk.newreward.player.view.hybrid.util.MRAIDCommunicatorUtil; import com.mbridge.msdk.widget.MBAdChoice; import com.vungle.ads.internal.presenter.MRAIDPresenter; import java.util.HashMap; import java.util.List; import org.json.JSONObject; /* loaded from: classes4.dex */ public class SplashExpandDialog extends Dialog { private final String a; private String b; private boolean c; private FrameLayout d; private WindVaneWebView e; private TextView f; private String g; private List h; private com.mbridge.msdk.splash.d.a i; private com.mbridge.msdk.mbsignalcommon.mraid.b j; public void setCampaignList(String str, List list) { this.g = str; this.h = list; } public SplashExpandDialog(Context context, Bundle bundle, com.mbridge.msdk.splash.d.a aVar) { super(context); this.a = "SplashExpandDialog"; this.j = new com.mbridge.msdk.mbsignalcommon.mraid.b() { // from class: com.mbridge.msdk.splash.signal.SplashExpandDialog.5 @Override // com.mbridge.msdk.mbsignalcommon.mraid.b public final void expand(String str, boolean z) { } @Override // com.mbridge.msdk.mbsignalcommon.mraid.b public final CampaignEx getMraidCampaign() { return null; } @Override // com.mbridge.msdk.mbsignalcommon.mraid.b public final void open(String str) { try { if (SplashExpandDialog.this.e == null || System.currentTimeMillis() - SplashExpandDialog.this.e.lastTouchTime <= com.mbridge.msdk.click.b.a.c || !com.mbridge.msdk.click.b.a.a((CampaignEx) SplashExpandDialog.this.h.get(0), SplashExpandDialog.this.e.getUrl(), com.mbridge.msdk.click.b.a.a)) { af.b("SplashExpandDialog", str); if (SplashExpandDialog.this.h.size() > 1) { com.mbridge.msdk.foundation.controller.c.m().c().startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str))); str = null; } if (SplashExpandDialog.this.i != null) { SplashExpandDialog.this.i.a(true, str); } } } catch (Throwable th) { af.b("SplashExpandDialog", MRAIDPresenter.OPEN, th); } } @Override // com.mbridge.msdk.mbsignalcommon.mraid.b public final void close() { SplashExpandDialog.this.dismiss(); } @Override // com.mbridge.msdk.mbsignalcommon.mraid.b public final void unload() { close(); } @Override // com.mbridge.msdk.mbsignalcommon.mraid.b public final void useCustomClose(boolean z) { try { SplashExpandDialog.this.f.setVisibility(z ? 4 : 0); } catch (Throwable th) { af.b("SplashExpandDialog", "useCustomClose", th); } } }; if (bundle != null) { this.b = bundle.getString("url"); this.c = bundle.getBoolean("shouldUseCustomClose"); } this.i = aVar; } @Override // android.app.Dialog public void onCreate(Bundle bundle) { CampaignEx campaignEx; super.onCreate(bundle); requestWindowFeature(1); setCanceledOnTouchOutside(false); setCancelable(true); FrameLayout frameLayout = new FrameLayout(getContext()); this.d = frameLayout; frameLayout.setLayoutParams(new FrameLayout.LayoutParams(-1, -1)); WindVaneWebView windVaneWebView = new WindVaneWebView(getContext().getApplicationContext()); this.e = windVaneWebView; windVaneWebView.setLayoutParams(new FrameLayout.LayoutParams(-1, -1)); this.d.addView(this.e); TextView textView = new TextView(getContext()); this.f = textView; textView.setBackgroundColor(0); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(96, 96); layoutParams.gravity = 8388661; layoutParams.setMargins(30, 30, 30, 30); this.f.setLayoutParams(layoutParams); this.f.setVisibility(this.c ? 4 : 0); this.f.setOnClickListener(new View.OnClickListener() { // from class: com.mbridge.msdk.splash.signal.SplashExpandDialog.1 @Override // android.view.View.OnClickListener public final void onClick(View view) { SplashExpandDialog.this.dismiss(); } }); this.d.addView(this.f); setContentView(this.d); a(); this.e.setWebViewListener(new com.mbridge.msdk.mbsignalcommon.b.b() { // from class: com.mbridge.msdk.splash.signal.SplashExpandDialog.2 @Override // com.mbridge.msdk.mbsignalcommon.b.b, com.mbridge.msdk.mbsignalcommon.windvane.d public final void a(WebView webView, String str) { super.a(webView, str); webView.evaluateJavascript("javascript:" + com.mbridge.msdk.c.b.a.a().b(), new ValueCallback() { // from class: com.mbridge.msdk.splash.signal.SplashExpandDialog.2.1 @Override // android.webkit.ValueCallback public final /* bridge */ /* synthetic */ void onReceiveValue(String str2) { } }); SplashExpandDialog.a(SplashExpandDialog.this); } }); this.e.setObject(this.j); this.e.loadUrl(this.b); List list = this.h; if (list != null && !list.isEmpty() && (campaignEx = this.h.get(0)) != null && campaignEx.getPrivacyButtonTemplateVisibility() != 0) { MBAdChoice mBAdChoice = new MBAdChoice(com.mbridge.msdk.foundation.controller.c.m().c()); mBAdChoice.setCampaign(campaignEx); FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(ak.a(com.mbridge.msdk.foundation.controller.c.m().c(), 12.0f), ak.a(com.mbridge.msdk.foundation.controller.c.m().c(), 12.0f)); layoutParams2.gravity = 85; layoutParams2.bottomMargin = layoutParams.topMargin; layoutParams2.rightMargin = layoutParams.rightMargin; mBAdChoice.setFeedbackDialogEventListener(new com.mbridge.msdk.foundation.d.a() { // from class: com.mbridge.msdk.splash.signal.SplashExpandDialog.3 @Override // com.mbridge.msdk.foundation.d.a public final void showed() { } @Override // com.mbridge.msdk.foundation.d.a public final void close() { SplashExpandDialog.this.a(); } @Override // com.mbridge.msdk.foundation.d.a public final void summit(String str) { SplashExpandDialog.this.a(); } }); this.d.addView(mBAdChoice, layoutParams2); } BitmapDrawable a = com.mbridge.msdk.foundation.controller.c.m().a(this.g, 297); if (a != null) { ImageView imageView = new ImageView(com.mbridge.msdk.foundation.controller.c.m().c()); ak.a(imageView, a, this.d.getResources().getDisplayMetrics()); this.d.addView(imageView, new ViewGroup.LayoutParams(-1, -1)); } setOnDismissListener(new DialogInterface.OnDismissListener() { // from class: com.mbridge.msdk.splash.signal.SplashExpandDialog.4 @Override // android.content.DialogInterface.OnDismissListener public final void onDismiss(DialogInterface dialogInterface) { if (SplashExpandDialog.this.i != null) { SplashExpandDialog.this.i.a(false); SplashExpandDialog.this.i.a(); } SplashExpandDialog.this.e.loadDataWithBaseURL(null, "", "text/html", nb.N, null); SplashExpandDialog.this.d.removeView(SplashExpandDialog.this.e); SplashExpandDialog.this.e.release(); SplashExpandDialog.this.e = null; SplashExpandDialog.this.i = null; } }); } /* JADX INFO: Access modifiers changed from: private */ public void a() { if (getWindow() != null) { getWindow().setBackgroundDrawable(new ColorDrawable(0)); getWindow().getDecorView().setPadding(0, 0, 0, 0); WindowManager.LayoutParams attributes = getWindow().getAttributes(); attributes.width = -1; attributes.height = -1; getWindow().setAttributes(attributes); getWindow().getDecorView().setSystemUiVisibility(4615); } } @Override // android.app.Dialog, android.content.DialogInterface public void dismiss() { super.dismiss(); } public static /* synthetic */ void a(SplashExpandDialog splashExpandDialog) { try { int i = com.mbridge.msdk.foundation.controller.c.m().c().getResources().getConfiguration().orientation; JSONObject jSONObject = new JSONObject(); jSONObject.put("orientation", i == 2 ? "landscape" : i == 1 ? "portrait" : AdError.UNDEFINED_DOMAIN); jSONObject.put("locked", "true"); float j = ab.j(com.mbridge.msdk.foundation.controller.c.m().c()); float h = ab.h(com.mbridge.msdk.foundation.controller.c.m().c()); HashMap i2 = ab.i(com.mbridge.msdk.foundation.controller.c.m().c()); int intValue = ((Integer) i2.get("width")).intValue(); int intValue2 = ((Integer) i2.get("height")).intValue(); HashMap hashMap = new HashMap(); hashMap.put(MRAIDCommunicatorUtil.KEY_PLACEMENTTYPE, "Interstitial"); hashMap.put("state", MRAIDCommunicatorUtil.STATES_EXPANDED); hashMap.put(MRAIDCommunicatorUtil.KEY_VIEWABLE, "true"); hashMap.put(MRAIDCommunicatorUtil.KEY_CURRENTORIENTATION, jSONObject); splashExpandDialog.e.getLocationInWindow(new int[2]); com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(splashExpandDialog.e, r1[0], r1[1], r11.getWidth(), splashExpandDialog.e.getHeight()); com.mbridge.msdk.mbsignalcommon.mraid.a.a().b(splashExpandDialog.e, r1[0], r1[1], r5.getWidth(), splashExpandDialog.e.getHeight()); com.mbridge.msdk.mbsignalcommon.mraid.a.a().b(splashExpandDialog.e, j, h); com.mbridge.msdk.mbsignalcommon.mraid.a.a().c(splashExpandDialog.e, intValue, intValue2); com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(splashExpandDialog.e, hashMap); com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(splashExpandDialog.e); } catch (Throwable th) { af.b("SplashExpandDialog", "notifyMraid", th); } } }