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

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


package com.mbridge.msdk.mbbanner.common.c;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Base64;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.fyber.inneractive.sdk.external.InneractiveMediationDefs;
import com.google.android.exoplayer2.C;
import com.iab.omid.library.mmadbridge.ScriptInjector;
import com.iab.omid.library.mmadbridge.adsession.AdEvents;
import com.iab.omid.library.mmadbridge.adsession.AdSession;
import com.iab.omid.library.mmadbridge.adsession.FriendlyObstructionPurpose;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.c.e;
import com.mbridge.msdk.foundation.db.j;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.foundation.entity.CampaignUnit;
import com.mbridge.msdk.foundation.same.a.d;
import com.mbridge.msdk.foundation.same.report.i;
import com.mbridge.msdk.foundation.same.report.l;
import com.mbridge.msdk.foundation.same.report.m;
import com.mbridge.msdk.foundation.tools.ac;
import com.mbridge.msdk.foundation.tools.ad;
import com.mbridge.msdk.foundation.tools.al;
import com.mbridge.msdk.foundation.tools.r;
import com.mbridge.msdk.foundation.tools.u;
import com.mbridge.msdk.foundation.tools.w;
import com.mbridge.msdk.foundation.tools.y;
import com.mbridge.msdk.mbbanner.common.b.f;
import com.mbridge.msdk.mbbanner.common.util.BannerUtils;
import com.mbridge.msdk.mbbanner.view.MBBannerWebView;
import com.mbridge.msdk.mbsignalcommon.windvane.g;
import com.mbridge.msdk.out.Campaign;
import com.mbridge.msdk.out.MBBannerView;
import com.mbridge.msdk.out.NativeListener;
import com.mbridge.msdk.videocommon.download.h;
import com.mbridge.msdk.widget.FeedBackButton;
import com.mbridge.msdk.widget.MBAdChoice;
import com.my.target.ads.Reward;
import com.unity3d.services.ads.adunit.AdUnitActivity;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.json.JSONObject;
public final class c {
    private float A;
    com.mbridge.msdk.click.a a;
    private com.mbridge.msdk.mbbanner.common.b.c f3918b;
    private boolean c;
    private CampaignEx d;
    private final MBBannerView e;
    private ImageView f;
    private MBBannerWebView g;
    private ImageView h;
    private ImageView i;
    private boolean j;
    private boolean k;
    private boolean l;
    private boolean m;
    private boolean n;
    private boolean o;
    private boolean p;
    private final String q;
    private final String r;
    private List<CampaignEx> s;
    private int t;
    private com.mbridge.msdk.mbbanner.common.bridge.a v;
    private AdSession w;
    private float z;
    private final long u = C.DEFAULT_SEEK_FORWARD_INCREMENT_MS;
    private final Handler x = new Handler(Looper.getMainLooper()) {
        @Override
        public final void handleMessage(Message message) {
            super.handleMessage(message);
            if (message.what != 1) {
                return;
            }
            try {
                if (c.this.w != null) {
                    AdEvents.createAdEvents(c.this.w).impressionOccurred();
                    c.this.w.finish();
                    c.this.w = null;
                }
            } catch (Throwable th) {
                y.a("BannerShowManager", th.getMessage());
            }
        }
    };
    private final com.mbridge.msdk.foundation.same.e.a y = new com.mbridge.msdk.foundation.same.e.a() {
        @Override
        public final void a() {
            c.this.a("banner render failed because render is timeout");
        }

        @Override
        public final void b() {
        }
    };
    private final View.OnClickListener B = new View.OnClickListener() {
        @Override
        public final void onClick(View view) {
            if (c.this.p) {
                c.c(c.this);
            }
        }
    };
    private com.mbridge.msdk.mbbanner.common.b.a C = new com.mbridge.msdk.mbbanner.common.b.a() {
        @Override
        public final void a(int i) {
            if (i == 2) {
                c.d(c.this);
            } else {
                c.this.f();
            }
        }

        @Override
        public final void b(int i) {
            if (i == 1) {
                c.this.d();
                c.this.a("", 1);
                return;
            }
            c.this.c();
        }

        @Override
        public final void a(String str) {
            c.c(c.this);
        }

        @Override
        public final void a() {
            c.c(c.this);
        }

        @Override
        public final void a(CampaignEx campaignEx) {
            c.this.a(campaignEx);
        }

        @Override
        public final void a(boolean z) {
            if (c.this.f3918b != null) {
                c.this.o = z;
                if (z) {
                    c.this.f3918b.c();
                } else {
                    c.this.f3918b.d();
                }
            }
        }

        @Override
        public final void a(boolean z, String str) {
            try {
                if (c.this.f3918b != null) {
                    if (TextUtils.isEmpty(str)) {
                        c.this.f3918b.a();
                        c.this.f3918b.b();
                        return;
                    }
                    CampaignEx parseCampaignWithBackData = CampaignEx.parseCampaignWithBackData(CampaignEx.campaignToJsonObject(c.this.d));
                    parseCampaignWithBackData.setClickURL(str);
                    if (z) {
                        String str2 = c.this.q;
                        try {
                            if (!TextUtils.isEmpty(str)) {
                                new l(com.mbridge.msdk.foundation.controller.a.d().f()).b(parseCampaignWithBackData.getRequestId(), parseCampaignWithBackData.getRequestIdNotice(), parseCampaignWithBackData.getId(), str2, str, parseCampaignWithBackData.isBidCampaign());
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                    c.this.a(parseCampaignWithBackData);
                }
            } catch (Exception e2) {
                y.d("BannerShowManager", e2.getMessage());
            }
        }
    };
    private com.mbridge.msdk.mbsignalcommon.b.b D = new com.mbridge.msdk.mbsignalcommon.b.b() {
        @Override
        public final void a(WebView webView, String str) {
            c.this.l = true;
            y.d("BannerCallJS", "fireOnSignalCommunication");
            g.a().a(webView);
            c.this.n = true;
            if (c.this.d == null || c.this.d.isHasMBTplMark()) {
                return;
            }
            c.this.d();
            c.this.a("", 1);
        }

        @Override
        public final void a(WebView webView, int i, String str, String str2) {
            c.this.a(str);
            c.this.a(str, 2);
        }

        @Override
        public final void a(WebView webView) {
            c.this.c();
        }
    };

    public c(MBBannerView mBBannerView, com.mbridge.msdk.mbbanner.common.b.c cVar, String str, String str2, boolean z, e eVar) {
        this.c = z;
        this.e = mBBannerView;
        this.q = str2;
        this.r = str;
        this.f3918b = new f(cVar, eVar);
    }

    public void d() {
        boolean z;
        boolean z2;
        MBBannerView mBBannerView;
        if (this.l && !this.m && this.f3918b != null) {
            this.m = true;
            this.x.removeCallbacks(this.y);
            CampaignEx campaignEx = this.d;
            if (campaignEx != null && !campaignEx.isCallbacked()) {
                this.d.setCallbacked(true);
                this.f3918b.a(this.s);
                com.mbridge.msdk.click.b.a(com.mbridge.msdk.foundation.controller.a.d().f(), this.d.getMaitve(), this.d.getMaitve_src());
            }
        }
        if (!this.l || !this.j || !this.k || !this.m || this.d == null || e()) {
            return;
        }
        if (this.e != null) {
            CampaignEx campaignEx2 = this.d;
            if (!al.a(this.e, campaignEx2 != null ? campaignEx2.getImpReportType() : 0) && !this.o) {
                z = true;
                if (!z && (mBBannerView = this.e) != null) {
                    mBBannerView.postDelayed(new Runnable() {
                        @Override
                        public final void run() {
                            c.this.d();
                        }
                    }, 1000L);
                }
                if (this.n || !z) {
                    z2 = z;
                } else {
                    int[] iArr = new int[2];
                    this.e.getLocationInWindow(iArr);
                    MBBannerWebView mBBannerWebView = this.g;
                    float f = iArr[0];
                    float f2 = iArr[1];
                    y.d("BannerCallJS", "fireOnBannerWebViewShow");
                    try {
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put("startX", f);
                        jSONObject.put("startY", f2);
                        jSONObject.put("scale", ad.e(com.mbridge.msdk.foundation.controller.a.d().f()));
                        g.a().a((WebView) mBBannerWebView, "webviewshow", Base64.encodeToString(jSONObject.toString().getBytes(), 2));
                    } catch (Throwable th) {
                        y.b("BannerCallJS", "fireOnBannerWebViewShow", th);
                    }
                    MBBannerWebView mBBannerWebView2 = this.g;
                    int i = iArr[0];
                    int i2 = iArr[1];
                    int width = this.e.getWidth();
                    int height = this.e.getHeight();
                    try {
                        int i3 = com.mbridge.msdk.foundation.controller.a.d().f().getResources().getConfiguration().orientation;
                        JSONObject jSONObject2 = new JSONObject();
                        jSONObject2.put(AdUnitActivity.EXTRA_ORIENTATION, i3 == 2 ? "landscape" : i3 == 1 ? "portrait" : "undefined");
                        jSONObject2.put("locked", InneractiveMediationDefs.SHOW_HOUSE_AD_YES);
                        float k = u.k(com.mbridge.msdk.foundation.controller.a.d().f());
                        float l = u.l(com.mbridge.msdk.foundation.controller.a.d().f());
                        HashMap m = u.m(com.mbridge.msdk.foundation.controller.a.d().f());
                        int intValue = ((Integer) m.get("width")).intValue();
                        int intValue2 = ((Integer) m.get("height")).intValue();
                        HashMap hashMap = new HashMap();
                        z2 = z;
                        try {
                            hashMap.put("placementType", "inline");
                            hashMap.put("state", Reward.DEFAULT);
                            hashMap.put("viewable", InneractiveMediationDefs.SHOW_HOUSE_AD_YES);
                            hashMap.put("currentAppOrientation", jSONObject2);
                            float f3 = i;
                            float f4 = i2;
                            float f5 = width;
                            float f6 = height;
                            com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(mBBannerWebView2, f3, f4, f5, f6);
                            com.mbridge.msdk.mbsignalcommon.mraid.a.a().b(mBBannerWebView2, f3, f4, f5, f6);
                            com.mbridge.msdk.mbsignalcommon.mraid.a.a().b(mBBannerWebView2, k, l);
                            com.mbridge.msdk.mbsignalcommon.mraid.a.a().c(mBBannerWebView2, intValue, intValue2);
                            com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(mBBannerWebView2, hashMap);
                            com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(mBBannerWebView2);
                        } catch (Throwable th2) {
                            th = th2;
                            y.b("BannerCallJS", "transInfoForMraid", th);
                            this.n = false;
                            if (!TextUtils.isEmpty(this.d.getImageUrl())) {
                            }
                            i.a().a("2000133", this.d, new HashMap());
                            if (z2) {
                            }
                        }
                    } catch (Throwable th3) {
                        th = th3;
                        z2 = z;
                    }
                    this.n = false;
                    if (!TextUtils.isEmpty(this.d.getImageUrl())) {
                        com.mbridge.msdk.foundation.same.c.b.a(com.mbridge.msdk.foundation.controller.a.d().f()).c(this.d.getImageUrl());
                    }
                    i.a().a("2000133", this.d, new HashMap());
                }
                if (z2) {
                    ImageView imageView = this.f;
                    if (imageView != null && imageView.getVisibility() == 0) {
                        CampaignEx campaignEx3 = this.d;
                        if (campaignEx3 != null) {
                            if (campaignEx3 != null) {
                                c(campaignEx3, com.mbridge.msdk.foundation.controller.a.d().f(), this.q);
                                b(campaignEx3, com.mbridge.msdk.foundation.controller.a.d().f(), this.q);
                                a(campaignEx3, com.mbridge.msdk.foundation.controller.a.d().f(), this.q);
                            }
                            this.d.setReport(true);
                            d.a(this.q, this.d, "banner");
                        }
                    } else {
                        List<CampaignEx> list = this.s;
                        if (list != null && list.size() > 0) {
                            boolean z3 = false;
                            int i4 = 0;
                            for (int i5 = 0; i5 < this.s.size(); i5++) {
                                if (!this.s.get(i5).isHasMBTplMark() && (i5 == 0 || !this.s.get(i5).isReport())) {
                                    c(this.s.get(i5), com.mbridge.msdk.foundation.controller.a.d().f(), this.q);
                                    this.s.get(i5).setReport(true);
                                    d.a(this.q, this.s.get(i5), "banner");
                                    i4 = i5;
                                    z3 = true;
                                }
                            }
                            if (z3) {
                                b(this.s.get(i4), com.mbridge.msdk.foundation.controller.a.d().f(), this.q);
                                a(this.s.get(i4), com.mbridge.msdk.foundation.controller.a.d().f(), this.q);
                            }
                        }
                    }
                    this.p = true;
                    com.mbridge.msdk.mbbanner.common.b.c cVar = this.f3918b;
                    if (cVar != null) {
                        cVar.a(this.d);
                    }
                    try {
                        CampaignEx campaignEx4 = this.d;
                        if (campaignEx4 != null && campaignEx4.isActiveOm()) {
                            Context f7 = com.mbridge.msdk.foundation.controller.a.d().f();
                            MBBannerWebView mBBannerWebView3 = this.g;
                            AdSession a = com.mbridge.msdk.a.b.a(f7, mBBannerWebView3, mBBannerWebView3.getUrl(), this.d);
                            this.w = a;
                            if (a != null) {
                                try {
                                    a.registerAdView(this.g);
                                    ImageView imageView2 = this.h;
                                    if (imageView2 != null) {
                                        this.w.addFriendlyObstruction(imageView2, FriendlyObstructionPurpose.VIDEO_CONTROLS, null);
                                    }
                                    ImageView imageView3 = this.f;
                                    if (imageView3 != null) {
                                        this.w.addFriendlyObstruction(imageView3, FriendlyObstructionPurpose.OTHER, null);
                                    }
                                    this.w.start();
                                } catch (Exception e) {
                                    y.a("OMSDK", e.getMessage());
                                }
                            } else {
                                CampaignEx campaignEx5 = this.d;
                                if (campaignEx5 != null) {
                                    new l(com.mbridge.msdk.foundation.controller.a.d().f()).a(campaignEx5.getRequestId(), this.d.getRequestIdNotice(), this.d.getId(), this.q, "fetch OM failed, context null");
                                }
                            }
                        }
                    } catch (Exception unused) {
                        CampaignEx campaignEx6 = this.d;
                        if (campaignEx6 != null) {
                            new l(com.mbridge.msdk.foundation.controller.a.d().f()).a(campaignEx6.getRequestId(), this.d.getRequestIdNotice(), this.d.getId(), this.q, "fetch OM failed, context null");
                        }
                    }
                    this.x.sendEmptyMessageDelayed(1, 1000L);
                    m.a(com.mbridge.msdk.foundation.controller.a.d().f(), this.d, this.q, "");
                    BitmapDrawable a2 = com.mbridge.msdk.foundation.controller.a.d().a(this.q, this.d.getAdType());
                    if (a2 != null) {
                        if (this.i == null) {
                            this.i = new ImageView(com.mbridge.msdk.foundation.controller.a.d().f());
                        }
                        if (this.i.getVisibility() != 0) {
                            this.i.setVisibility(0);
                        }
                        ad.a(this.i, a2, this.e.getResources().getDisplayMetrics());
                        if (this.i.getParent() == null) {
                            this.e.addView(this.i, new ViewGroup.LayoutParams(-1, -1));
                            return;
                        }
                        return;
                    }
                    return;
                }
                this.d.setReport(false);
                return;
            }
        }
        z = false;
        if (!z) {
            mBBannerView.postDelayed(new Runnable() {
                @Override
                public final void run() {
                    c.this.d();
                }
            }, 1000L);
        }
        if (this.n) {
        }
        z2 = z;
        if (z2) {
        }
    }

    static void n(c cVar) {
        if (cVar.f != null) {
            MBBannerWebView mBBannerWebView = cVar.g;
            if (mBBannerWebView != null) {
                mBBannerWebView.setVisibility(8);
            }
            if (cVar.f.getVisibility() != 0) {
                cVar.f.setVisibility(0);
            }
            if (cVar.e != null) {
                RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
                layoutParams.addRule(10);
                cVar.f.setScaleType(ImageView.ScaleType.FIT_XY);
                if (cVar.f.getParent() == null) {
                    cVar.e.addView(cVar.f, layoutParams);
                }
                cVar.d(true);
            }
        }
    }

    public void c() {
        if (this.e != null) {
            MBBannerWebView mBBannerWebView = this.g;
            if (mBBannerWebView != null && mBBannerWebView.getParent() != null) {
                this.e.removeView(this.g);
            }
            if (this.f == null) {
                ImageView imageView = new ImageView(com.mbridge.msdk.foundation.controller.a.d().f());
                this.f = imageView;
                imageView.setOnTouchListener(new View.OnTouchListener() {
                    @Override
                    public final boolean onTouch(View view, MotionEvent motionEvent) {
                        c.this.z = motionEvent.getRawX();
                        c.this.A = motionEvent.getRawY();
                        y.d("BannerShowManager", c.this.z + "  " + c.this.A);
                        return false;
                    }
                });
                this.f.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        c.this.a(BannerUtils.managerCampaignEX(com.mbridge.msdk.mbsignalcommon.communication.b.a(c.this.z, c.this.A), c.this.d));
                    }
                });
            }
            String imageUrl = this.d.getImageUrl();
            if (!TextUtils.isEmpty(imageUrl)) {
                com.mbridge.msdk.foundation.same.c.b.a(com.mbridge.msdk.foundation.controller.a.d().f()).a(imageUrl, new com.mbridge.msdk.foundation.same.c.c() {
                    @Override
                    public final void onFailedLoad(String str, String str2) {
                        c.this.a("banner show failed because banner default view is exception");
                    }

                    @Override
                    public final void onSuccessLoad(Bitmap bitmap, String str) {
                        if (c.this.f != null) {
                            c.this.f.setImageBitmap(bitmap);
                        }
                        c.this.l = true;
                        c.n(c.this);
                        c.this.f();
                        c.this.g();
                        if (c.this.p) {
                            return;
                        }
                        c.this.d();
                    }
                });
                return;
            } else {
                a("banner show failed because campain is exception");
                return;
            }
        }
        a("banner show failed because banner view is exception");
    }

    private synchronized boolean e() {
        boolean isReport;
        isReport = this.d.isReport();
        if (!isReport) {
            this.d.setReport(true);
        }
        return isReport;
    }

    public void f() {
        ImageView imageView;
        if (!this.c || (imageView = this.h) == null) {
            return;
        }
        if (imageView.getVisibility() != 0) {
            this.h.setVisibility(0);
            this.h.setOnClickListener(this.B);
        }
        if (this.h.getParent() != null || this.e == null) {
            return;
        }
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ad.b(com.mbridge.msdk.foundation.controller.a.d().f(), 12.0f), ad.b(com.mbridge.msdk.foundation.controller.a.d().f(), 12.0f));
        layoutParams.addRule(11);
        layoutParams.addRule(10);
        this.e.addView(this.h, layoutParams);
    }

    public void g() {
        if (this.e == null) {
            return;
        }
        CampaignEx campaignEx = this.d;
        if (campaignEx != null) {
            if (!(campaignEx.getPrivacyButtonTemplateVisibility() == 1)) {
                return;
            }
        }
        MBAdChoice mBAdChoice = new MBAdChoice(com.mbridge.msdk.foundation.controller.a.d().f());
        mBAdChoice.setCampaign(this.d);
        mBAdChoice.setFeedbackDialogEventListener(new com.mbridge.msdk.foundation.b.a() {
            @Override
            public final void a() {
                String str;
                try {
                    JSONObject jSONObject = new JSONObject();
                    if (com.mbridge.msdk.foundation.controller.a.d().f() != null) {
                        jSONObject.put("status", 1);
                    }
                    str = jSONObject.toString();
                } catch (Throwable th) {
                    y.b("BannerShowManager", th.getMessage(), th);
                    str = "";
                }
                g.a().a((WebView) c.this.g, "onFeedbackAlertStatusNotify", Base64.encodeToString(str.getBytes(), 2));
            }

            @Override
            public final void b() {
                String str;
                try {
                    JSONObject jSONObject = new JSONObject();
                    if (com.mbridge.msdk.foundation.controller.a.d().f() != null) {
                        jSONObject.put("status", 2);
                    }
                    str = jSONObject.toString();
                } catch (Throwable th) {
                    y.b("BannerShowManager", th.getMessage(), th);
                    str = "";
                }
                g.a().a((WebView) c.this.g, "onFeedbackAlertStatusNotify", Base64.encodeToString(str.getBytes(), 2));
            }

            @Override
            public final void a(String str) {
                String str2;
                try {
                    JSONObject jSONObject = new JSONObject();
                    if (com.mbridge.msdk.foundation.controller.a.d().f() != null) {
                        jSONObject.put("status", 1);
                    }
                    str2 = jSONObject.toString();
                } catch (Throwable th) {
                    y.b("BannerShowManager", th.getMessage(), th);
                    str2 = "";
                }
                g.a().a((WebView) c.this.g, "onFeedbackAlertStatusNotify", Base64.encodeToString(str2.getBytes(), 2));
            }
        });
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(ad.b(com.mbridge.msdk.foundation.controller.a.d().f(), 6.0f), ad.b(com.mbridge.msdk.foundation.controller.a.d().f(), 6.0f));
        layoutParams.addRule(11);
        layoutParams.addRule(12);
        this.e.addView(mBAdChoice, layoutParams);
    }

    private boolean b() {
        String b2 = b(this.d);
        if (TextUtils.isEmpty(b2)) {
            return false;
        }
        if (this.e != null) {
            if (this.g == null) {
                try {
                    MBBannerWebView mBBannerWebView = new MBBannerWebView(com.mbridge.msdk.foundation.controller.a.d().f());
                    this.g = mBBannerWebView;
                    mBBannerWebView.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
                    this.g.setWebViewClient(new com.mbridge.msdk.mbbanner.view.a(this.q, this.s, this.C));
                } catch (Throwable unused) {
                    a("banner show failed because WebView is not available and try to show default", 1);
                    return false;
                }
            }
            ImageView imageView = this.f;
            if (imageView != null) {
                imageView.setVisibility(8);
            }
            if (this.g.getVisibility() != 0) {
                this.g.setVisibility(0);
            }
            if (this.g.getParent() == null) {
                this.e.addView(this.g);
            }
            d(this.d.isMraid());
            if (this.d.isMraid()) {
                g();
            }
            this.d.setCampaignUnitId(this.q);
            com.mbridge.msdk.foundation.b.b.a().a(this.q, this.d);
            f();
            com.mbridge.msdk.mbbanner.common.bridge.a aVar = new com.mbridge.msdk.mbbanner.common.bridge.a(this.e.getContext(), this.r, this.q);
            this.v = aVar;
            aVar.a(this.s);
            this.v.a(this.C);
            this.v.a(this.t);
            this.g.setWebViewListener(this.D);
            this.g.setObject(this.v);
            if (!b2.startsWith("file")) {
                if (this.d.isActiveOm()) {
                    b2 = com.mbridge.msdk.a.b.c(b2);
                }
                this.g.loadDataWithBaseURL(this.d.getBannerUrl(), b2, "text/html", "utf-8", null);
            } else {
                this.g.loadUrl(b2);
            }
        } else {
            a("banner render failed because banner view is null", 2);
            a("banner show failed because banner view is exception");
        }
        return true;
    }

    public final void a(boolean z, int i) {
        this.t = i;
        if (i == 0) {
            e e = com.mbridge.msdk.c.c.a().e(com.mbridge.msdk.foundation.controller.a.d().g(), this.q);
            if (e == null) {
                return;
            }
            z = e.d() == 1;
        }
        this.c = z;
    }

    public final void a(boolean z) {
        this.c = z;
    }

    public void a(String str) {
        if (this.d == null || e()) {
            return;
        }
        this.x.removeCallbacks(this.y);
        com.mbridge.msdk.mbbanner.common.b.c cVar = this.f3918b;
        if (cVar != null) {
            cVar.a(str);
        }
        m.b(com.mbridge.msdk.foundation.controller.a.d().f(), this.d, this.q, str);
    }

    public final void c(boolean z) {
        this.k = z;
        d();
    }

    private void c(final CampaignEx campaignEx, final Context context, String str) {
        if (!TextUtils.isEmpty(campaignEx.getImpressionURL())) {
            new Thread(new Runnable() {
                @Override
                public final void run() {
                    try {
                        j.a(com.mbridge.msdk.foundation.db.g.a(context)).b(campaignEx.getId());
                    } catch (Exception e) {
                        y.d("BannerShowManager", e.getMessage());
                    }
                }
            }).start();
            com.mbridge.msdk.click.a.a(context, campaignEx, str, campaignEx.getImpressionURL(), false, true, com.mbridge.msdk.click.a.a.g);
        }
        if (TextUtils.isEmpty(str) || campaignEx.getNativeVideoTracking() == null || campaignEx.getNativeVideoTracking().i() == null) {
            return;
        }
        i.a().a("2000141", campaignEx, new HashMap());
        com.mbridge.msdk.click.a.a(context, campaignEx, str, campaignEx.getNativeVideoTracking().i(), false, false);
    }

    public final void a() {
        AdSession adSession = this.w;
        if (adSession != null) {
            adSession.finish();
            this.w = null;
        }
        if (this.f3918b != null) {
            this.f3918b = null;
        }
        MBBannerWebView mBBannerWebView = this.g;
        if (mBBannerWebView != null) {
            mBBannerWebView.setWebViewListener(null);
        }
        if (this.D != null) {
            this.D = null;
        }
        ImageView imageView = this.h;
        if (imageView != null) {
            imageView.setOnClickListener(null);
        }
        ImageView imageView2 = this.f;
        if (imageView2 != null) {
            imageView2.setOnClickListener(null);
        }
        MBBannerView mBBannerView = this.e;
        if (mBBannerView != null) {
            mBBannerView.removeAllViews();
        }
        MBBannerWebView mBBannerWebView2 = this.g;
        if (mBBannerWebView2 != null) {
            mBBannerWebView2.release();
        }
        com.mbridge.msdk.mbbanner.common.bridge.a aVar = this.v;
        if (aVar != null) {
            aVar.a();
        }
        if (this.C != null) {
            this.C = null;
        }
        com.mbridge.msdk.foundation.b.b.a().c(this.q);
    }

    static void c(c cVar) {
        MBBannerWebView mBBannerWebView = cVar.g;
        if (mBBannerWebView != null && mBBannerWebView.getParent() != null) {
            cVar.e.removeView(cVar.g);
        }
        ImageView imageView = cVar.f;
        if (imageView != null && imageView.getParent() != null) {
            cVar.f.setVisibility(8);
            cVar.e.removeView(cVar.f);
        }
        ImageView imageView2 = cVar.h;
        if (imageView2 != null && imageView2.getParent() != null) {
            cVar.e.removeView(cVar.h);
            cVar.h.setVisibility(8);
        }
        ImageView imageView3 = cVar.i;
        if (imageView3 != null && imageView3.getParent() != null) {
            cVar.e.removeView(cVar.i);
            cVar.i.setVisibility(8);
        }
        com.mbridge.msdk.mbbanner.common.a.a c = com.mbridge.msdk.mbbanner.common.a.a.a().b(cVar.q).e(cVar.d.getRequestId()).d(cVar.d.getRequestIdNotice()).c(cVar.d.getId());
        com.mbridge.msdk.mbbanner.common.a.a a = c.f(cVar.d.getCreativeId() + "").a(cVar.d.isBidCampaign());
        String str = cVar.q;
        if (a != null) {
            a.a("2000069");
            if (com.mbridge.msdk.foundation.same.report.g.a().c()) {
                com.mbridge.msdk.foundation.same.report.g.a().a(a.b());
            } else {
                com.mbridge.msdk.foundation.same.report.j.a(a.b(), com.mbridge.msdk.foundation.controller.a.d().f(), str);
            }
        }
        BannerUtils.inserCloseId(cVar.q, cVar.s);
        com.mbridge.msdk.mbbanner.common.b.c cVar2 = cVar.f3918b;
        if (cVar2 != null) {
            cVar2.e();
        }
    }

    private String b(CampaignEx campaignEx) {
        String str;
        if (campaignEx != null) {
            String b2 = h.a().b(campaignEx.getBannerUrl());
            if (TextUtils.isEmpty(b2)) {
                String bannerHtml = campaignEx.getBannerHtml();
                if (campaignEx.isActiveOm()) {
                    try {
                        File file = new File(bannerHtml);
                        str = ScriptInjector.injectScriptContentIntoHtml(MBridgeConstans.OMID_JS_SERVICE_CONTENT, file.exists() ? w.a(file) : "");
                    } catch (Exception unused) {
                        File file2 = new File(bannerHtml);
                        if (file2.exists() && file2.isFile() && file2.canRead()) {
                            str = "file:////" + bannerHtml;
                        }
                    }
                    return str;
                }
                File file3 = new File(bannerHtml);
                if (file3.exists() && file3.isFile() && file3.canRead()) {
                    str = "file:////" + bannerHtml;
                    return str;
                }
                return bannerHtml;
            }
            return ScriptInjector.injectScriptContentIntoHtml(MBridgeConstans.OMID_JS_SERVICE_CONTENT, b2);
        }
        return "";
    }

    private void a(CampaignEx campaignEx, Context context, String str) {
        if (campaignEx != null) {
            try {
                List<String> pv_urls = campaignEx.getPv_urls();
                if (pv_urls == null || pv_urls.size() <= 0) {
                    return;
                }
                for (String str2 : pv_urls) {
                    com.mbridge.msdk.click.a.a(context, campaignEx, str, str2, false, true);
                }
            } catch (Throwable th) {
                y.d("BannerShowManager", th.getMessage());
            }
        }
    }

    public final void a(CampaignEx campaignEx) {
        if (this.p) {
            if (this.a == null) {
                this.a = new com.mbridge.msdk.click.a(com.mbridge.msdk.foundation.controller.a.d().f(), this.q);
            }
            this.a.a(new NativeListener.TrackingExListener() {
                @Override
                public final void onDismissLoading(Campaign campaign) {
                }

                @Override
                public final void onDownloadFinish(Campaign campaign) {
                }

                @Override
                public final void onDownloadProgress(int i) {
                }

                @Override
                public final void onDownloadStart(Campaign campaign) {
                }

                @Override
                public final void onFinishRedirection(Campaign campaign, String str) {
                    ac.b(campaign, c.this.e);
                }

                @Override
                public final boolean onInterceptDefaultLoadingDialog() {
                    return false;
                }

                @Override
                public final void onLeaveApp() {
                    if (c.this.f3918b != null) {
                        c.this.f3918b.b();
                    }
                }

                @Override
                public final void onRedirectionFailed(Campaign campaign, String str) {
                    ac.b(campaign, c.this.e);
                }

                @Override
                public final void onShowLoading(Campaign campaign) {
                }

                @Override
                public final void onStartRedirection(Campaign campaign, String str) {
                    ac.a(campaign, c.this.e);
                }
            });
            campaignEx.setCampaignUnitId(this.q);
            this.a.a(campaignEx);
            if (!this.d.isReportClick()) {
                this.d.setReportClick(true);
                Context f = com.mbridge.msdk.foundation.controller.a.d().f();
                if (campaignEx.getNativeVideoTracking() != null && campaignEx.getNativeVideoTracking().e() != null) {
                    i.a().a("2000142", campaignEx, new HashMap());
                    com.mbridge.msdk.click.a.a(f, campaignEx, campaignEx.getCampaignUnitId(), campaignEx.getNativeVideoTracking().e(), false, false);
                }
            }
            com.mbridge.msdk.mbbanner.common.b.c cVar = this.f3918b;
            if (cVar != null) {
                cVar.a();
            }
        }
    }

    public final void b(boolean z) {
        this.j = z;
        d();
        if (z) {
            return;
        }
        CampaignEx campaignEx = this.d;
        String str = this.q;
        if (campaignEx != null) {
            String a = com.mbridge.msdk.mbsignalcommon.mraid.c.a(campaignEx.getId());
            if (TextUtils.isEmpty(a)) {
                return;
            }
            new l(com.mbridge.msdk.foundation.controller.a.d().f()).a(campaignEx.getRequestId(), campaignEx.getRequestIdNotice(), campaignEx.getId(), str, a, campaignEx.isBidCampaign());
            com.mbridge.msdk.mbsignalcommon.mraid.c.b(campaignEx.getId());
        }
    }

    public void a(String str, int i) {
        if (this.d != null) {
            com.mbridge.msdk.mbbanner.common.d.a.a(com.mbridge.msdk.mbbanner.common.a.a.a().c(this.d.getId()).b(this.q).e(this.d.getRequestId()).d(this.d.getRequestIdNotice()).g(str).a(i).a(this.d.isBidCampaign()), this.q);
        }
    }

    public final void a(int i, int i2, int i3, int i4) {
        if (i == i3 && i2 == i4) {
            return;
        }
        MBBannerWebView mBBannerWebView = this.g;
        y.d("BannerCallJS", "fireOnBannerViewSizeChange");
        try {
            com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(mBBannerWebView, i, i2);
        } catch (Throwable th) {
            y.b("BannerCallJS", "fireOnBannerViewSizeChange", th);
        }
    }

    private void b(CampaignEx campaignEx, Context context, String str) {
        if (campaignEx != null) {
            try {
                if (TextUtils.isEmpty(campaignEx.getOnlyImpressionURL())) {
                    return;
                }
                com.mbridge.msdk.click.a.a(context, campaignEx, str, campaignEx.getOnlyImpressionURL(), false, true, com.mbridge.msdk.click.a.a.h);
            } catch (Throwable th) {
                y.d("BannerShowManager", th.getMessage());
            }
        }
    }

    public final void a(CampaignUnit campaignUnit) {
        CampaignEx campaignEx;
        if (campaignUnit != null) {
            ArrayList<CampaignEx> ads = campaignUnit.getAds();
            this.s = ads;
            if (ads != null && ads.size() > 0) {
                campaignEx = this.s.get(0);
                this.d = campaignEx;
                if (campaignEx != null) {
                    a("banner show failed because campain is exception");
                    return;
                }
                this.x.removeCallbacks(this.y);
                if (this.c && this.h == null) {
                    ImageView imageView = new ImageView(com.mbridge.msdk.foundation.controller.a.d().f());
                    this.h = imageView;
                    imageView.setBackgroundResource(r.a(com.mbridge.msdk.foundation.controller.a.d().f(), "mbridge_banner_close", "drawable"));
                    this.h.setVisibility(8);
                    this.h.setContentDescription("closeButton");
                }
                this.l = false;
                this.m = false;
                this.p = false;
                if (!TextUtils.isEmpty(this.d.getBannerHtml()) || !TextUtils.isEmpty(this.d.getBannerUrl())) {
                    com.mbridge.msdk.mbbanner.common.a.a a = com.mbridge.msdk.mbbanner.common.a.a.a().c(this.d.getId()).e(this.d.getRequestId()).d(this.d.getRequestIdNotice()).b(this.q).a(this.d.isBidCampaign());
                    String str = this.q;
                    if (a != null) {
                        a.a("2000067");
                        if (com.mbridge.msdk.foundation.same.report.g.a().c()) {
                            com.mbridge.msdk.foundation.same.report.g.a().a(a.b());
                        } else {
                            com.mbridge.msdk.foundation.same.report.j.a(a.b(), com.mbridge.msdk.foundation.controller.a.d().f(), str);
                        }
                    }
                }
                this.x.postDelayed(this.y, C.DEFAULT_SEEK_FORWARD_INCREMENT_MS);
                if (b()) {
                    return;
                }
                if (!TextUtils.isEmpty(this.d.getBannerHtml()) || !TextUtils.isEmpty(this.d.getBannerUrl())) {
                    a("banner render failed because res load failed", 2);
                }
                c();
                return;
            }
        }
        campaignEx = null;
        this.d = campaignEx;
        if (campaignEx != null) {
        }
    }

    private void d(boolean z) {
        if (this.e != null) {
            FeedBackButton b2 = com.mbridge.msdk.foundation.b.b.a().b(this.q);
            if (com.mbridge.msdk.foundation.b.b.a().b() && z && b2 != null) {
                ViewGroup viewGroup = (ViewGroup) b2.getParent();
                if (viewGroup != null) {
                    viewGroup.removeView(b2);
                }
                b2.setVisibility(0);
                RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) b2.getLayoutParams();
                if (layoutParams == null) {
                    layoutParams = new RelativeLayout.LayoutParams(com.mbridge.msdk.foundation.b.b.a, com.mbridge.msdk.foundation.b.b.f3732b);
                }
                layoutParams.addRule(12);
                b2.setLayoutParams(layoutParams);
                this.e.addView(b2);
            }
            com.mbridge.msdk.foundation.b.b.a().a(this.q, new com.mbridge.msdk.foundation.b.a() {
                @Override
                public final void a() {
                    String str;
                    c.this.e.onPause();
                    try {
                        JSONObject jSONObject = new JSONObject();
                        if (com.mbridge.msdk.foundation.controller.a.d().f() != null) {
                            jSONObject.put("status", 1);
                        }
                        str = jSONObject.toString();
                    } catch (Throwable th) {
                        y.b("BannerShowManager", th.getMessage(), th);
                        str = "";
                    }
                    g.a().a((WebView) c.this.g, "onFeedbackAlertStatusNotify", Base64.encodeToString(str.getBytes(), 2));
                }

                @Override
                public final void b() {
                    String str;
                    c.this.e.onResume();
                    try {
                        JSONObject jSONObject = new JSONObject();
                        if (com.mbridge.msdk.foundation.controller.a.d().f() != null) {
                            jSONObject.put("status", 2);
                        }
                        str = jSONObject.toString();
                    } catch (Throwable th) {
                        y.b("BannerShowManager", th.getMessage(), th);
                        str = "";
                    }
                    g.a().a((WebView) c.this.g, "onFeedbackAlertStatusNotify", Base64.encodeToString(str.getBytes(), 2));
                }

                @Override
                public final void a(String str) {
                    String str2;
                    c.this.e.onResume();
                    try {
                        JSONObject jSONObject = new JSONObject();
                        if (com.mbridge.msdk.foundation.controller.a.d().f() != null) {
                            jSONObject.put("status", 2);
                        }
                        str2 = jSONObject.toString();
                    } catch (Throwable th) {
                        y.b("BannerShowManager", th.getMessage(), th);
                        str2 = "";
                    }
                    g.a().a((WebView) c.this.g, "onFeedbackAlertStatusNotify", Base64.encodeToString(str2.getBytes(), 2));
                }
            });
            this.d.setCampaignUnitId(this.q);
            com.mbridge.msdk.foundation.b.b.a().a(this.q, this.d);
        }
    }

    static void d(c cVar) {
        ImageView imageView;
        if (cVar.c && (imageView = cVar.h) != null && imageView.getVisibility() == 0) {
            cVar.h.setVisibility(8);
            cVar.h.setOnClickListener(null);
            if (cVar.e == null || cVar.h.getParent() == null) {
                return;
            }
            cVar.e.removeView(cVar.h);
        }
    }
}