导航菜单

页面标题

页面副标题

CallApp v2.226 - c.java 源代码

正在查看: CallApp v2.226 应用的 c.java JAVA 源代码文件

本页面展示 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.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
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.AdSize;
import sg.bigo.ads.api.BannerAdRequest;
import sg.bigo.ads.api.b.a;
import sg.bigo.ads.api.core.i;
import sg.bigo.ads.common.utils.q;
import sg.bigo.ads.common.utils.u;
import sg.bigo.ads.core.h.b;
import sg.bigo.ads.core.mraid.n;

public final class c<T extends Ad> implements b.InterfaceC0051b {
    WebView a;
    b c;
    Runnable g;
    sg.bigo.ads.core.c.b h;
    g i;
    final T j;
    final i k;
    final boolean l;
    public WeakReference<Activity> n;
    public a 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;
    private final Context w;
    private BannerAdRequest x;
    private AdSize y;
    public int b = 1;
    boolean d = false;
    boolean e = false;
    boolean f = false;
    private boolean v = false;
    private final View.OnAttachStateChangeListener z = new View.OnAttachStateChangeListener() {
        @Override
        public final void onViewAttachedToWindow(View view) {
            sg.bigo.ads.ad.banner.b.e(c.this);
        }

        @Override
        public final void onViewDetachedFromWindow(View view) {
            sg.bigo.ads.ad.banner.b.f(c.this);
            view.removeOnAttachStateChangeListener(this);
        }
    };
    final AtomicBoolean m = new AtomicBoolean(false);

    public interface a {
        void a(int i, int i2);
    }

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

        public b(a.InterfaceC0092a interfaceC0092a) {
            this.c = interfaceC0092a;
        }

        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(3001, 10102, "Adx media load error because of destroying before loaded"));
        }

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

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

    public c(Context context, sg.bigo.ads.api.core.g gVar, T t, i iVar, @NonNull n nVar, g gVar2, boolean z) {
        this.w = context;
        this.j = t;
        this.k = iVar;
        this.u = nVar;
        this.i = gVar2;
        this.l = z;
        if (gVar != null) {
            sg.bigo.ads.api.b bVar = gVar.c;
            if (bVar instanceof BannerAdRequest) {
                this.x = (BannerAdRequest) bVar;
            }
        }
    }

    public static View a(c cVar, View view) {
        LinearLayout linearLayout = new LinearLayout(cVar.w);
        linearLayout.setOrientation(0);
        linearLayout.setGravity(17);
        if (view != null) {
            linearLayout.addView(view);
        }
        if (!q.a((CharSequence) cVar.k.l())) {
            if (cVar.p == null) {
                cVar.p = new AdOptionsView(cVar.w);
            }
            AdOptionsView adOptionsView = cVar.p;
            i iVar = cVar.k;
            adOptionsView.a(iVar, iVar.l());
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(sg.bigo.ads.common.utils.e.a(cVar.w, 16), sg.bigo.ads.common.utils.e.a(cVar.w, 16), 8388659);
            layoutParams.leftMargin = sg.bigo.ads.common.utils.e.a(cVar.w, 10);
            cVar.p.setLayoutParams(layoutParams);
            linearLayout.addView(cVar.p);
        }
        return linearLayout;
    }

    public final void b() {
        try {
            sg.bigo.ads.ad.banner.b.h(this);
            sg.bigo.ads.core.c.b bVar = this.h;
            if (bVar != null) {
                bVar.b();
            }
            b bVar2 = this.c;
            if (bVar2 != null) {
                bVar2.a();
            }
            if (this.g != null) {
                this.g = null;
            }
            sg.bigo.ads.core.mraid.e eVar = this.s;
            if (eVar != null) {
                eVar.e();
                this.s = null;
            }
            View view = this.t;
            if (view != null) {
                view.removeOnAttachStateChangeListener(this.z);
                this.t = null;
            }
            WebView webView = this.a;
            if (webView != null) {
                u.b(webView);
                this.a = null;
            }
        } catch (Throwable unused) {
        }
    }

    @NonNull
    public final View c() {
        if (this.t == null) {
            sg.bigo.ads.common.t.a.a(2, "BannerAd", "The banner ad is not ready, an empty view will be retrieved.");
            this.t = new FrameLayout(this.w);
        }
        sg.bigo.ads.ad.banner.b.d(this);
        this.t.addOnAttachStateChangeListener(this.z);
        return this.t;
    }

    public final String d() {
        i iVar = this.k;
        return iVar != null ? iVar.z() : "";
    }

    @androidx.annotation.NonNull
    public final android.content.Context e() {
        throw new UnsupportedOperationException("Method not decompiled: sg.bigo.ads.ad.banner.c.e():android.content.Context");
    }

    public final void f() {
        sg.bigo.ads.common.t.a.a(0, 3, "BannerAd", "performImpression");
        sg.bigo.ads.ad.banner.b.g(this);
        T t = this.j;
        if (t instanceof e) {
            ((e) t).a(sg.bigo.ads.ad.banner.b.i(this));
        }
        if (this.d) {
            return;
        }
        this.d = true;
        if (this.e) {
            h();
            g();
            sg.bigo.ads.core.c.b bVar = this.h;
            if (bVar != null) {
                bVar.a();
            }
        }
    }

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

    public final void h() {
        final WebView webView = this.a;
        if (this.v || !(webView instanceof sg.bigo.ads.core.h.b)) {
            return;
        }
        this.v = true;
        sg.bigo.ads.common.n.d.a(1, new Runnable() {
            @Override
            public final void run() {
                b.C0133b c0133b;
                long j;
                long j2;
                long j3;
                long j4;
                long j5;
                byte b2 = 0;
                sg.bigo.ads.common.t.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.i.a.n().a(0) || sg.bigo.ads.api.a.i.a.n().a(1)) {
                    b.C0133b c0133b2 = bVar.h;
                    sg.bigo.ads.core.h.b.a(c0133b2);
                    if (sg.bigo.ads.api.a.i.a.n().a(1)) {
                        if (bVar.i == null) {
                            bVar.i = new b.c(bVar, b2);
                        }
                        long elapsedRealtime = SystemClock.elapsedRealtime();
                        c0133b2.d = bVar.i.a();
                        c0133b2.g = SystemClock.elapsedRealtime() - elapsedRealtime;
                        c0133b2.f = SystemClock.elapsedRealtime();
                    }
                    c0133b = c0133b2;
                } else {
                    c0133b = null;
                }
                if (c0133b != null) {
                    Boolean bool = c0133b.c;
                    if (bool == null && c0133b.d == null) {
                        return;
                    }
                    Boolean bool2 = c0133b.d;
                    if (bool != null) {
                        long j6 = bool.booleanValue() ? 1L : 0L;
                        j2 = sg.bigo.ads.ad.banner.b.a(c.this, c0133b.e);
                        j = j6;
                    } else {
                        j = -1;
                        j2 = -1;
                    }
                    if (bool2 != null) {
                        long j7 = bool2.booleanValue() ? 1L : 0L;
                        long j8 = c0133b.g;
                        j4 = sg.bigo.ads.ad.banner.b.a(c.this, c0133b.f);
                        j3 = j7;
                        j5 = j8;
                    } else {
                        j3 = -1;
                        j4 = -1;
                        j5 = -1;
                    }
                    sg.bigo.ads.common.t.a.a(0, 3, "BannerAd", "Stat check blank resutl.");
                    sg.bigo.ads.core.d.b.a(c.this.k, j, j2, j3, j4, j5);
                }
            }
        });
    }

    public final AdSize i() {
        List<AdSize> list;
        if (this.y == null) {
            BannerAdRequest bannerAdRequest = this.x;
            if (bannerAdRequest != null && (list = bannerAdRequest.h) != null) {
                Iterator<AdSize> it = list.iterator();
                while (true) {
                    if (!it.hasNext()) {
                        break;
                    }
                    AdSize next = it.next();
                    if (!next.a.equals(AdSize.ADAPTIVE)) {
                        this.y = next;
                        break;
                    }
                }
            }
            if (this.y == null) {
                Context context = this.w;
                this.y = sg.bigo.ads.common.utils.e.c(context, context.getResources().getDisplayMetrics().widthPixels) > 720 ? AdSize.LEADERBOARD : AdSize.BANNER;
            }
        }
        return this.y;
    }

    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.bigo_ad_tag, 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;
    }

    private boolean c(@androidx.annotation.Nullable final sg.bigo.ads.api.b.a.InterfaceC0092a r13) {
        throw new UnsupportedOperationException("Method not decompiled: sg.bigo.ads.ad.banner.c.c(sg.bigo.ads.api.b.a$a):boolean");
    }

    public final boolean b(@Nullable a.InterfaceC0092a interfaceC0092a) {
        if (this.r) {
            return true;
        }
        boolean c = c(interfaceC0092a);
        this.r = c;
        return c;
    }

    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_banner_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, 240));
        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;
    }

    public final void a() {
        if (sg.bigo.ads.common.n.d.b()) {
            b();
        } else {
            sg.bigo.ads.common.n.d.a(2, new Runnable() {
                @Override
                public final void run() {
                    c.this.b();
                }
            });
        }
    }

    private void a(FrameLayout.LayoutParams layoutParams, int i, int i2) {
        layoutParams.width = i;
        layoutParams.height = i2;
        layoutParams.gravity = 17;
        this.t.setMinimumHeight(i2);
    }

    public final void a(final a.InterfaceC0092a interfaceC0092a) {
        sg.bigo.ads.common.n.d.a(2, new Runnable() {
            @Override
            public final void run() {
                c cVar = c.this;
                if (cVar.b != 0) {
                    if (cVar.b(interfaceC0092a)) {
                        return;
                    }
                    interfaceC0092a.a(new sg.bigo.ads.api.core.d(3001, 10102, "Adx media load error when preload"));
                    return;
                }
                b bVar = cVar.c;
                if (bVar != null) {
                    bVar.a();
                }
                c.this.c = new b(interfaceC0092a);
                final b bVar2 = c.this.c;
                bVar2.a.postDelayed(new Runnable() {
                    @Override
                    public final void run() {
                        b.this.b();
                    }
                }, 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"));
            }
        });
    }
}