SplashExpandDialog.java 源代码
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.ColorDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.webkit.ValueCallback;
import android.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.TextView;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.foundation.tools.m;
import com.mbridge.msdk.foundation.tools.q;
import com.mbridge.msdk.mbsignalcommon.windvane.WindVaneWebView;
import java.util.HashMap;
import java.util.List;
import org.json.JSONObject;
public class SplashExpandDialog extends Dialog {
private final String f18535a;
private String f18536b;
private boolean f18537c;
private FrameLayout f18538d;
private WindVaneWebView f18539e;
private TextView f18540f;
private String f18541g;
private List<CampaignEx> f18542h;
private com.mbridge.msdk.splash.d.a f18543i;
private com.mbridge.msdk.mbsignalcommon.mraid.b f18544j;
public SplashExpandDialog(Context context, Bundle bundle, com.mbridge.msdk.splash.d.a aVar) {
super(context);
this.f18535a = "SplashExpandDialog";
this.f18544j = new com.mbridge.msdk.mbsignalcommon.mraid.b() {
@Override
public final void close() {
SplashExpandDialog.this.dismiss();
}
@Override
public final void expand(String str, boolean z6) {
}
@Override
public final void open(String str) {
try {
q.d("SplashExpandDialog", str);
if (SplashExpandDialog.this.f18542h.size() > 1) {
com.mbridge.msdk.foundation.controller.a.e().g().startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
str = null;
}
if (SplashExpandDialog.this.f18543i != null) {
SplashExpandDialog.this.f18543i.a(true, str);
}
} catch (Throwable th) {
q.a("SplashExpandDialog", "open", th);
}
}
@Override
public final void unload() {
close();
}
@Override
public final void useCustomClose(boolean z6) {
int i6;
try {
TextView textView = SplashExpandDialog.this.f18540f;
if (z6) {
i6 = 4;
} else {
i6 = 0;
}
textView.setVisibility(i6);
} catch (Throwable th) {
q.a("SplashExpandDialog", "useCustomClose", th);
}
}
};
if (bundle != null) {
this.f18536b = bundle.getString("url");
this.f18537c = bundle.getBoolean("shouldUseCustomClose");
}
this.f18543i = aVar;
}
@Override
public void dismiss() {
super.dismiss();
}
@Override
protected void onCreate(Bundle bundle) {
int i6;
super.onCreate(bundle);
requestWindowFeature(1);
setCanceledOnTouchOutside(false);
setCancelable(true);
FrameLayout frameLayout = new FrameLayout(getContext());
this.f18538d = frameLayout;
frameLayout.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
WindVaneWebView windVaneWebView = new WindVaneWebView(getContext().getApplicationContext());
this.f18539e = windVaneWebView;
windVaneWebView.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
this.f18538d.addView(this.f18539e);
TextView textView = new TextView(getContext());
this.f18540f = textView;
textView.setBackgroundColor(0);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(96, 96);
layoutParams.gravity = 8388661;
layoutParams.setMargins(30, 30, 30, 30);
this.f18540f.setLayoutParams(layoutParams);
TextView textView2 = this.f18540f;
if (this.f18537c) {
i6 = 4;
} else {
i6 = 0;
}
textView2.setVisibility(i6);
this.f18540f.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
SplashExpandDialog.this.dismiss();
}
});
this.f18538d.addView(this.f18540f);
setContentView(this.f18538d);
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);
}
this.f18539e.setWebViewListener(new com.mbridge.msdk.mbsignalcommon.b.b() {
@Override
public final void a(WebView webView, String str) {
super.a(webView, str);
webView.evaluateJavascript("javascript:" + com.mbridge.msdk.b.b.a.a().b(), new ValueCallback<String>() {
@Override
public final void onReceiveValue(String str2) {
}
});
SplashExpandDialog.a(SplashExpandDialog.this);
}
});
this.f18539e.setObject(this.f18544j);
this.f18539e.loadUrl(this.f18536b);
setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public final void onDismiss(DialogInterface dialogInterface) {
if (SplashExpandDialog.this.f18543i != null) {
SplashExpandDialog.this.f18543i.a(false);
SplashExpandDialog.this.f18543i.a();
}
SplashExpandDialog.this.f18539e.loadDataWithBaseURL(null, "", "text/html", com.anythink.expressad.foundation.f.a.F, null);
SplashExpandDialog.this.f18538d.removeView(SplashExpandDialog.this.f18539e);
SplashExpandDialog.this.f18539e.release();
SplashExpandDialog.this.f18539e = null;
SplashExpandDialog.this.f18543i = null;
}
});
}
public void setCampaignList(String str, List<CampaignEx> list) {
this.f18541g = str;
this.f18542h = list;
}
static void a(SplashExpandDialog splashExpandDialog) {
try {
int i6 = com.mbridge.msdk.foundation.controller.a.e().g().getResources().getConfiguration().orientation;
JSONObject jSONObject = new JSONObject();
jSONObject.put("orientation", i6 == 2 ? "landscape" : i6 == 1 ? "portrait" : "undefined");
jSONObject.put("locked", "true");
float h6 = m.h(com.mbridge.msdk.foundation.controller.a.e().g());
float i7 = m.i(com.mbridge.msdk.foundation.controller.a.e().g());
HashMap j6 = m.j(com.mbridge.msdk.foundation.controller.a.e().g());
int intValue = ((Integer) j6.get("width")).intValue();
int intValue2 = ((Integer) j6.get("height")).intValue();
HashMap hashMap = new HashMap();
hashMap.put(com.anythink.expressad.atsignalcommon.d.a.f3010a, "Interstitial");
hashMap.put("state", com.anythink.expressad.atsignalcommon.d.a.f3016g);
hashMap.put(com.anythink.expressad.atsignalcommon.d.a.f3012c, "true");
hashMap.put(com.anythink.expressad.atsignalcommon.d.a.f3013d, jSONObject);
splashExpandDialog.f18539e.getLocationInWindow(new int[2]);
com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(splashExpandDialog.f18539e, r1[0], r1[1], r11.getWidth(), splashExpandDialog.f18539e.getHeight());
com.mbridge.msdk.mbsignalcommon.mraid.a.a().b(splashExpandDialog.f18539e, r1[0], r1[1], r5.getWidth(), splashExpandDialog.f18539e.getHeight());
com.mbridge.msdk.mbsignalcommon.mraid.a.a().b(splashExpandDialog.f18539e, h6, i7);
com.mbridge.msdk.mbsignalcommon.mraid.a.a().c(splashExpandDialog.f18539e, intValue, intValue2);
com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(splashExpandDialog.f18539e, hashMap);
com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(splashExpandDialog.f18539e);
} catch (Throwable th) {
q.a("SplashExpandDialog", "notifyMraid", th);
}
}
}