- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
520 lines
19 KiB
Java
520 lines
19 KiB
Java
package com.mbridge.msdk.video.bt.module;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.Configuration;
|
|
import android.net.http.SslError;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.text.TextUtils;
|
|
import android.util.AttributeSet;
|
|
import android.util.Base64;
|
|
import android.view.View;
|
|
import android.webkit.SslErrorHandler;
|
|
import android.webkit.WebView;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.ImageView;
|
|
import com.mbridge.msdk.e.b;
|
|
import com.mbridge.msdk.foundation.entity.CampaignEx;
|
|
import com.mbridge.msdk.foundation.same.report.h;
|
|
import com.mbridge.msdk.foundation.tools.af;
|
|
import com.mbridge.msdk.foundation.tools.aj;
|
|
import com.mbridge.msdk.mbsignalcommon.b.a;
|
|
import com.mbridge.msdk.mbsignalcommon.windvane.WindVaneWebView;
|
|
import com.mbridge.msdk.mbsignalcommon.windvane.g;
|
|
import com.mbridge.msdk.out.Campaign;
|
|
import com.mbridge.msdk.video.bt.a.d;
|
|
import com.mbridge.msdk.video.signal.a.k;
|
|
import com.mbridge.msdk.videocommon.d.c;
|
|
import java.util.List;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class MBridgeBTWebView extends MBridgeBTWebViewDiff {
|
|
private String p;
|
|
private String q;
|
|
private String r;
|
|
private boolean s;
|
|
private ImageView t;
|
|
private boolean u;
|
|
private c v;
|
|
private List<CampaignEx> w;
|
|
private WebView x;
|
|
|
|
@Override // com.mbridge.msdk.mbsignalcommon.mraid.b
|
|
public void expand(String str, boolean z) {
|
|
}
|
|
|
|
public List<CampaignEx> getCampaigns() {
|
|
return this.w;
|
|
}
|
|
|
|
public String getFilePath() {
|
|
return this.q;
|
|
}
|
|
|
|
public String getFileURL() {
|
|
return this.p;
|
|
}
|
|
|
|
public String getHtml() {
|
|
return this.r;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.mbsignalcommon.mraid.b
|
|
public CampaignEx getMraidCampaign() {
|
|
return this.b;
|
|
}
|
|
|
|
public c getRewardUnitSetting() {
|
|
return this.v;
|
|
}
|
|
|
|
public WindVaneWebView getWebView() {
|
|
return this.webView;
|
|
}
|
|
|
|
public void setCampaigns(List<CampaignEx> list) {
|
|
this.w = list;
|
|
}
|
|
|
|
public void setCreateWebView(WebView webView) {
|
|
this.x = webView;
|
|
}
|
|
|
|
public void setFilePath(String str) {
|
|
this.q = str;
|
|
}
|
|
|
|
public void setHtml(String str) {
|
|
this.r = str;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.bt.module.BTBaseView
|
|
public void setRewardUnitSetting(c cVar) {
|
|
this.v = cVar;
|
|
}
|
|
|
|
public void setFileURL(String str) {
|
|
this.p = str;
|
|
if (TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
boolean contains = str.contains("play.google.com");
|
|
setWebviewClickable(!contains);
|
|
if (contains) {
|
|
com.mbridge.msdk.mbsignalcommon.base.c cVar = new com.mbridge.msdk.mbsignalcommon.base.c();
|
|
WindVaneWebView windVaneWebView = this.webView;
|
|
if (windVaneWebView != null) {
|
|
windVaneWebView.setFilter(cVar);
|
|
}
|
|
}
|
|
}
|
|
|
|
public MBridgeBTWebView(Context context) {
|
|
super(context);
|
|
this.s = false;
|
|
this.u = false;
|
|
}
|
|
|
|
public MBridgeBTWebView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
this.s = false;
|
|
this.u = false;
|
|
}
|
|
|
|
public void setWebviewClickable(boolean z) {
|
|
WindVaneWebView windVaneWebView = this.webView;
|
|
if (windVaneWebView != null) {
|
|
windVaneWebView.setClickable(z);
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.bt.module.BTBaseView
|
|
public void init(Context context) {
|
|
WindVaneWebView windVaneWebView = new WindVaneWebView(context);
|
|
this.webView = windVaneWebView;
|
|
windVaneWebView.setBackgroundColor(0);
|
|
this.webView.setVisibility(0);
|
|
k kVar = new k(null, this.b, this.w);
|
|
this.jsCommon = kVar;
|
|
kVar.a(this.c);
|
|
if (b.a()) {
|
|
setChinaAlertInstallState(this.jsCommon);
|
|
}
|
|
this.webView.setObject(this.jsCommon);
|
|
this.webView.setMraidObject(this);
|
|
this.webView.setWebViewListener(new a() { // from class: com.mbridge.msdk.video.bt.module.MBridgeBTWebView.1
|
|
@Override // com.mbridge.msdk.mbsignalcommon.b.a
|
|
public final void a(Object obj) {
|
|
super.a(obj);
|
|
try {
|
|
k kVar2 = MBridgeBTWebView.this.jsCommon;
|
|
String str = "";
|
|
String c = kVar2 != null ? kVar2.c() : "";
|
|
if (!TextUtils.isEmpty(c)) {
|
|
str = Base64.encodeToString(c.getBytes(), 2);
|
|
af.a("RVWindVaneWebView", "getEndScreenInfo success");
|
|
} else {
|
|
af.a("RVWindVaneWebView", "getEndScreenInfo failed");
|
|
}
|
|
g.a().a(obj, str);
|
|
} catch (Throwable th) {
|
|
af.a("RVWindVaneWebView", th.getMessage());
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.mbsignalcommon.b.a, com.mbridge.msdk.mbsignalcommon.windvane.d
|
|
public final void a(WebView webView, String str) {
|
|
super.a(webView, str);
|
|
if (MBridgeBTWebView.this.x != null) {
|
|
try {
|
|
JSONObject jSONObject = new JSONObject();
|
|
jSONObject.put("id", MBridgeBTWebView.this.d);
|
|
jSONObject.put("code", BTBaseView.n);
|
|
JSONObject jSONObject2 = new JSONObject();
|
|
jSONObject2.put("id", MBridgeBTWebView.this.d);
|
|
jSONObject2.put("result", 1);
|
|
jSONObject.put("data", jSONObject2);
|
|
g.a().a(MBridgeBTWebView.this.x, "onWebviewLoad", Base64.encodeToString(jSONObject.toString().getBytes(), 2));
|
|
} catch (Exception e) {
|
|
d.c().a(MBridgeBTWebView.this.x, e.getMessage());
|
|
af.a("RVWindVaneWebView", e.getMessage());
|
|
}
|
|
}
|
|
g.a().a(MBridgeBTWebView.this.webView);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.mbsignalcommon.b.a, com.mbridge.msdk.mbsignalcommon.windvane.d
|
|
public final void a(WebView webView, int i, String str, String str2) {
|
|
super.a(webView, i, str, str2);
|
|
if (MBridgeBTWebView.this.x != null) {
|
|
try {
|
|
JSONObject jSONObject = new JSONObject();
|
|
jSONObject.put("id", MBridgeBTWebView.this.d);
|
|
jSONObject.put("code", BTBaseView.n);
|
|
JSONObject jSONObject2 = new JSONObject();
|
|
jSONObject2.put("id", MBridgeBTWebView.this.d);
|
|
jSONObject2.put("result", 2);
|
|
jSONObject2.put("error", str);
|
|
jSONObject.put("data", jSONObject2);
|
|
g.a().a(MBridgeBTWebView.this.x, "onWebviewLoad", Base64.encodeToString(jSONObject.toString().getBytes(), 2));
|
|
} catch (Exception e) {
|
|
d.c().a(MBridgeBTWebView.this.x, e.getMessage());
|
|
af.a("RVWindVaneWebView", e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.mbsignalcommon.b.a, com.mbridge.msdk.mbsignalcommon.windvane.d
|
|
public final void a(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
|
|
super.a(webView, sslErrorHandler, sslError);
|
|
if (MBridgeBTWebView.this.x == null) {
|
|
return;
|
|
}
|
|
try {
|
|
JSONObject jSONObject = new JSONObject();
|
|
jSONObject.put("id", MBridgeBTWebView.this.d);
|
|
jSONObject.put("code", BTBaseView.n);
|
|
JSONObject jSONObject2 = new JSONObject();
|
|
jSONObject2.put("id", MBridgeBTWebView.this.d);
|
|
jSONObject2.put("result", 2);
|
|
throw null;
|
|
} catch (Exception e) {
|
|
d.c().a(MBridgeBTWebView.this.x, e.getMessage());
|
|
af.a("RVWindVaneWebView", e.getMessage());
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.mbsignalcommon.b.a, com.mbridge.msdk.mbsignalcommon.windvane.d
|
|
public final void a(WebView webView, int i) {
|
|
super.a(webView, i);
|
|
}
|
|
});
|
|
addView(this.webView, new FrameLayout.LayoutParams(-1, -1));
|
|
setOnClickListener(new View.OnClickListener() { // from class: com.mbridge.msdk.video.bt.module.MBridgeBTWebView.2
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
if (MBridgeBTWebView.this.x != null) {
|
|
try {
|
|
JSONObject jSONObject = new JSONObject();
|
|
jSONObject.put("code", BTBaseView.n);
|
|
jSONObject.put("id", MBridgeBTWebView.this.d);
|
|
JSONObject jSONObject2 = new JSONObject();
|
|
jSONObject2.put("x", String.valueOf(view.getX()));
|
|
jSONObject2.put("y", String.valueOf(view.getY()));
|
|
jSONObject.put("data", jSONObject2);
|
|
g.a().a(MBridgeBTWebView.this.x, "onClicked", Base64.encodeToString(jSONObject.toString().getBytes(), 2));
|
|
} catch (Exception unused) {
|
|
d.c().a(MBridgeBTWebView.this.x, "onClicked", MBridgeBTWebView.this.d);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
try {
|
|
ImageView imageView = new ImageView(getContext());
|
|
this.t = imageView;
|
|
imageView.setImageResource(findDrawable("mbridge_reward_close"));
|
|
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(96, 96);
|
|
layoutParams.gravity = 8388661;
|
|
layoutParams.setMargins(30, 30, 30, 30);
|
|
this.t.setLayoutParams(layoutParams);
|
|
this.t.setVisibility(this.s ? 4 : 8);
|
|
CampaignEx campaignEx = this.b;
|
|
if (campaignEx != null && campaignEx.isMraid()) {
|
|
this.t.setVisibility(4);
|
|
}
|
|
this.t.setOnClickListener(new View.OnClickListener() { // from class: com.mbridge.msdk.video.bt.module.MBridgeBTWebView.3
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
MBridgeBTWebView.this.close();
|
|
}
|
|
});
|
|
addView(this.t);
|
|
} catch (Throwable th) {
|
|
af.a(BTBaseView.TAG, th.getMessage());
|
|
}
|
|
}
|
|
|
|
public void setWebViewRid(String str) {
|
|
WindVaneWebView windVaneWebView = this.webView;
|
|
if (windVaneWebView != null) {
|
|
windVaneWebView.setRid(str);
|
|
}
|
|
}
|
|
|
|
public void setWebViewLocalRequestId(String str) {
|
|
WindVaneWebView windVaneWebView = this.webView;
|
|
if (windVaneWebView != null) {
|
|
windVaneWebView.setLocalRequestId(str);
|
|
}
|
|
}
|
|
|
|
public void setTempTypeForMetrics(int i) {
|
|
WindVaneWebView windVaneWebView = this.webView;
|
|
if (windVaneWebView != null) {
|
|
windVaneWebView.setTempTypeForMetrics(i);
|
|
}
|
|
}
|
|
|
|
public void preload() {
|
|
if (!TextUtils.isEmpty(this.p)) {
|
|
this.webView.loadUrl(this.p);
|
|
} else if (!TextUtils.isEmpty(this.q)) {
|
|
this.webView.loadUrl(this.q);
|
|
} else {
|
|
if (TextUtils.isEmpty(this.r)) {
|
|
return;
|
|
}
|
|
this.webView.loadDataWithBaseURL("", this.r, "text/html", "UTF-8", null);
|
|
}
|
|
}
|
|
|
|
public void webviewLoad(int i) {
|
|
if (this.jsCommon == null) {
|
|
this.jsCommon = new k(null, this.b, this.w);
|
|
}
|
|
CampaignEx campaignEx = this.b;
|
|
if (campaignEx != null) {
|
|
this.jsCommon.a(campaignEx);
|
|
} else {
|
|
List<CampaignEx> list = this.w;
|
|
if (list != null && list.size() > 0) {
|
|
this.jsCommon.a(this.w);
|
|
if (this.w.size() == 1) {
|
|
this.jsCommon.a(this.w.get(0));
|
|
}
|
|
}
|
|
}
|
|
c cVar = this.v;
|
|
if (cVar != null) {
|
|
this.jsCommon.a(cVar);
|
|
}
|
|
this.jsCommon.a(this.c);
|
|
this.jsCommon.c(this.d);
|
|
if (b.a()) {
|
|
setChinaAlertInstallState(this.jsCommon);
|
|
}
|
|
if (i == 1) {
|
|
this.jsCommon.q();
|
|
}
|
|
WindVaneWebView windVaneWebView = this.webView;
|
|
if (windVaneWebView != null) {
|
|
windVaneWebView.setObject(this.jsCommon);
|
|
}
|
|
CampaignEx campaignEx2 = this.b;
|
|
if (campaignEx2 != null && campaignEx2.isMraid()) {
|
|
this.t.setVisibility(4);
|
|
}
|
|
preload();
|
|
}
|
|
|
|
public boolean webviewReload() {
|
|
WindVaneWebView windVaneWebView = this.webView;
|
|
if (windVaneWebView == null) {
|
|
return false;
|
|
}
|
|
windVaneWebView.reload();
|
|
return true;
|
|
}
|
|
|
|
public boolean webviewGoBack() {
|
|
WindVaneWebView windVaneWebView = this.webView;
|
|
if (windVaneWebView == null || !windVaneWebView.canGoBack()) {
|
|
return false;
|
|
}
|
|
this.webView.goBack();
|
|
return true;
|
|
}
|
|
|
|
public boolean webviewGoForward() {
|
|
WindVaneWebView windVaneWebView = this.webView;
|
|
if (windVaneWebView == null || !windVaneWebView.canGoForward()) {
|
|
return false;
|
|
}
|
|
this.webView.goForward();
|
|
return true;
|
|
}
|
|
|
|
public void broadcast(String str, JSONObject jSONObject) {
|
|
if (this.webView != null) {
|
|
try {
|
|
JSONObject jSONObject2 = new JSONObject();
|
|
jSONObject2.put("code", BTBaseView.n);
|
|
jSONObject2.put("id", this.d);
|
|
jSONObject2.put("eventName", str);
|
|
jSONObject2.put("data", jSONObject);
|
|
g.a().a((WebView) this.webView, "broadcast", Base64.encodeToString(jSONObject2.toString().getBytes(), 2));
|
|
} catch (Exception unused) {
|
|
d.c().a((WebView) this.webView, "broadcast", this.d);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.bt.module.BTBaseView, android.view.View
|
|
public void onConfigurationChanged(Configuration configuration) {
|
|
if (this.webView != null) {
|
|
try {
|
|
JSONObject jSONObject = new JSONObject();
|
|
if (configuration.orientation == 2) {
|
|
jSONObject.put("orientation", "landscape");
|
|
} else {
|
|
jSONObject.put("orientation", "portrait");
|
|
}
|
|
jSONObject.put("instanceId", this.d);
|
|
g.a().a((WebView) this.webView, "orientation", Base64.encodeToString(jSONObject.toString().getBytes(), 2));
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void onBackPressed() {
|
|
if (this.webView != null) {
|
|
d.c().a((WebView) this.webView, "onSystemBackPressed", this.d);
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.bt.module.BTBaseView
|
|
public void onDestory() {
|
|
if (this.u) {
|
|
return;
|
|
}
|
|
this.u = true;
|
|
try {
|
|
if (this.webView != null) {
|
|
d.c().a((WebView) this.webView, "onSystemDestory", this.d);
|
|
}
|
|
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { // from class: com.mbridge.msdk.video.bt.module.MBridgeBTWebView.4
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
try {
|
|
WindVaneWebView windVaneWebView = MBridgeBTWebView.this.webView;
|
|
if (windVaneWebView != null) {
|
|
windVaneWebView.clearWebView();
|
|
MBridgeBTWebView.this.webView.release();
|
|
}
|
|
MBridgeBTWebView.this.p = null;
|
|
MBridgeBTWebView.this.q = null;
|
|
MBridgeBTWebView.this.r = null;
|
|
if (MBridgeBTWebView.this.x != null) {
|
|
MBridgeBTWebView.this.x = null;
|
|
}
|
|
} catch (Throwable th) {
|
|
af.a(BTBaseView.TAG, th.getMessage());
|
|
}
|
|
}
|
|
}, 500L);
|
|
setOnClickListener(null);
|
|
removeAllViews();
|
|
} catch (Throwable th) {
|
|
af.a(BTBaseView.TAG, th.getMessage());
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.bt.module.MBridgeBTWebViewDiff, com.mbridge.msdk.mbsignalcommon.mraid.b
|
|
public void open(String str) {
|
|
try {
|
|
String clickURL = this.b.getClickURL();
|
|
if (!TextUtils.isEmpty(str)) {
|
|
this.b.setClickURL(str);
|
|
reportOpen(str);
|
|
}
|
|
com.mbridge.msdk.click.a aVar = new com.mbridge.msdk.click.a(getContext(), this.c);
|
|
aVar.a(this);
|
|
aVar.a(this.b);
|
|
this.b.setClickURL(clickURL);
|
|
} catch (Throwable th) {
|
|
af.b(BTBaseView.TAG, th.getMessage());
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.bt.module.MBridgeBTWebViewDiff
|
|
public void reportOpen(String str) {
|
|
try {
|
|
CampaignEx mraidCampaign = getMraidCampaign();
|
|
if (mraidCampaign != null) {
|
|
new h(getContext()).a(mraidCampaign.getRequestId(), mraidCampaign.getRequestIdNotice(), mraidCampaign.getId(), this.c, str, this.b.isBidCampaign());
|
|
}
|
|
} catch (Throwable th) {
|
|
af.a(BTBaseView.TAG, th.getMessage());
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.mbsignalcommon.mraid.b
|
|
public void close() {
|
|
WebView webView = this.x;
|
|
if (webView != null) {
|
|
BTBaseView.a(webView, "onPlayerCloseBtnClicked", this.d);
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.mbsignalcommon.mraid.b
|
|
public void unload() {
|
|
close();
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.mbsignalcommon.mraid.b
|
|
public void useCustomClose(boolean z) {
|
|
try {
|
|
this.t.setVisibility(z ? 4 : 0);
|
|
} catch (Throwable th) {
|
|
af.b(BTBaseView.TAG, th.getMessage());
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.out.BaseTrackingListener
|
|
public void onStartRedirection(Campaign campaign, String str) {
|
|
aj.b(campaign, this);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.out.BaseTrackingListener
|
|
public void onFinishRedirection(Campaign campaign, String str) {
|
|
aj.a(campaign, this);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.out.BaseTrackingListener
|
|
public void onRedirectionFailed(Campaign campaign, String str) {
|
|
aj.a(campaign, this);
|
|
}
|
|
}
|