Weather Tracker v1.0.0版本的 MD5 值为:3edef27647e42a8ea0e7c0d2dbf56f97

以下内容为反编译后的 c.java 源代码,内容仅作参考


package sg.bigo.ads.ad.banner;

import android.app.Activity;
import android.content.Context;
import android.graphics.Point;
import android.os.Build;
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 androidx.annotation.UiThread;
import com.google.android.exoplayer2.C;
import com.google.android.material.badge.BadgeDrawable;
import com.tradplus.ads.common.FSConstants;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONException;
import org.json.JSONObject;
import sg.bigo.ads.R;
import sg.bigo.ads.ad.b;
import sg.bigo.ads.ad.banner.b;
import sg.bigo.ads.api.Ad;
import sg.bigo.ads.api.AdOptionsView;
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.c.c;
import sg.bigo.ads.core.h.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.InterfaceC0561b {
    WebView a;
    a c;
    Runnable g;
    sg.bigo.ads.core.c.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 f7511b = 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);

    static class a implements b.InterfaceC0560b {
        private b.InterfaceC0560b c;
        private boolean f7517b = false;
        Handler a = new Handler();

        a(b.InterfaceC0560b interfaceC0560b) {
            this.c = interfaceC0560b;
        }

        private boolean c() {
            if (this.f7517b) {
                return true;
            }
            this.a.removeCallbacks(null);
            this.f7517b = true;
            return false;
        }

        @Override
        public final void a() {
            b.InterfaceC0560b interfaceC0560b;
            if (c() || (interfaceC0560b = this.c) == null) {
                return;
            }
            interfaceC0560b.a();
        }

        @Override
        public final void a(sg.bigo.ads.api.core.d dVar) {
            b.InterfaceC0560b interfaceC0560b;
            if (c() || (interfaceC0560b = this.c) == null) {
                return;
            }
            interfaceC0560b.a(dVar);
        }

        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;
    }

    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;
    }

    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, 120));
        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 b.InterfaceC0560b interfaceC0560b) {
        ViewTreeObserver viewTreeObserver;
        ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener;
        i iVar = this.l;
        if (iVar == null) {
            return false;
        }
        if (iVar.aa() == null || TextUtils.isEmpty(this.l.aa().c())) {
            sg.bigo.ads.core.d.a.b(this.l, 3001, 10104, "Banner with no data");
            return false;
        }
        if (this.r == null) {
            sg.bigo.ads.common.k.a.a(0, 3, "BannerAd", "new controller");
            try {
                this.r = new sg.bigo.ads.core.mraid.e(sg.bigo.ads.common.b.a.a, this.t);
            } catch (NoClassDefFoundError unused) {
                sg.bigo.ads.common.k.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();
                    }
                    b.InterfaceC0560b interfaceC0560b2 = interfaceC0560b;
                    if (interfaceC0560b2 != null) {
                        interfaceC0560b2.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.c.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.c.b bVar = c.this.h;
                        if (bVar != null) {
                            bVar.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(FSConstants.HTTP)) {
                        str3 = str;
                        str2 = "";
                    } else {
                        str2 = str;
                        str3 = "";
                    }
                    T t = cVar.k;
                    if (t instanceof l) {
                        ((l) t).k();
                    }
                    c.b J2 = cVar.l.J();
                    T t2 = cVar.k;
                    sg.bigo.ads.api.core.e a2 = sg.bigo.ads.controller.g.d.a(sg.bigo.ads.common.b.a.a, str2, str3, J2.f(), cVar.l.a(2), J2.c(), t2 instanceof sg.bigo.ads.ad.b ? (sg.bigo.ads.ad.b) t2 : null);
                    f fVar = c.this.i;
                    if (fVar != null) {
                        fVar.a(point, a2);
                    }
                }

                @Override
                public final void a(String str, String str2) {
                    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.k.a.a(0, 3, "BannerAd", "notifyCustomJsExecuteError.");
                                    f fVar = cVar.i;
                                    if (fVar != null) {
                                        fVar.b();
                                        return;
                                    }
                                    return;
                                }
                                return;
                            } catch (JSONException e) {
                                e.printStackTrace();
                                return;
                            }
                        }
                        return;
                    }
                    try {
                        JSONObject jSONObject = new JSONObject(str2);
                        String optString = jSONObject.optString("adSessionId");
                        String optString2 = jSONObject.optString("type");
                        char c = 65535;
                        int hashCode = optString2.hashCode();
                        if (hashCode != -1097519099) {
                            if (hashCode != 10775234) {
                                if (hashCode == 120623625 && optString2.equals("impression")) {
                                    c = 2;
                                }
                            } else if (optString2.equals("geometryChange")) {
                                c = 1;
                            }
                        } else if (optString2.equals("loaded")) {
                            c = 0;
                        }
                        sg.bigo.ads.common.k.a.a(0, 3, "BannerAd", "notifyCustomJsOmLoadedEvent, adSessionId=".concat(String.valueOf(optString)));
                    } catch (JSONException e2) {
                        e2.printStackTrace();
                    }
                }

                @Override
                public final boolean a(Activity activity, int i) {
                    return false;
                }

                @Override
                public final void b() {
                    c.this.f = false;
                    b.InterfaceC0560b interfaceC0560b2 = interfaceC0560b;
                    if (interfaceC0560b2 != null) {
                        interfaceC0560b2.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.k.a.a(0, 3, "BannerAd", "onExpand");
                }

                @Override
                public final void e() {
                    sg.bigo.ads.common.k.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.b().t();
            String c = this.l.aa().c();
            e.d dVar = new e.d() {
                @Override
                public final void a() {
                    sg.bigo.ads.common.k.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.h.a k = sg.bigo.ads.core.h.a.k();
                if (sg.bigo.ads.api.a.f.a.i().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.C0602c b2 = this.r.b();
        this.a = b2;
        if (b2 != null) {
            b2.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.b.a.a;
                }
                final FrameLayout frameLayout = null;
                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.k.a.a(0, "BannerAd", "bind banner view in abnormal situation.");
                }
                i iVar2 = this.l;
                String f = iVar2 == null ? "" : iVar2.f();
                i iVar3 = this.l;
                boolean z = iVar3 != null && iVar3.h();
                i iVar4 = this.l;
                boolean z2 = iVar4 != null && iVar4.g();
                if (z || z2) {
                    if (frameLayout == null) {
                        frameLayout = new FrameLayout(context);
                    }
                    TextView a2 = a(context, z2);
                    TextView a3 = a(context, z, f);
                    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.i())) {
                                    if (cVar.o == null) {
                                        cVar.o = new AdOptionsView(cVar.j);
                                    }
                                    AdOptionsView adOptionsView = cVar.o;
                                    i iVar5 = cVar.l;
                                    adOptionsView.a(iVar5, iVar5.i());
                                    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), BadgeDrawable.TOP_START);
                                    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);
                                int i = Build.VERSION.SDK_INT;
                                if (i >= 17) {
                                    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.f());
                                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 = c.this.a.getLeft() + sg.bigo.ads.common.utils.e.a(c.this.a.getContext(), 10);
                                    if (i >= 17) {
                                        layoutParams3.setMarginStart(c.this.a.getLeft() + sg.bigo.ads.common.utils.e.a(c.this.a.getContext(), 10));
                                    }
                                    u.a(a5, frameLayout, layoutParams3, -1);
                                }
                            }
                        };
                        viewTreeObserver.addOnGlobalLayoutListener(onGlobalLayoutListener);
                    }
                    if (frameLayout != null) {
                        view = frameLayout;
                    }
                    this.s = view;
                    b.a(this);
                    i.b aa = this.l.aa();
                    if (parent instanceof FrameLayout) {
                        int a4 = aa.a();
                        int b3 = aa.b();
                        Context context2 = this.j;
                        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.a.getLayoutParams();
                        if (a4 > 0 && b3 > 0) {
                            layoutParams.width = sg.bigo.ads.common.utils.e.a(context2, a4);
                            layoutParams.height = sg.bigo.ads.common.utils.e.a(context2, b3);
                            layoutParams.gravity = 17;
                            this.s.setMinimumHeight(sg.bigo.ads.common.utils.e.a(context2, b3));
                        } 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.i())) {
                                    c cVar2 = c.this;
                                    cVar2.o.a(cVar2.l);
                                }
                                FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(-2, -2, BadgeDrawable.TOP_END);
                                layoutParams2.topMargin = Math.max(c.this.a.getTop(), 0);
                                layoutParams2.rightMargin = Math.max(frameLayout.getRight() - c.this.a.getRight(), 0);
                                if (Build.VERSION.SDK_INT >= 17) {
                                    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 aa2 = this.l.aa();
                    if (parent instanceof FrameLayout) {
                    }
                }
            }
            return true;
        }
        return false;
    }

    public final void a() {
        b.h(this);
        sg.bigo.ads.core.c.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).l();
        }
    }

    public final void a(final b.InterfaceC0560b interfaceC0560b) {
        sg.bigo.ads.common.f.c.a(2, new Runnable() {
            @Override
            public final void run() {
                c cVar = c.this;
                if (cVar.f7511b != 0) {
                    if (cVar.b(interfaceC0560b)) {
                        return;
                    }
                    interfaceC0560b.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(interfaceC0560b);
                final a aVar2 = c.this.c;
                aVar2.a.postDelayed(new Runnable() {
                    @Override
                    public final void run() {
                        a.this.a();
                    }
                }, C.DEFAULT_SEEK_FORWARD_INCREMENT_MS);
                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.k.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 b.InterfaceC0560b interfaceC0560b) {
        if (this.q) {
            return true;
        }
        boolean c = c(interfaceC0560b);
        this.q = c;
        return c;
    }

    public final String c() {
        i iVar = this.l;
        return iVar != null ? iVar.w() : "";
    }

    public final void d() {
        sg.bigo.ads.common.k.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.c.b bVar = this.h;
            if (bVar != null) {
                bVar.a();
            }
        }
    }

    final void e() {
        if (this.a != null) {
            sg.bigo.ads.common.k.a.a(0, 3, "BannerAd", "javascript:onViewImpression()");
            this.a.loadUrl("javascript:onViewImpression()");
        }
    }

    final void f() {
        final WebView webView = this.a;
        if (this.u || !(webView instanceof sg.bigo.ads.core.h.b)) {
            return;
        }
        this.u = true;
        sg.bigo.ads.common.f.c.a(1, new Runnable() {
            @Override
            public final void run() {
                b.C0599b c0599b;
                long j;
                long j2;
                long j3;
                long j4;
                long j5;
                sg.bigo.ads.common.k.a.a(0, 3, "BannerAd", "Notify webView performance stat.");
                sg.bigo.ads.core.h.b bVar = (sg.bigo.ads.core.h.b) webView;
                if (sg.bigo.ads.api.a.f.a.i().a(0) || sg.bigo.ads.api.a.f.a.i().a(1)) {
                    b.C0599b c0599b2 = bVar.c;
                    sg.bigo.ads.core.h.b.a(c0599b2);
                    if (sg.bigo.ads.api.a.f.a.i().a(1)) {
                        if (bVar.d == null) {
                            bVar.d = new b.c(bVar, (byte) 0);
                        }
                        long elapsedRealtime = SystemClock.elapsedRealtime();
                        c0599b2.d = bVar.d.a();
                        c0599b2.g = SystemClock.elapsedRealtime() - elapsedRealtime;
                        c0599b2.f = SystemClock.elapsedRealtime();
                    }
                    c0599b = c0599b2;
                } else {
                    c0599b = null;
                }
                if (c0599b != null) {
                    Boolean bool = c0599b.c;
                    if (bool == null && c0599b.d == null) {
                        return;
                    }
                    Boolean bool2 = c0599b.d;
                    if (bool != null) {
                        long j6 = bool.booleanValue() ? 1L : 0L;
                        j2 = b.a(c.this, c0599b.e);
                        j = j6;
                    } else {
                        j = -1;
                        j2 = -1;
                    }
                    if (bool2 != null) {
                        long j7 = bool2.booleanValue() ? 1L : 0L;
                        long j8 = c0599b.g;
                        j4 = b.a(c.this, c0599b.f);
                        j3 = j7;
                        j5 = j8;
                    } else {
                        j3 = -1;
                        j4 = -1;
                        j5 = -1;
                    }
                    sg.bigo.ads.common.k.a.a(0, 3, "BannerAd", "Stat check blank resutl.");
                    sg.bigo.ads.core.d.a.a(c.this.l, j, j2, j3, j4, j5);
                }
            }
        });
    }
}