Step Record v1.1.5版本的 MD5 值为:5797275f89198878d2f00ee92d534382
以下内容为反编译后的 c.java 源代码,内容仅作参考
package sg.bigo.ads.ad.banner;
import android.app.Activity;
import android.content.Context;
import android.graphics.Point;
import android.os.Handler;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
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 androidx.annotation.UiThread;
import com.inmobi.commons.core.configs.TelemetryConfig;
import com.mbridge.msdk.playercommon.exoplayer2.extractor.ts.PsExtractor;
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.ad.c;
import sg.bigo.ads.api.Ad;
import sg.bigo.ads.api.AdOptionsView;
import sg.bigo.ads.api.a.g;
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.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.InterfaceC0469b {
WebView a;
a c;
Runnable g;
sg.bigo.ads.core.b.b h;
f i;
final Context j;
final T k;
final i l;
final boolean m;
@Nullable
AdOptionsView o;
@Nullable
View p;
boolean q;
private sg.bigo.ads.core.mraid.e r;
private View s;
@NonNull
private final n t;
public int b = 1;
boolean d = false;
boolean e = false;
boolean f = false;
private boolean u = false;
private final View.OnAttachStateChangeListener v = 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 c.b {
private c.b c;
private boolean b = false;
Handler a = new Handler();
public a(c.b bVar) {
this.c = bVar;
}
private boolean c() {
if (this.b) {
return true;
}
this.a.removeCallbacks(null);
this.b = true;
return false;
}
@Override
public final void a() {
c.b bVar;
if (c() || (bVar = this.c) == null) {
return;
}
bVar.a();
}
@Override
public final void a(sg.bigo.ads.api.core.d dVar) {
c.b bVar;
if (c() || (bVar = this.c) == null) {
return;
}
bVar.a(dVar);
}
public final void b() {
a(new sg.bigo.ads.api.core.d(3001, 10102, "Adx media load error because of destroying before loaded"));
}
}
public c(Context context, T t, i iVar, @NonNull n nVar, f fVar, boolean z) {
this.j = context;
this.k = t;
this.l = iVar;
this.t = nVar;
this.i = fVar;
this.m = z;
}
public static TextView a(Context context, boolean z) {
if (!z) {
return null;
}
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;
}
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;
}
@UiThread
private boolean c(@Nullable final c.b bVar) {
final FrameLayout frameLayout;
ViewTreeObserver viewTreeObserver;
ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener;
i iVar = this.l;
if (iVar == null) {
return false;
}
if (iVar.al() == null || TextUtils.isEmpty(this.l.al().c())) {
sg.bigo.ads.core.c.a.b(this.l, 3001, 10104, "Banner with no data");
return false;
}
if (this.r == null) {
sg.bigo.ads.common.l.a.a(0, 3, "BannerAd", "new controller");
try {
this.r = new sg.bigo.ads.core.mraid.e(sg.bigo.ads.common.c.a.a, this.t);
} catch (NoClassDefFoundError unused) {
sg.bigo.ads.common.l.a.a(0, "BannerAd", "Server Banner is not support");
}
if (this.r == null) {
return false;
}
if (this.o == null) {
this.o = new AdOptionsView(this.j);
}
this.r.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();
}
c.b bVar2 = bVar;
if (bVar2 != null) {
bVar2.a();
}
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.o, cVar4.p);
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 a(@NonNull String str, @Nullable Point point) {
String str2;
String str3;
c cVar = c.this;
if (str.startsWith("http")) {
str3 = str;
str2 = "";
} else {
str2 = str;
str3 = "";
}
T t = cVar.k;
if (t instanceof l) {
((l) t).m();
}
c.b L = cVar.l.L();
T t2 = cVar.k;
sg.bigo.ads.api.core.e a2 = sg.bigo.ads.controller.g.d.a(sg.bigo.ads.common.c.a.a, str2, str3, L.f(), cVar.l.a(2), L.c(), (sg.bigo.ads.ad.c<?>) (t2 instanceof sg.bigo.ads.ad.c ? (sg.bigo.ads.ad.c) t2 : null));
f fVar = c.this.i;
if (fVar != null) {
fVar.a(point, a2);
}
}
@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.l.a.a(0, 3, "BannerAd", "notifyCustomJsExecuteError.");
f fVar = cVar.i;
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.l.a.a(0, 3, "BannerAd", "notifyCustomJsOmLoadedEvent, adSessionId=".concat(String.valueOf(optString)));
return;
}
if (c != 1) {
return;
}
JSONObject optJSONObject = jSONObject.optJSONObject("data");
if (cVar.n.get()) {
sg.bigo.ads.common.l.a.a(0, 3, "BannerAd", "notifyCustomJsOmGeometryChange return, already called.");
return;
}
if (cVar.i == null) {
sg.bigo.ads.common.l.a.a(0, 3, "BannerAd", "notifyCustomJsOmGeometryChange return, mListener is null, adSessionId=" + optString + ", dataJson=" + optJSONObject);
return;
}
if (optJSONObject == null) {
sg.bigo.ads.common.l.a.a(0, 3, "BannerAd", "notifyCustomJsOmGeometryChange return, dataJson is null, adSessionId=".concat(String.valueOf(optString)));
return;
}
JSONObject optJSONObject2 = optJSONObject.optJSONObject("adView");
if (optJSONObject2 == null) {
sg.bigo.ads.common.l.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.l.a.a(0, 3, "BannerAd", "notifyCustomJsOmGeometryChange return, onScreenGeometryJson is null, adSessionId=" + optString + ", dataJson=" + optJSONObject);
return;
}
double optDouble = optJSONObject3.optDouble("pixels", TelemetryConfig.DEFAULT_SAMPLING_FACTOR);
sg.bigo.ads.common.l.a.a(0, 3, "BannerAd", "notifyCustomJsOmGeometryChange, adSessionId=" + optString + ", pixels=" + optDouble);
if (optDouble > TelemetryConfig.DEFAULT_SAMPLING_FACTOR) {
cVar.n.set(true);
cVar.i.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 a(Activity activity, int i) {
return false;
}
@Override
public final void b() {
c.this.f = false;
c.b bVar2 = bVar;
if (bVar2 != null) {
bVar2.a(new sg.bigo.ads.api.core.d(3001, 10102, "Adx media load error"));
}
b.c(c.this);
}
@Override
public final boolean b(Activity activity, int i) {
return false;
}
@Override
public final void c() {
}
@Override
public final void d() {
sg.bigo.ads.common.l.a.a(0, 3, "BannerAd", "onExpand");
}
@Override
public final void e() {
sg.bigo.ads.common.l.a.a(0, 3, "BannerAd", "onResize");
}
@Override
public final void f() {
}
@Override
public final void g() {
f fVar = c.this.i;
if (fVar != null) {
fVar.a();
}
}
};
this.r.j.d = !this.l.c().t();
String c = this.l.al().c();
e.d dVar = new e.d() {
@Override
public final void a() {
sg.bigo.ads.common.l.a.a(0, 3, "BannerAd", "onReady");
}
};
if (URLUtil.isNetworkUrl(c)) {
sg.bigo.ads.core.mraid.e eVar = this.r;
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.h().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.r.a(d, dVar);
}
this.f = true;
t.a();
}
c.C0517c b = this.r.b();
this.a = b;
if (b == null) {
return false;
}
b.setOverScrollMode(2);
this.a.setHorizontalScrollBarEnabled(false);
this.a.setHorizontalScrollbarOverlay(false);
this.a.setVerticalScrollBarEnabled(false);
this.a.setVerticalScrollbarOverlay(false);
this.a.getSettings().setSupportZoom(false);
Object parent = this.a.getParent();
if (parent instanceof ViewGroup) {
View view = (View) parent;
Context context = this.j;
if (context == null) {
context = sg.bigo.ads.common.c.a.a;
}
View view2 = this.s;
if ((view2 instanceof FrameLayout) && ((FrameLayout) view2).getChildCount() == 0) {
frameLayout = (FrameLayout) this.s;
} else {
if (this.s != null) {
sg.bigo.ads.common.l.a.a(0, "BannerAd", "bind banner view in abnormal situation.");
}
frameLayout = null;
}
i iVar2 = this.l;
String g = iVar2 == null ? "" : iVar2.g();
i iVar3 = this.l;
boolean z = iVar3 != null && iVar3.i();
i iVar4 = this.l;
boolean z2 = iVar4 != null && iVar4.h();
if (z || z2) {
if (frameLayout == null) {
frameLayout = new FrameLayout(context);
}
TextView a2 = a(context, z2);
TextView a3 = a(context, z, g);
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(0);
if (a3 != null) {
linearLayout.addView(a3);
}
if (a2 != null) {
linearLayout.addView(a2);
}
this.p = linearLayout;
}
if (frameLayout != null) {
frameLayout.addView(view);
}
View view3 = this.p;
if (view3 == null || this.t == n.INTERSTITIAL) {
if (this.t == 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.l.j())) {
if (cVar.o == null) {
cVar.o = new AdOptionsView(cVar.j);
}
AdOptionsView adOptionsView = cVar.o;
i iVar5 = cVar.l;
adOptionsView.a(iVar5, iVar5.j());
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.o.setLayoutParams(layoutParams);
linearLayout2.addView(cVar.o);
}
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.l.g());
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.s = view;
b.a(this);
i.b al = this.l.al();
if (parent instanceof FrameLayout) {
int a4 = al.a();
int b2 = al.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.s.setMinimumHeight(sg.bigo.ads.common.utils.e.a(context2, b2));
} else if (this.t == 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.o != null && !q.a((CharSequence) cVar.l.j())) {
c cVar2 = c.this;
AdOptionsView adOptionsView = cVar2.o;
i iVar5 = cVar2.l;
adOptionsView.a(iVar5, iVar5.j());
}
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.p, frameLayout, layoutParams2, -1);
c cVar3 = c.this;
u.a(cVar3.o, cVar3.a, null, -1);
}
};
viewTreeObserver.addOnGlobalLayoutListener(onGlobalLayoutListener);
}
if (frameLayout != null) {
}
this.s = view;
b.a(this);
i.b al2 = this.l.al();
if (parent instanceof FrameLayout) {
}
}
}
return true;
}
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.b();
}
if (this.g != null) {
this.g = null;
}
sg.bigo.ads.core.mraid.e eVar = this.r;
if (eVar != null) {
eVar.d();
this.r = null;
}
View view = this.s;
if (view != null) {
view.removeOnAttachStateChangeListener(this.v);
this.s = null;
}
WebView webView = this.a;
if (webView != null) {
u.a(webView);
this.a = null;
}
T t = this.k;
if (t instanceof l) {
((l) t).n();
}
}
public final void a(final c.b bVar) {
sg.bigo.ads.common.g.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(3001, 10102, "Adx media load error when preload"));
return;
}
a aVar = cVar.c;
if (aVar != null) {
aVar.b();
}
c.this.c = new a(bVar);
final a aVar2 = c.this.c;
aVar2.a.postDelayed(new Runnable() {
@Override
public final void run() {
a.this.a();
}
}, 15000L);
c cVar2 = c.this;
if (cVar2.b(cVar2.c)) {
return;
}
c.this.c.a(new sg.bigo.ads.api.core.d(3001, 10102, "Adx media load error when preload"));
}
});
}
@NonNull
public final View b() {
if (this.s == null) {
sg.bigo.ads.common.l.a.a(2, "BannerAd", "The banner ad is not ready, an empty view will be retrieved.");
this.s = new FrameLayout(this.j);
}
b.d(this);
this.s.addOnAttachStateChangeListener(this.v);
return this.s;
}
@UiThread
public final boolean b(@Nullable c.b bVar) {
if (this.q) {
return true;
}
boolean c = c(bVar);
this.q = c;
return c;
}
public final String c() {
i iVar = this.l;
return iVar != null ? iVar.x() : "";
}
public final void d() {
sg.bigo.ads.common.l.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.l.a.a(0, 3, "BannerAd", "javascript:onViewImpression()");
this.a.loadUrl("javascript:onViewImpression()");
}
}
public final void f() {
final WebView webView = this.a;
if (this.u || !(webView instanceof sg.bigo.ads.core.g.b)) {
return;
}
this.u = true;
sg.bigo.ads.common.g.c.a(1, new Runnable() {
@Override
public final void run() {
b.C0514b c0514b;
long j;
long j2;
long j3;
long j4;
long j5;
byte b = 0;
sg.bigo.ads.common.l.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.h().a(0) || g.a.h().a(1)) {
b.C0514b c0514b2 = bVar.c;
sg.bigo.ads.core.g.b.a(c0514b2);
if (g.a.h().a(1)) {
if (bVar.d == null) {
bVar.d = new b.c(bVar, b);
}
long elapsedRealtime = SystemClock.elapsedRealtime();
c0514b2.d = bVar.d.a();
c0514b2.g = SystemClock.elapsedRealtime() - elapsedRealtime;
c0514b2.f = SystemClock.elapsedRealtime();
}
c0514b = c0514b2;
} else {
c0514b = null;
}
if (c0514b != null) {
Boolean bool = c0514b.c;
if (bool == null && c0514b.d == null) {
return;
}
Boolean bool2 = c0514b.d;
if (bool != null) {
long j6 = bool.booleanValue() ? 1L : 0L;
j2 = b.a(c.this, c0514b.e);
j = j6;
} else {
j = -1;
j2 = -1;
}
if (bool2 != null) {
long j7 = bool2.booleanValue() ? 1L : 0L;
long j8 = c0514b.g;
j4 = b.a(c.this, c0514b.f);
j3 = j7;
j5 = j8;
} else {
j3 = -1;
j4 = -1;
j5 = -1;
}
sg.bigo.ads.common.l.a.a(0, 3, "BannerAd", "Stat check blank resutl.");
sg.bigo.ads.core.c.a.a(c.this.l, j, j2, j3, j4, j5);
}
}
});
}
}