360 Wi-Fi v1.0.1版本的 MD5 值为:53dc85b63eb655b13344ce30ddaccae2
以下内容为反编译后的 c.java 源代码,内容仅作参考
package sg.bigo.ads.ad.banner;
import android.app.Activity;
import android.content.Context;
import android.os.Handler;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.webkit.URLUtil;
import android.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.mbridge.msdk.playercommon.exoplayer2.extractor.ts.PsExtractor;
import com.my.target.common.models.IAdLoadingError;
import java.lang.ref.WeakReference;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONException;
import org.json.JSONObject;
import sg.bigo.ads.R;
import sg.bigo.ads.ad.banner.b;
import sg.bigo.ads.api.Ad;
import sg.bigo.ads.api.AdOptionsView;
import sg.bigo.ads.api.a.g;
import sg.bigo.ads.api.b.a;
import sg.bigo.ads.api.core.c;
import sg.bigo.ads.api.core.i;
import sg.bigo.ads.api.core.l;
import sg.bigo.ads.common.h;
import sg.bigo.ads.common.utils.q;
import sg.bigo.ads.common.utils.t;
import sg.bigo.ads.common.utils.u;
import sg.bigo.ads.core.b.c;
import sg.bigo.ads.core.g.b;
import sg.bigo.ads.core.mraid.c;
import sg.bigo.ads.core.mraid.e;
import sg.bigo.ads.core.mraid.n;
public final class c<T extends Ad> implements b.InterfaceC0307b {
WebView a;
a c;
Runnable g;
sg.bigo.ads.core.b.b h;
f f5422i;
final Context j;
final T k;
final i f5423l;
final boolean m;
public WeakReference<Activity> o;
@Nullable
AdOptionsView p;
@Nullable
View q;
boolean r;
private sg.bigo.ads.core.mraid.e s;
private View t;
@NonNull
private final n u;
public int b = 1;
boolean d = false;
boolean e = false;
boolean f = false;
private boolean v = false;
private final View.OnAttachStateChangeListener w = new View.OnAttachStateChangeListener() {
@Override
public final void onViewAttachedToWindow(View view) {
b.e(c.this);
}
@Override
public final void onViewDetachedFromWindow(View view) {
b.f(c.this);
view.removeOnAttachStateChangeListener(this);
}
};
final AtomicBoolean n = new AtomicBoolean(false);
public static class a implements a.b {
private a.b c;
private boolean b = false;
Handler a = new Handler();
public a(a.b bVar) {
this.c = bVar;
}
private boolean c() {
if (this.b) {
return true;
}
this.a.removeCallbacks(null);
this.b = true;
return false;
}
public final void a() {
a(new sg.bigo.ads.api.core.d(IAdLoadingError.LoadErrorType.BANNER_HAS_NO_IMAGE, 10102, "Adx media load error because of destroying before loaded"));
}
@Override
public final void b() {
a.b bVar;
if (c() || (bVar = this.c) == null) {
return;
}
bVar.b();
}
@Override
public final void a(sg.bigo.ads.api.core.d dVar) {
a.b bVar;
if (c() || (bVar = this.c) == null) {
return;
}
bVar.a(dVar);
}
}
public c(Context context, T t, i iVar, @NonNull n nVar, f fVar, boolean z) {
this.j = context;
this.k = t;
this.f5423l = iVar;
this.u = nVar;
this.f5422i = fVar;
this.m = z;
}
public static TextView a(Context context, boolean z) {
if (z) {
TextView textView = new TextView(context);
textView.setText(sg.bigo.ads.common.utils.a.a(context, R.string.ad, new Object[0]));
textView.setBackgroundResource(R.drawable.bigo_ad_bg_ad_tag_white_border);
textView.setTextColor(q.b("#B2FFFFFF", -1));
textView.setTextSize(9.0f);
textView.setMaxLines(1);
textView.setEllipsize(TextUtils.TruncateAt.END);
textView.setPadding(sg.bigo.ads.common.utils.e.a(context, 3), sg.bigo.ads.common.utils.e.a(context, 1), sg.bigo.ads.common.utils.e.a(context, 3), sg.bigo.ads.common.utils.e.a(context, 1));
return textView;
}
return null;
}
@NonNull
public final View b() {
if (this.t == null) {
sg.bigo.ads.common.n.a.a(2, "BannerAd", "The banner ad is not ready, an empty view will be retrieved.");
this.t = new FrameLayout(this.j);
}
b.d(this);
this.t.addOnAttachStateChangeListener(this.w);
return this.t;
}
public final String c() {
i iVar = this.f5423l;
return iVar != null ? iVar.y() : "";
}
public final void d() {
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "performImpression");
b.g(this);
T t = this.k;
if (t instanceof d) {
((d) t).a(b.i(this));
}
if (this.d) {
return;
}
this.d = true;
if (this.e) {
f();
e();
sg.bigo.ads.core.b.b bVar = this.h;
if (bVar != null) {
bVar.a();
}
}
}
public final void e() {
if (this.a != null) {
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "javascript:onViewImpression()");
this.a.loadUrl("javascript:onViewImpression()");
}
}
public final void f() {
final WebView webView = this.a;
if (this.v || !(webView instanceof sg.bigo.ads.core.g.b)) {
return;
}
this.v = true;
sg.bigo.ads.common.i.c.a(1, new Runnable() {
@Override
public final void run() {
b.C0361b c0361b;
long j;
long j2;
long j3;
long j4;
long j5;
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "Notify webView performance stat.");
sg.bigo.ads.core.g.b bVar = (sg.bigo.ads.core.g.b) webView;
if (g.a.m().a(0) || g.a.m().a(1)) {
b.C0361b c0361b2 = bVar.c;
sg.bigo.ads.core.g.b.a(c0361b2);
if (g.a.m().a(1)) {
if (bVar.d == null) {
bVar.d = new b.c(bVar, (byte) 0);
}
long elapsedRealtime = SystemClock.elapsedRealtime();
c0361b2.d = bVar.d.a();
c0361b2.g = SystemClock.elapsedRealtime() - elapsedRealtime;
c0361b2.f = SystemClock.elapsedRealtime();
}
c0361b = c0361b2;
} else {
c0361b = null;
}
if (c0361b != null) {
Boolean bool = c0361b.c;
if (bool == null && c0361b.d == null) {
return;
}
Boolean bool2 = c0361b.d;
if (bool != null) {
long j6 = bool.booleanValue() ? 1L : 0L;
j2 = b.a(c.this, c0361b.e);
j = j6;
} else {
j = -1;
j2 = -1;
}
if (bool2 != null) {
long j7 = bool2.booleanValue() ? 1L : 0L;
long j8 = c0361b.g;
j4 = b.a(c.this, c0361b.f);
j3 = j7;
j5 = j8;
} else {
j3 = -1;
j4 = -1;
j5 = -1;
}
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "Stat check blank resutl.");
sg.bigo.ads.core.c.a.a(c.this.f5423l, j, j2, j3, j4, j5);
}
}
});
}
public static TextView a(Context context, boolean z, String str) {
if (!z || q.a((CharSequence) str)) {
return null;
}
TextView textView = new TextView(context);
textView.setText(str);
textView.setBackgroundResource(R.drawable.bigo_ad_advertiser_background);
textView.setTextColor(-1);
textView.setTextSize(9.0f);
textView.setMaxLines(1);
textView.setEllipsize(TextUtils.TruncateAt.END);
textView.setMaxWidth(sg.bigo.ads.common.utils.e.a(context, PsExtractor.VIDEO_STREAM_MASK));
textView.setBackgroundColor(q.b("#FFD6D9DB", -7829368));
textView.setPadding(sg.bigo.ads.common.utils.e.a(context, 4), sg.bigo.ads.common.utils.e.a(context, 1), sg.bigo.ads.common.utils.e.a(context, 4), sg.bigo.ads.common.utils.e.a(context, 1));
return textView;
}
private boolean c(@Nullable final a.b bVar) {
final FrameLayout frameLayout;
ViewTreeObserver viewTreeObserver;
ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener;
i iVar = this.f5423l;
if (iVar == null) {
return false;
}
if (iVar.ao() == null || TextUtils.isEmpty(this.f5423l.ao().c())) {
sg.bigo.ads.core.c.a.a(this.f5423l, (int) IAdLoadingError.LoadErrorType.BANNER_HAS_NO_IMAGE, 10104, "Banner with no data");
return false;
}
if (this.s == null) {
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "new controller");
try {
this.s = new sg.bigo.ads.core.mraid.e(sg.bigo.ads.common.d.a.a, this.u);
} catch (NoClassDefFoundError unused) {
sg.bigo.ads.common.n.a.a(0, "BannerAd", "Server Banner is not support");
}
if (this.s == null) {
return false;
}
if (this.p == null) {
this.p = new AdOptionsView(this.j);
}
this.s.g = new e.a() {
@Override
public final void a() {
c cVar = c.this;
cVar.e = true;
cVar.f = false;
Runnable runnable = cVar.g;
if (runnable != null) {
runnable.run();
}
a.b bVar2 = bVar;
if (bVar2 != null) {
bVar2.b();
}
c cVar2 = c.this;
WebView webView = cVar2.a;
if (webView != null && cVar2.m) {
webView.loadUrl("javascript:" + sg.bigo.ads.common.utils.i.a);
}
c cVar3 = c.this;
sg.bigo.ads.core.b.c a2 = c.a.a();
c cVar4 = c.this;
cVar3.h = a2.a(cVar4.a, cVar4.p, cVar4.q);
c cVar5 = c.this;
if (cVar5.d) {
cVar5.f();
c.this.e();
sg.bigo.ads.core.b.b bVar3 = c.this.h;
if (bVar3 != null) {
bVar3.a();
}
}
b.b(c.this);
}
@Override
public final void b() {
c.this.f = false;
a.b bVar2 = bVar;
if (bVar2 != null) {
bVar2.a(new sg.bigo.ads.api.core.d(IAdLoadingError.LoadErrorType.BANNER_HAS_NO_IMAGE, 10102, "Adx media load error"));
}
b.c(c.this);
}
@Override
public final void c() {
}
@Override
public final void d() {
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "onExpand");
}
@Override
public final void e() {
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "onResize");
}
@Override
public final void f() {
}
@Override
public final void g() {
f fVar = c.this.f5422i;
if (fVar != null) {
fVar.a();
}
}
@Override
public final void a(String str, String str2) {
char c;
c cVar = c.this;
if (!TextUtils.equals(str, "om_adEvent")) {
if (TextUtils.equals(str, "om_errorEvent")) {
try {
if (TextUtils.equals(new JSONObject(str2).optString("type"), "om_adEvent")) {
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "notifyCustomJsExecuteError.");
f fVar = cVar.f5422i;
if (fVar != null) {
fVar.b();
return;
}
return;
}
return;
} catch (JSONException unused2) {
return;
}
}
return;
}
try {
JSONObject jSONObject = new JSONObject(str2);
String optString = jSONObject.optString("adSessionId");
String optString2 = jSONObject.optString("type");
int hashCode = optString2.hashCode();
if (hashCode == -1097519099) {
if (optString2.equals("loaded")) {
c = 0;
if (c != 0) {
}
}
c = 65535;
if (c != 0) {
}
} else if (hashCode != 10775234) {
if (hashCode == 120623625 && optString2.equals("impression")) {
c = 2;
if (c != 0) {
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "notifyCustomJsOmLoadedEvent, adSessionId=".concat(String.valueOf(optString)));
return;
} else if (c != 1) {
return;
} else {
JSONObject optJSONObject = jSONObject.optJSONObject("data");
if (cVar.n.get()) {
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "notifyCustomJsOmGeometryChange return, already called.");
return;
} else if (cVar.f5422i == null) {
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "notifyCustomJsOmGeometryChange return, mListener is null, adSessionId=" + optString + ", dataJson=" + optJSONObject);
return;
} else if (optJSONObject == null) {
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "notifyCustomJsOmGeometryChange return, dataJson is null, adSessionId=".concat(String.valueOf(optString)));
return;
} else {
JSONObject optJSONObject2 = optJSONObject.optJSONObject("adView");
if (optJSONObject2 == null) {
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "notifyCustomJsOmGeometryChange return, adViewJson is null, adSessionId=" + optString + ", dataJson=" + optJSONObject);
return;
}
JSONObject optJSONObject3 = optJSONObject2.optJSONObject("onScreenGeometry");
if (optJSONObject3 == null) {
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "notifyCustomJsOmGeometryChange return, onScreenGeometryJson is null, adSessionId=" + optString + ", dataJson=" + optJSONObject);
return;
}
double optDouble = optJSONObject3.optDouble("pixels", 0.0d);
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "notifyCustomJsOmGeometryChange, adSessionId=" + optString + ", pixels=" + optDouble);
if (optDouble > 0.0d) {
cVar.n.set(true);
cVar.f5422i.a(optString);
return;
}
return;
}
}
}
c = 65535;
if (c != 0) {
}
} else {
if (optString2.equals("geometryChange")) {
c = 1;
if (c != 0) {
}
}
c = 65535;
if (c != 0) {
}
}
} catch (JSONException unused3) {
}
}
@Override
public final boolean b(Activity activity, int i2) {
return false;
}
@Override
public final void a(@NonNull String str, @Nullable h hVar) {
sg.bigo.ads.api.core.e a2 = c.this.a(str);
f fVar = c.this.f5422i;
if (fVar != null) {
fVar.a(hVar, a2);
}
}
@Override
public final boolean a(Activity activity, int i2) {
return false;
}
};
this.s.j.d = !this.f5423l.d().t();
String c = this.f5423l.ao().c();
e.d dVar = new e.d() {
@Override
public final void a() {
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "onReady");
}
};
if (URLUtil.isNetworkUrl(c)) {
sg.bigo.ads.core.mraid.e eVar = this.s;
eVar.a(dVar);
eVar.j.b(c);
} else {
String d = c.a.a().d(c);
sg.bigo.ads.core.g.a k = sg.bigo.ads.core.g.a.k();
if (g.a.m().a(0)) {
String str = k.a;
String[] strArr = TextUtils.isEmpty(str) ? new String[]{"insertFromHead\n<script>(function () {\n //add listener error\n window.addEventListener('error', function (e) {\n if (e) {\n var target = e.target || e.srcElement;\n var isElementTarget = target instanceof HTMLElement;\n if (isElementTarget) {\n var url = target.href || target.src;\n var width = parseInt(window.getComputedStyle(target).width);\n var height = parseInt(window.getComputedStyle(target).height);\n var errorInfo = { \"url\": url, \"w\": width, \"h\": height };\n //object格式 { \"act\": \"error\", \"type\": e.type, \"target\": e.target.nodeName, \"url\": \"http://testhehe.com/test\", \"w\": 20, \"h\": 20}\n var object = { \"act\": \"error\", \"type\": e.type, \"target\": e.target.nodeName, \"url\": url };\n if (width) object[\"w\"] = width;\n if (height) object[\"h\"] = height;\n window.bigossp.webCollect(JSON.stringify(object));\n }\n }\n }, true);\n }());\n</script>\n", "insertFromHead\n<script>\n window.addEventListener('load', function (d) {\n let backgroundDivs = Array.from(document.querySelectorAll('div'));\n var backgroundImags = [];\n backgroundDivs.forEach(div => {\n let imgUrl = window.getComputedStyle(div).backgroundImage.match(/url\\([\"']?(.*)[\"']?\\)/)\n if (!imgUrl) imgUrl = window.getComputedStyle(div, ':before').backgroundImage.match(/url\\([\"']?(.*)[\"']?\\)/);\n if (!imgUrl) imgUrl = window.getComputedStyle(div, ':after').backgroundImage.match(/url\\([\"']?(.*)[\"']?\\)/);\n if (imgUrl) {\n var object = { \"act\": \"stash\", \"type\": \"mayError\", \"target\": \"background-image\", \"url\": imgUrl[1]};\n backgroundImags.push(object);\n }\n });\n // console.log('webCollect: ' + JSON.stringify(backgroundImags));\n window.bigossp.webCollect(JSON.stringify(backgroundImags));\n });\n</script>", "\n<script type=\"text/javascript\">\n var object = { \"act\": \"notify\", \"type\": \"render_start\" };\n window.bigossp.webCollect(JSON.stringify(object));\n var imgs = document.images;\n for (i = 0; i < imgs.length; i++) {\n var img = imgs[i];\n if (!checkImgForBigo(img)) {\n img.addEventListener(\"load\", function () {\n checkImgForBigo(img)\n })\n }\n }\n function checkImgForBigo(img) {\n if (img.naturalWidth * img.naturalHeight >= 900 && img.offsetWidth * img.offsetHeight >= 900) {\n var object = { \"act\": \"notify\", \"type\": \"render\", \"target\": \"IMG\", \"url\": img.src, \"w\": img.width, \"h\": img.height };\n // console.log(\"notify render result: \" + JSON.stringify(object));\n window.bigossp.webCollect(JSON.stringify(object));\n return true;\n }\n return false;\n }\n</script>"} : str.startsWith("keepOldJs") ? new String[]{"insertFromHead\n<script>(function () {\n //add listener error\n window.addEventListener('error', function (e) {\n if (e) {\n var target = e.target || e.srcElement;\n var isElementTarget = target instanceof HTMLElement;\n if (isElementTarget) {\n var url = target.href || target.src;\n var width = parseInt(window.getComputedStyle(target).width);\n var height = parseInt(window.getComputedStyle(target).height);\n var errorInfo = { \"url\": url, \"w\": width, \"h\": height };\n //object格式 { \"act\": \"error\", \"type\": e.type, \"target\": e.target.nodeName, \"url\": \"http://testhehe.com/test\", \"w\": 20, \"h\": 20}\n var object = { \"act\": \"error\", \"type\": e.type, \"target\": e.target.nodeName, \"url\": url };\n if (width) object[\"w\"] = width;\n if (height) object[\"h\"] = height;\n window.bigossp.webCollect(JSON.stringify(object));\n }\n }\n }, true);\n }());\n</script>\n", "insertFromHead\n<script>\n window.addEventListener('load', function (d) {\n let backgroundDivs = Array.from(document.querySelectorAll('div'));\n var backgroundImags = [];\n backgroundDivs.forEach(div => {\n let imgUrl = window.getComputedStyle(div).backgroundImage.match(/url\\([\"']?(.*)[\"']?\\)/)\n if (!imgUrl) imgUrl = window.getComputedStyle(div, ':before').backgroundImage.match(/url\\([\"']?(.*)[\"']?\\)/);\n if (!imgUrl) imgUrl = window.getComputedStyle(div, ':after').backgroundImage.match(/url\\([\"']?(.*)[\"']?\\)/);\n if (imgUrl) {\n var object = { \"act\": \"stash\", \"type\": \"mayError\", \"target\": \"background-image\", \"url\": imgUrl[1]};\n backgroundImags.push(object);\n }\n });\n // console.log('webCollect: ' + JSON.stringify(backgroundImags));\n window.bigossp.webCollect(JSON.stringify(backgroundImags));\n });\n</script>", "\n<script type=\"text/javascript\">\n var object = { \"act\": \"notify\", \"type\": \"render_start\" };\n window.bigossp.webCollect(JSON.stringify(object));\n var imgs = document.images;\n for (i = 0; i < imgs.length; i++) {\n var img = imgs[i];\n if (!checkImgForBigo(img)) {\n img.addEventListener(\"load\", function () {\n checkImgForBigo(img)\n })\n }\n }\n function checkImgForBigo(img) {\n if (img.naturalWidth * img.naturalHeight >= 900 && img.offsetWidth * img.offsetHeight >= 900) {\n var object = { \"act\": \"notify\", \"type\": \"render\", \"target\": \"IMG\", \"url\": img.src, \"w\": img.width, \"h\": img.height };\n // console.log(\"notify render result: \" + JSON.stringify(object));\n window.bigossp.webCollect(JSON.stringify(object));\n return true;\n }\n return false;\n }\n</script>", str.substring(9)} : new String[]{str};
if (strArr.length != 0) {
StringBuilder sb = new StringBuilder(d);
for (String str2 : strArr) {
if (!TextUtils.isEmpty(str2)) {
if (str2.startsWith("insertFromHead")) {
sb.insert(0, str2.substring(14) + "\n");
} else {
sb.append("\n");
sb.append(str2);
}
}
}
d = sb.toString();
}
}
this.s.a(d, dVar);
}
this.f = true;
t.a();
}
c.C0364c b = this.s.b();
this.a = b;
if (b != null) {
b.setOverScrollMode(2);
this.a.setHorizontalScrollBarEnabled(false);
this.a.setHorizontalScrollbarOverlay(false);
this.a.setVerticalScrollBarEnabled(false);
this.a.setVerticalScrollbarOverlay(false);
this.a.getSettings().setSupportZoom(false);
ViewParent parent = this.a.getParent();
if (parent instanceof ViewGroup) {
View view = (View) parent;
Context context = this.j;
if (context == null) {
context = sg.bigo.ads.common.d.a.a;
}
View view2 = this.t;
if ((view2 instanceof FrameLayout) && ((FrameLayout) view2).getChildCount() == 0) {
frameLayout = (FrameLayout) this.t;
} else {
if (this.t != null) {
sg.bigo.ads.common.n.a.a(0, "BannerAd", "bind banner view in abnormal situation.");
}
frameLayout = null;
}
i iVar2 = this.f5423l;
String h = iVar2 == null ? "" : iVar2.h();
i iVar3 = this.f5423l;
boolean z = iVar3 != null && iVar3.j();
i iVar4 = this.f5423l;
boolean z2 = iVar4 != null && iVar4.i();
if (z || z2) {
if (frameLayout == null) {
frameLayout = new FrameLayout(context);
}
TextView a2 = a(context, z2);
TextView a3 = a(context, z, h);
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(0);
if (a3 != null) {
linearLayout.addView(a3);
}
if (a2 != null) {
linearLayout.addView(a2);
}
this.q = linearLayout;
}
if (frameLayout != null) {
frameLayout.addView(view);
}
View view3 = this.q;
if (view3 == null || this.u == n.INTERSTITIAL) {
if (this.u == n.INTERSTITIAL && frameLayout != null) {
viewTreeObserver = this.a.getViewTreeObserver();
onGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public final void onGlobalLayout() {
WebView webView = c.this.a;
if (webView == null) {
return;
}
ViewTreeObserver viewTreeObserver2 = webView.getViewTreeObserver();
if (viewTreeObserver2.isAlive()) {
viewTreeObserver2.removeOnGlobalLayoutListener(this);
}
TextView a4 = c.a(frameLayout.getContext(), true);
c cVar = c.this;
LinearLayout linearLayout2 = new LinearLayout(cVar.j);
linearLayout2.setOrientation(0);
linearLayout2.setGravity(17);
if (a4 != null) {
linearLayout2.addView(a4);
}
if (!q.a((CharSequence) cVar.f5423l.k())) {
if (cVar.p == null) {
cVar.p = new AdOptionsView(cVar.j);
}
AdOptionsView adOptionsView = cVar.p;
i iVar5 = cVar.f5423l;
adOptionsView.a(iVar5, iVar5.k());
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(sg.bigo.ads.common.utils.e.a(cVar.j, 16), sg.bigo.ads.common.utils.e.a(cVar.j, 16), 8388659);
layoutParams.leftMargin = sg.bigo.ads.common.utils.e.a(cVar.j, 10);
cVar.p.setLayoutParams(layoutParams);
linearLayout2.addView(cVar.p);
}
FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(-2, -2);
layoutParams2.leftMargin = sg.bigo.ads.common.utils.e.a(frameLayout.getContext(), 16);
layoutParams2.setMarginStart(sg.bigo.ads.common.utils.e.a(frameLayout.getContext(), 16));
layoutParams2.topMargin = sg.bigo.ads.common.utils.e.a(frameLayout.getContext(), 28);
u.a(linearLayout2, frameLayout, layoutParams2, -1);
TextView a5 = c.a(frameLayout.getContext(), true, c.this.f5423l.h());
if (a5 != null) {
FrameLayout.LayoutParams layoutParams3 = new FrameLayout.LayoutParams(-2, -2);
a5.measure(-2, -2);
layoutParams3.topMargin = Math.max((c.this.a.getBottom() - a5.getMeasuredHeight()) - 10, 0);
layoutParams3.leftMargin = sg.bigo.ads.common.utils.e.a(c.this.a.getContext(), 10) + c.this.a.getLeft();
layoutParams3.setMarginStart(sg.bigo.ads.common.utils.e.a(c.this.a.getContext(), 10) + c.this.a.getLeft());
u.a(a5, frameLayout, layoutParams3, -1);
}
}
};
viewTreeObserver.addOnGlobalLayoutListener(onGlobalLayoutListener);
}
if (frameLayout != null) {
view = frameLayout;
}
this.t = view;
b.a(this);
i.b ao = this.f5423l.ao();
if (parent instanceof FrameLayout) {
int a4 = ao.a();
int b2 = ao.b();
Context context2 = this.j;
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.a.getLayoutParams();
if (a4 > 0 && b2 > 0) {
layoutParams.width = sg.bigo.ads.common.utils.e.a(context2, a4);
layoutParams.height = sg.bigo.ads.common.utils.e.a(context2, b2);
layoutParams.gravity = 17;
this.t.setMinimumHeight(sg.bigo.ads.common.utils.e.a(context2, b2));
} else if (this.u == n.INTERSTITIAL) {
layoutParams.width = -1;
layoutParams.height = -1;
}
}
} else {
if (frameLayout != null && view3 != null) {
viewTreeObserver = this.a.getViewTreeObserver();
onGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public final void onGlobalLayout() {
WebView webView = c.this.a;
if (webView == null) {
return;
}
ViewTreeObserver viewTreeObserver2 = webView.getViewTreeObserver();
if (viewTreeObserver2.isAlive()) {
viewTreeObserver2.removeOnGlobalLayoutListener(this);
}
c cVar = c.this;
if (cVar.p != null && !q.a((CharSequence) cVar.f5423l.k())) {
c cVar2 = c.this;
AdOptionsView adOptionsView = cVar2.p;
i iVar5 = cVar2.f5423l;
adOptionsView.a(iVar5, iVar5.k());
}
FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(-2, -2, 8388661);
layoutParams2.topMargin = Math.max(c.this.a.getTop(), 0);
layoutParams2.rightMargin = Math.max(frameLayout.getRight() - c.this.a.getRight(), 0);
layoutParams2.setMarginEnd(Math.max(frameLayout.getRight() - c.this.a.getRight(), 0));
u.a(c.this.q, frameLayout, layoutParams2, -1);
c cVar3 = c.this;
u.a(cVar3.p, cVar3.a, null, -1);
}
};
viewTreeObserver.addOnGlobalLayoutListener(onGlobalLayoutListener);
}
if (frameLayout != null) {
}
this.t = view;
b.a(this);
i.b ao2 = this.f5423l.ao();
if (parent instanceof FrameLayout) {
}
}
}
return true;
}
return false;
}
public final boolean b(@Nullable a.b bVar) {
if (this.r) {
return true;
}
boolean c = c(bVar);
this.r = c;
return c;
}
public final sg.bigo.ads.api.core.e a(@NonNull String str) {
String str2;
String str3;
T t;
String str4;
Activity activity;
if (str.startsWith("http")) {
str3 = str;
str2 = "";
} else {
str2 = str;
str3 = "";
}
T t2 = this.k;
if (t2 instanceof l) {
((l) t2).p();
}
c.b M = this.f5423l.M();
T t3 = this.k;
Activity activity2 = null;
sg.bigo.ads.ad.c cVar = t3 instanceof sg.bigo.ads.ad.c ? (sg.bigo.ads.ad.c) t3 : null;
WeakReference<Activity> weakReference = this.o;
if (weakReference != null && (activity = weakReference.get()) != null) {
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "Interstitial/Reward Video banner ad get activity context from show(Activity activity).");
T t4 = this.k;
if (t4 instanceof sg.bigo.ads.ad.c) {
((sg.bigo.ads.ad.c) t4).b(1);
}
activity2 = activity;
}
if (activity2 == null) {
sg.bigo.ads.api.a.f fVar = g.a;
if (this.u == n.INTERSTITIAL) {
if (fVar != null && fVar.m().a(16)) {
activity2 = sg.bigo.ads.common.d.c.a();
if (activity2 == null) {
str4 = "Interstitial/Reward Video banner ad failed to get activity context.";
sg.bigo.ads.common.n.a.a(0, "BannerAd", str4);
} else {
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "Interstitial/Reward Video banner ad get activity context from current activity.");
t = this.k;
}
}
} else if (fVar != null && fVar.m().a(17)) {
try {
Activity a2 = sg.bigo.ads.common.utils.c.a(this.t);
if (a2 != null) {
try {
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "Banner ad get activity context from view.");
T t5 = this.k;
if (t5 instanceof sg.bigo.ads.ad.c) {
((sg.bigo.ads.ad.c) t5).b(3);
}
} catch (Exception unused) {
}
activity2 = a2;
}
} catch (Exception unused2) {
}
if (activity2 == null) {
activity2 = sg.bigo.ads.common.d.c.a();
if (activity2 == null) {
str4 = "Banner ad failed to get activity context.";
sg.bigo.ads.common.n.a.a(0, "BannerAd", str4);
} else {
sg.bigo.ads.common.n.a.a(0, 3, "BannerAd", "Banner ad get activity context from current activity.");
t = this.k;
}
}
}
}
if (activity2 == null) {
activity2 = sg.bigo.ads.common.d.a.a;
}
return sg.bigo.ads.controller.f.d.a(activity2, str2, str3, M.f(), this.f5423l.a(2), M.c(), cVar);
}
public final void a() {
b.h(this);
sg.bigo.ads.core.b.b bVar = this.h;
if (bVar != null) {
bVar.b();
}
a aVar = this.c;
if (aVar != null) {
aVar.a();
}
if (this.g != null) {
this.g = null;
}
sg.bigo.ads.core.mraid.e eVar = this.s;
if (eVar != null) {
eVar.d();
this.s = null;
}
View view = this.t;
if (view != null) {
view.removeOnAttachStateChangeListener(this.w);
this.t = null;
}
WebView webView = this.a;
if (webView != null) {
u.a(webView);
this.a = null;
}
T t = this.k;
if (t instanceof l) {
((l) t).q();
}
}
public final void a(final a.b bVar) {
sg.bigo.ads.common.i.c.a(2, new Runnable() {
@Override
public final void run() {
c cVar = c.this;
if (cVar.b != 0) {
if (cVar.b(bVar)) {
return;
}
bVar.a(new sg.bigo.ads.api.core.d(IAdLoadingError.LoadErrorType.BANNER_HAS_NO_IMAGE, 10102, "Adx media load error when preload"));
return;
}
a aVar = cVar.c;
if (aVar != null) {
aVar.a();
}
c.this.c = new a(bVar);
final a aVar2 = c.this.c;
aVar2.a.postDelayed(new Runnable() {
@Override
public final void run() {
a.this.b();
}
}, 15000L);
c cVar2 = c.this;
if (cVar2.b(cVar2.c)) {
return;
}
c.this.c.a(new sg.bigo.ads.api.core.d(IAdLoadingError.LoadErrorType.BANNER_HAS_NO_IMAGE, 10102, "Adx media load error when preload"));
}
});
}
}