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.c; import com.mbridge.msdk.foundation.same.g.a; import com.mbridge.msdk.foundation.same.report.i; import com.mbridge.msdk.foundation.tools.af; import com.mbridge.msdk.mbsignalcommon.windvane.g; import com.mbridge.msdk.videocommon.d.b; import com.mbridge.msdk.videocommon.download.d; import com.mbridge.msdk.videocommon.download.e; /* loaded from: classes4.dex */ public class MBridgeAlertWebview extends MBridgeH5EndCardView { private String w; public MBridgeAlertWebview(Context context) { super(context); } public MBridgeAlertWebview(Context context, AttributeSet attributeSet) { super(context, attributeSet); } @Override // com.mbridge.msdk.video.module.MBridgeH5EndCardView public final String a() { if (TextUtils.isEmpty(this.unitId)) { return ""; } b.a().a(c.m().k(), this.unitId, false); String str = com.mbridge.msdk.videocommon.d.c.a; this.w = str; return !TextUtils.isEmpty(str) ? d.a().a(this.w) : ""; } @Override // com.mbridge.msdk.video.module.MBridgeH5EndCardView public void preLoadData(com.mbridge.msdk.video.signal.factory.b bVar) { String a = a(); if (this.e && this.b != null && !TextUtils.isEmpty(a)) { a aVar = new a(this.b); aVar.a(this.b.getAppName()); this.p.setDownloadListener(aVar); this.p.setCampaignId(this.b.getId()); setCloseVisible(8); this.p.setApiManagerJSFactory(bVar); this.p.setWebViewListener(new com.mbridge.msdk.mbsignalcommon.b.b() { // from class: com.mbridge.msdk.video.module.MBridgeAlertWebview.1 @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); af.b("MBridgeAlertWebview", "finish+" + str); g.a().a(webView); } @Override // com.mbridge.msdk.mbsignalcommon.b.b, com.mbridge.msdk.mbsignalcommon.windvane.d public final void a(WebView webView, int i, String str, String str2) { super.a(webView, i, str, str2); af.b("MBridgeAlertWebview", "onReceivedError"); if (MBridgeAlertWebview.this.t) { return; } af.a(MBridgeBaseView.TAG, "onReceivedError,url:" + str2); MBridgeAlertWebview mBridgeAlertWebview = MBridgeAlertWebview.this; i.a(mBridgeAlertWebview.a, mBridgeAlertWebview.b, mBridgeAlertWebview.w, MBridgeAlertWebview.this.unitId, 2, str, 1); MBridgeAlertWebview.this.t = true; } @Override // com.mbridge.msdk.mbsignalcommon.b.b, com.mbridge.msdk.mbsignalcommon.windvane.d public final void a(WebView webView, int i) { String str; super.a(webView, i); af.b("MBridgeAlertWebview", "readyState : " + i); MBridgeAlertWebview mBridgeAlertWebview = MBridgeAlertWebview.this; if (mBridgeAlertWebview.t) { return; } boolean z = i == 1; mBridgeAlertWebview.s = z; if (z) { str = "readyState state is " + i; } else { str = ""; } String str2 = str; MBridgeAlertWebview mBridgeAlertWebview2 = MBridgeAlertWebview.this; i.a(mBridgeAlertWebview2.a, mBridgeAlertWebview2.b, mBridgeAlertWebview2.w, MBridgeAlertWebview.this.unitId, i, str2, 1); } }); setHtmlSource(e.a().b(a)); this.s = false; if (TextUtils.isEmpty(this.r)) { af.a(MBridgeBaseView.TAG, "load url:" + a); this.p.loadUrl(a); } else { af.a(MBridgeBaseView.TAG, "load html..."); this.p.loadDataWithBaseURL(a, this.r, "text/html", "UTF-8", null); } this.p.setBackgroundColor(0); setBackgroundColor(0); return; } this.notifyListener.a(101, ""); } @Override // com.mbridge.msdk.video.module.MBridgeH5EndCardView public void webviewshow() { RelativeLayout relativeLayout = this.n; if (relativeLayout != null) { relativeLayout.setBackgroundColor(0); } super.webviewshow(); i.a(this.a, this.b, this.w, this.unitId, 2, 1); } @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; } }