package com.mbridge.msdk.video.module; import android.content.Context; import android.text.TextUtils; import android.util.AttributeSet; import android.webkit.WebView; import android.widget.RelativeLayout; import com.mbridge.msdk.foundation.controller.a; import com.mbridge.msdk.foundation.download.download.H5DownLoadManager; import com.mbridge.msdk.foundation.download.download.HTMLResourceManager; import com.mbridge.msdk.foundation.same.report.e; import com.mbridge.msdk.foundation.tools.w; import com.mbridge.msdk.foundation.webview.BrowserView; import com.mbridge.msdk.mbjscommon.windvane.h; import com.mbridge.msdk.videocommon.d.b; import com.mbridge.msdk.videocommon.d.c; public class MBridgeAlertWebview extends MBridgeH5EndCardView { private String x; public MBridgeAlertWebview(Context context) { super(context); } public MBridgeAlertWebview(Context context, AttributeSet attributeSet) { super(context, attributeSet); } /* access modifiers changed from: protected */ @Override // com.mbridge.msdk.video.module.MBridgeH5EndCardView public final String a() { if (TextUtils.isEmpty(this.u)) { return ""; } b.a().a(a.f().k(), this.u, false); String str = c.a; this.x = str; return !TextUtils.isEmpty(str) ? H5DownLoadManager.getInstance().getH5ResAddress(this.x) : ""; } @Override // com.mbridge.msdk.video.module.MBridgeH5EndCardView public void preLoadData(com.mbridge.msdk.video.js.factory.b bVar) { String a = a(); if (!this.f || this.b == null || TextUtils.isEmpty(a)) { this.e.a(101, ""); return; } BrowserView.MBDownloadListener mBDownloadListener = new BrowserView.MBDownloadListener(this.b); mBDownloadListener.setTitle(this.b.getAppName()); this.p.setDownloadListener(mBDownloadListener); this.p.setCampaignId(this.b.getId()); setCloseVisible(8); this.p.setApiManagerJSFactory(bVar); this.p.setWebViewListener(new com.mbridge.msdk.mbjscommon.c.b() { /* class com.mbridge.msdk.video.module.MBridgeAlertWebview.AnonymousClass1 */ @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); w.d("MBridgeAlertWebview", "===========finish+" + str); h.a().a(webView, "onJSBridgeConnected", ""); } @Override // com.mbridge.msdk.mbjscommon.c.b, com.mbridge.msdk.mbjscommon.windvane.d public final void a(WebView webView, int i, String str, String str2) { super.a(webView, i, str, str2); w.d("MBridgeAlertWebview", "===========onReceivedError"); if (!MBridgeAlertWebview.this.t) { w.a(MBridgeBaseView.TAG, "onReceivedError,url:" + str2); e.a(MBridgeAlertWebview.this.a, MBridgeAlertWebview.this.b, MBridgeAlertWebview.this.x, MBridgeAlertWebview.this.u, 2, str, 1); MBridgeAlertWebview.this.t = true; } } @Override // com.mbridge.msdk.mbjscommon.c.b, com.mbridge.msdk.mbjscommon.windvane.d public final void a(WebView webView, int i) { String str; super.a(webView, i); w.d("MBridgeAlertWebview", "===========readyState : " + i); if (!MBridgeAlertWebview.this.t) { MBridgeAlertWebview mBridgeAlertWebview = MBridgeAlertWebview.this; boolean z = true; if (i != 1) { z = false; } mBridgeAlertWebview.s = z; if (MBridgeAlertWebview.this.s) { str = "readyState state is " + i; } else { str = ""; } e.a(MBridgeAlertWebview.this.a, MBridgeAlertWebview.this.b, MBridgeAlertWebview.this.x, MBridgeAlertWebview.this.u, i, str, 1); } } }); setHtmlSource(HTMLResourceManager.getInstance().getHtmlContentFromUrl(a)); this.s = false; if (TextUtils.isEmpty(this.r)) { w.a(MBridgeBaseView.TAG, "load url:" + a); this.p.loadUrl(a); } else { w.a(MBridgeBaseView.TAG, "load html..."); this.p.loadDataWithBaseURL(a, this.r, "text/html", "UTF-8", null); } this.p.setBackgroundColor(0); setBackgroundColor(0); } @Override // com.mbridge.msdk.video.module.MBridgeH5EndCardView public void webviewshow() { if (this.n != null) { this.n.setBackgroundColor(0); } super.webviewshow(); e.a(this.a, this.b, this.x, this.u, 2, 1); } /* access modifiers changed from: protected */ @Override // com.mbridge.msdk.video.module.MBridgeH5EndCardView public final RelativeLayout.LayoutParams b() { RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1); layoutParams.addRule(13, -1); return layoutParams; } }