翰林优商.apk(点击下载) / NativeAdvancedExpandDialog.java
package com.mbridge.msdk.advanced.js;
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.Build;
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.advanced.c.a;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.foundation.tools.s;
import com.mbridge.msdk.foundation.tools.w;
import com.mbridge.msdk.mbjscommon.mraid.b;
import com.mbridge.msdk.mbjscommon.windvane.WindVaneWebView;
import java.util.HashMap;
import java.util.List;
import org.json.JSONObject;
public class NativeAdvancedExpandDialog extends Dialog {
private final String a = "NativeAdvancedExpandDialog";
private String b;
private boolean c;
private FrameLayout d;
private WindVaneWebView e;
private TextView f;
private String g;
private List<CampaignEx> h;
private a i;
private b j = new b() {
/* class com.mbridge.msdk.advanced.js.NativeAdvancedExpandDialog.AnonymousClass4 */
@Override // com.mbridge.msdk.mbjscommon.mraid.b
public final void expand(String str, boolean z) {
}
@Override // com.mbridge.msdk.mbjscommon.mraid.b
public final CampaignEx getMraidCampaign() {
return null;
}
@Override // com.mbridge.msdk.mbjscommon.mraid.b
public final void open(String str) {
try {
if (NativeAdvancedExpandDialog.this.e == null || System.currentTimeMillis() - NativeAdvancedExpandDialog.this.e.lastTouchTime <= ((long) com.mbridge.msdk.click.b.a.c) || !com.mbridge.msdk.click.b.a.a((CampaignEx) NativeAdvancedExpandDialog.this.h.get(0), NativeAdvancedExpandDialog.this.e.getUrl(), com.mbridge.msdk.click.b.a.a)) {
w.d("NativeAdvancedExpandDialog", str);
if (NativeAdvancedExpandDialog.this.h.size() > 1) {
com.mbridge.msdk.foundation.controller.a.f().j().startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
str = null;
}
if (NativeAdvancedExpandDialog.this.i != null) {
NativeAdvancedExpandDialog.this.i.a(true, str);
}
}
} catch (Throwable th) {
w.b("NativeAdvancedExpandDialog", "open", th);
}
}
@Override // com.mbridge.msdk.mbjscommon.mraid.b
public final void close() {
NativeAdvancedExpandDialog.this.dismiss();
}
@Override // com.mbridge.msdk.mbjscommon.mraid.b
public final void unload() {
close();
}
@Override // com.mbridge.msdk.mbjscommon.mraid.b
public final void useCustomClose(boolean z) {
try {
NativeAdvancedExpandDialog.this.f.setVisibility(z ? 4 : 0);
} catch (Throwable th) {
w.b("NativeAdvancedExpandDialog", "useCustomClose", th);
}
}
};
public NativeAdvancedExpandDialog(Context context, Bundle bundle, a aVar) {
super(context);
if (bundle != null) {
this.b = bundle.getString("url");
this.c = bundle.getBoolean("shouldUseCustomClose");
}
this.i = aVar;
}
/* access modifiers changed from: protected */
public void onCreate(Bundle bundle) {
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() {
/* class com.mbridge.msdk.advanced.js.NativeAdvancedExpandDialog.AnonymousClass1 */
public final void onClick(View view) {
NativeAdvancedExpandDialog.this.dismiss();
}
});
this.d.addView(this.f);
setContentView(this.d);
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);
if (Build.VERSION.SDK_INT >= 16) {
int i2 = 519;
if (Build.VERSION.SDK_INT >= 19) {
i2 = 4615;
}
getWindow().getDecorView().setSystemUiVisibility(i2);
}
}
this.e.setWebViewListener(new com.mbridge.msdk.mbjscommon.c.b() {
/* class com.mbridge.msdk.advanced.js.NativeAdvancedExpandDialog.AnonymousClass2 */
@Override // com.mbridge.msdk.mbjscommon.c.b, com.mbridge.msdk.mbjscommon.windvane.d
public final void a(WebView webView, String str) {
super.a(webView, str);
StringBuilder sb = new StringBuilder("javascript:");
sb.append(com.mbridge.msdk.c.b.b.a().b());
if (Build.VERSION.SDK_INT <= 19) {
webView.loadUrl(sb.toString());
} else {
webView.evaluateJavascript(sb.toString(), new ValueCallback<String>() {
/* class com.mbridge.msdk.advanced.js.NativeAdvancedExpandDialog.AnonymousClass2.AnonymousClass1 */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // android.webkit.ValueCallback
public final /* bridge */ /* synthetic */ void onReceiveValue(String str) {
}
});
}
NativeAdvancedExpandDialog.a(NativeAdvancedExpandDialog.this);
}
});
this.e.setObject(this.j);
this.e.loadUrl(this.b);
setOnDismissListener(new DialogInterface.OnDismissListener() {
/* class com.mbridge.msdk.advanced.js.NativeAdvancedExpandDialog.AnonymousClass3 */
public final void onDismiss(DialogInterface dialogInterface) {
if (NativeAdvancedExpandDialog.this.i != null) {
NativeAdvancedExpandDialog.this.i.a(false);
}
NativeAdvancedExpandDialog.this.e.loadDataWithBaseURL(null, "", "text/html", "utf-8", null);
NativeAdvancedExpandDialog.this.d.removeView(NativeAdvancedExpandDialog.this.e);
NativeAdvancedExpandDialog.this.e.release();
NativeAdvancedExpandDialog.this.e = null;
NativeAdvancedExpandDialog.this.i = null;
}
});
}
public void setCampaignList(String str, List<CampaignEx> list) {
this.g = str;
this.h = list;
}
public void dismiss() {
super.dismiss();
}
static /* synthetic */ void a(NativeAdvancedExpandDialog nativeAdvancedExpandDialog) {
try {
int i2 = com.mbridge.msdk.foundation.controller.a.f().j().getResources().getConfiguration().orientation;
JSONObject jSONObject = new JSONObject();
jSONObject.put("orientation", i2 == 2 ? "landscape" : i2 == 1 ? "portrait" : "undefined");
jSONObject.put("locked", "true");
HashMap z = s.z(com.mbridge.msdk.foundation.controller.a.f().j());
int intValue = ((Integer) z.get("width")).intValue();
int intValue2 = ((Integer) z.get("height")).intValue();
HashMap hashMap = new HashMap();
hashMap.put("placementType", "inline");
hashMap.put("state", "expanded");
hashMap.put("viewable", "true");
hashMap.put("currentAppOrientation", jSONObject);
int[] iArr = new int[2];
nativeAdvancedExpandDialog.e.getLocationInWindow(iArr);
com.mbridge.msdk.mbjscommon.mraid.a a2 = com.mbridge.msdk.mbjscommon.mraid.a.a();
WindVaneWebView windVaneWebView = nativeAdvancedExpandDialog.e;
a2.a(windVaneWebView, (float) iArr[0], (float) iArr[1], (float) windVaneWebView.getWidth(), (float) nativeAdvancedExpandDialog.e.getHeight());
com.mbridge.msdk.mbjscommon.mraid.a a3 = com.mbridge.msdk.mbjscommon.mraid.a.a();
WindVaneWebView windVaneWebView2 = nativeAdvancedExpandDialog.e;
a3.b(windVaneWebView2, (float) iArr[0], (float) iArr[1], (float) windVaneWebView2.getWidth(), (float) nativeAdvancedExpandDialog.e.getHeight());
com.mbridge.msdk.mbjscommon.mraid.a.a().b(nativeAdvancedExpandDialog.e, (float) s.x(com.mbridge.msdk.foundation.controller.a.f().j()), (float) s.y(com.mbridge.msdk.foundation.controller.a.f().j()));
com.mbridge.msdk.mbjscommon.mraid.a.a().c(nativeAdvancedExpandDialog.e, (float) intValue, (float) intValue2);
com.mbridge.msdk.mbjscommon.mraid.a.a().a(nativeAdvancedExpandDialog.e, hashMap);
com.mbridge.msdk.mbjscommon.mraid.a.a().a(nativeAdvancedExpandDialog.e);
} catch (Throwable th) {
w.b("NativeAdvancedExpandDialog", "notifyMraid", th);
}
}
}