翰林优商.apk(点击下载) / j.java


package com.iBookStar.a;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.baidu.mobad.feeds.BaiduNative;
import com.baidu.mobad.feeds.NativeErrorCode;
import com.baidu.mobad.feeds.NativeResponse;
import com.baidu.mobad.feeds.XAdNativeResponse;
import com.baidu.mobads.AdView;
import com.baidu.mobads.AdViewListener;
import com.baidu.mobads.AppActivity;
import com.baidu.mobads.component.FeedNativeView;
import com.bytedance.sdk.openadsdk.AdSlot;
import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTNativeExpressAd;
import com.iBookStar.R;
import com.iBookStar.utils.k;
import com.iBookStar.utils.m;
import com.iBookStar.utils.p;
import com.iBookStar.utils.s;
import com.iBookStar.views.YmConfig;
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
import com.qq.e.ads.banner2.UnifiedBannerADListener;
import com.qq.e.ads.banner2.UnifiedBannerView;
import com.qq.e.ads.cfg.VideoOption;
import com.qq.e.ads.nativ.ADSize;
import com.qq.e.ads.nativ.NativeExpressAD;
import com.qq.e.ads.nativ.NativeExpressADView;
import com.qq.e.ads.nativ.NativeExpressMediaListener;
import com.qq.e.comm.managers.GDTADManager;
import com.qq.e.comm.managers.status.SDKStatus;
import com.qq.e.comm.util.AdError;
import com.sogou.feedads.api.AdClient;
import com.sogou.feedads.api.opensdk.SGAdError;
import com.sogou.feedads.api.opensdk.SGAdNative;
import com.sogou.feedads.api.opensdk.SGBannerAd;
import com.sogou.feedads.api.opensdk.SGFeedAd;
import java.util.List;
import org.json.JSONObject;

public class j {
    private i a;
    private TTNativeExpressAd b;
    private NativeExpressADView c;
    private UnifiedBannerView d;
    private BaiduNative e;
    private NativeResponse f;
    private AdView g;
    private SGBannerAd h;
    private SGFeedAd i;

    /* access modifiers changed from: package-private */
    public class a implements TTAdNative.NativeExpressAdListener {
        final /* synthetic */ f a;

        /* renamed from: com.iBookStar.a.j$a$a  reason: collision with other inner class name */
        class C0058a implements TTNativeExpressAd.ExpressVideoAdListener {
            C0058a() {
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.ExpressVideoAdListener
            public void onClickRetry() {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadNativeExpressAd onClickRetry, cid=%s", a.this.a.s()));
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.ExpressVideoAdListener
            public void onProgressUpdate(long j, long j2) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadNativeExpressAd onProgressUpdate, cid=%s, %d/%d", a.this.a.s(), Long.valueOf(j), Long.valueOf(j2)));
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.ExpressVideoAdListener
            public void onVideoAdComplete() {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadNativeExpressAd onVideoAdComplete, cid=%s", a.this.a.s()));
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.ExpressVideoAdListener
            public void onVideoAdContinuePlay() {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadNativeExpressAd onVideoAdContinuePlay, cid=%s", a.this.a.s()));
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.ExpressVideoAdListener
            public void onVideoAdPaused() {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadNativeExpressAd onVideoAdPaused, cid=%s", a.this.a.s()));
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.ExpressVideoAdListener
            public void onVideoAdStartPlay() {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadNativeExpressAd onVideoAdStartPlay, cid=%s", a.this.a.s()));
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.ExpressVideoAdListener
            public void onVideoError(int i, int i2) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadNativeExpressAd onVideoError, cid=%s", a.this.a.s()));
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.ExpressVideoAdListener
            public void onVideoLoad() {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadNativeExpressAd onVideoLoad, cid=%s", a.this.a.s()));
            }
        }

        class b implements TTNativeExpressAd.AdInteractionListener {
            b() {
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.ExpressAdInteractionListener
            public void onAdClicked(View view, int i) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadNativeExpressAd onAdClicked, cid=%s, i=%d", a.this.a.s(), Integer.valueOf(i)));
                if (j.this.a != null) {
                    j.this.a.onAdClick(a.this.a, view);
                }
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.AdInteractionListener
            public void onAdDismiss() {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadNativeExpressAd onAdClicked, cid=%s", a.this.a.s()));
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.ExpressAdInteractionListener
            public void onAdShow(View view, int i) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadNativeExpressAd onAdShow, cid=%s, i=%d", a.this.a.s(), Integer.valueOf(i)));
                if (j.this.a != null) {
                    j.this.a.onAdShow(a.this.a, view);
                }
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.ExpressAdInteractionListener
            public void onRenderFail(View view, String str, int i) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadNativeExpressAd onRenderFail, cid=%s, i=%d, s=%s", a.this.a.s(), Integer.valueOf(i), str));
                if (j.this.a != null) {
                    j.this.a.onAdRenderFail(a.this.a);
                }
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.ExpressAdInteractionListener
            public void onRenderSuccess(View view, float f, float f2) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadNativeExpressAd onRenderSuccess, cid=%s, w=%f, h=%f", a.this.a.s(), Float.valueOf(f), Float.valueOf(f2)));
                if (j.this.a != null) {
                    j.this.a.onAdRenderSuccess(a.this.a, view, -2, false);
                }
            }
        }

        a(f fVar) {
            this.a = fVar;
        }

        @Override // com.bytedance.sdk.openadsdk.TTAdNative.NativeExpressAdListener, com.bytedance.sdk.openadsdk.common.CommonListener
        public void onError(int i, String str) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadNativeExpressAd onError, cid=%s, i=%d, s=%s", this.a.s(), Integer.valueOf(i), str));
            if (j.this.a != null) {
                j.this.a.onAdLoadFail(this.a);
            }
        }

        @Override // com.bytedance.sdk.openadsdk.TTAdNative.NativeExpressAdListener
        public void onNativeExpressAdLoad(List<TTNativeExpressAd> list) {
            if (list == null || list.isEmpty()) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadNativeExpressAd onNativeExpressAdLoad empty, cid=%s", this.a.s()));
                if (j.this.a != null) {
                    j.this.a.onAdLoadFail(this.a);
                    return;
                }
                return;
            }
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadNativeExpressAd onNativeExpressAdLoad, cid=%s", this.a.s()));
            j.this.b = list.get(0);
            if (j.this.b.getImageMode() == 5) {
                j.this.b.setVideoAdListener(new C0058a());
            }
            j.this.b.setExpressInteractionListener((TTNativeExpressAd.AdInteractionListener) new b());
            j.this.b.render();
        }
    }

    /* access modifiers changed from: package-private */
    public class b implements TTAdNative.NativeExpressAdListener {
        final /* synthetic */ f a;

        class a implements TTNativeExpressAd.AdInteractionListener {
            a() {
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.ExpressAdInteractionListener
            public void onAdClicked(View view, int i) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadBannerExpressAd onAdClicked, cid=%s, i=%d", b.this.a.s(), Integer.valueOf(i)));
                if (j.this.a != null) {
                    j.this.a.onAdClick(b.this.a, view);
                }
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.AdInteractionListener
            public void onAdDismiss() {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadBannerExpressAd onAdClicked, cid=%s", b.this.a.s()));
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.ExpressAdInteractionListener
            public void onAdShow(View view, int i) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadBannerExpressAd onAdShow, cid=%s, i=%d", b.this.a.s(), Integer.valueOf(i)));
                if (j.this.a != null) {
                    j.this.a.onAdShow(b.this.a, view);
                }
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.ExpressAdInteractionListener
            public void onRenderFail(View view, String str, int i) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadBannerExpressAd onRenderFail, cid=%s, i=%d, s=%s", b.this.a.s(), Integer.valueOf(i), str));
                if (j.this.a != null) {
                    j.this.a.onAdRenderFail(b.this.a);
                }
            }

            @Override // com.bytedance.sdk.openadsdk.TTNativeExpressAd.ExpressAdInteractionListener
            public void onRenderSuccess(View view, float f, float f2) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadBannerExpressAd onRenderSuccess, cid=%s, w=%f, h=%f", b.this.a.s(), Float.valueOf(f), Float.valueOf(f2)));
                if (j.this.a != null) {
                    j.this.a.onAdRenderSuccess(b.this.a, view, -2, false);
                }
            }
        }

        b(f fVar) {
            this.a = fVar;
        }

        @Override // com.bytedance.sdk.openadsdk.TTAdNative.NativeExpressAdListener, com.bytedance.sdk.openadsdk.common.CommonListener
        public void onError(int i, String str) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadBannerExpressAd onError, cid=%s, i=%d, s=%s", this.a.s(), Integer.valueOf(i), str));
            if (j.this.a != null) {
                j.this.a.onAdLoadFail(this.a);
            }
        }

        @Override // com.bytedance.sdk.openadsdk.TTAdNative.NativeExpressAdListener
        public void onNativeExpressAdLoad(List<TTNativeExpressAd> list) {
            if (list == null || list.isEmpty()) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadBannerExpressAd onNativeExpressAdLoad empty, cid=%s", this.a.s()));
                if (j.this.a != null) {
                    j.this.a.onAdLoadFail(this.a);
                    return;
                }
                return;
            }
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,loadBannerExpressAd onNativeExpressAdLoad, cid=%s", this.a.s()));
            j.this.b = list.get(0);
            j.this.b.setExpressInteractionListener((TTNativeExpressAd.AdInteractionListener) new a());
            j.this.b.render();
        }
    }

    /* access modifiers changed from: package-private */
    public class c implements NativeExpressAD.NativeExpressADListener {
        final /* synthetic */ f a;

        class a implements NativeExpressMediaListener {
            a() {
            }

            @Override // com.qq.e.ads.nativ.NativeExpressMediaListener
            public void onVideoCached(NativeExpressADView nativeExpressADView) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onVideoCached, cid=%s", c.this.a.s()));
            }

            @Override // com.qq.e.ads.nativ.NativeExpressMediaListener
            public void onVideoComplete(NativeExpressADView nativeExpressADView) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onVideoComplete, cid=%s", c.this.a.s()));
            }

            @Override // com.qq.e.ads.nativ.NativeExpressMediaListener
            public void onVideoError(NativeExpressADView nativeExpressADView, AdError adError) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onVideoError, cid=%s", c.this.a.s()));
            }

            @Override // com.qq.e.ads.nativ.NativeExpressMediaListener
            public void onVideoInit(NativeExpressADView nativeExpressADView) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onVideoInit, cid=%s", c.this.a.s()));
            }

            @Override // com.qq.e.ads.nativ.NativeExpressMediaListener
            public void onVideoLoading(NativeExpressADView nativeExpressADView) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onVideoLoading, cid=%s", c.this.a.s()));
            }

            @Override // com.qq.e.ads.nativ.NativeExpressMediaListener
            public void onVideoPageClose(NativeExpressADView nativeExpressADView) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onVideoPageClose, cid=%s", c.this.a.s()));
            }

            @Override // com.qq.e.ads.nativ.NativeExpressMediaListener
            public void onVideoPageOpen(NativeExpressADView nativeExpressADView) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onVideoPageOpen, cid=%s", c.this.a.s()));
            }

            @Override // com.qq.e.ads.nativ.NativeExpressMediaListener
            public void onVideoPause(NativeExpressADView nativeExpressADView) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onVideoPause, cid=%s", c.this.a.s()));
            }

            @Override // com.qq.e.ads.nativ.NativeExpressMediaListener
            public void onVideoReady(NativeExpressADView nativeExpressADView, long j) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onVideoReady, cid=%s", c.this.a.s()));
            }

            @Override // com.qq.e.ads.nativ.NativeExpressMediaListener
            public void onVideoStart(NativeExpressADView nativeExpressADView) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onVideoStart, cid=%s", c.this.a.s()));
            }
        }

        c(f fVar) {
            this.a = fVar;
        }

        @Override // com.qq.e.ads.nativ.NativeExpressAD.NativeExpressADListener
        public void onADClicked(NativeExpressADView nativeExpressADView) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onADClicked, cid=%s", this.a.s()));
            if (j.this.a != null) {
                j.this.a.onAdClick(this.a, nativeExpressADView);
            }
        }

        @Override // com.qq.e.ads.nativ.NativeExpressAD.NativeExpressADListener
        public void onADCloseOverlay(NativeExpressADView nativeExpressADView) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onADCloseOverlay, cid=%s", this.a.s()));
        }

        @Override // com.qq.e.ads.nativ.NativeExpressAD.NativeExpressADListener
        public void onADClosed(NativeExpressADView nativeExpressADView) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onADClosed, cid=%s", this.a.s()));
            if (j.this.a != null) {
                j.this.a.onAdClose(this.a, nativeExpressADView);
            }
        }

        @Override // com.qq.e.ads.nativ.NativeExpressAD.NativeExpressADListener
        public void onADExposure(NativeExpressADView nativeExpressADView) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onADExposure, cid=%s", this.a.s()));
            if (j.this.a != null) {
                j.this.a.onAdShow(this.a, nativeExpressADView);
            }
        }

        @Override // com.qq.e.ads.nativ.NativeExpressAD.NativeExpressADListener
        public void onADLeftApplication(NativeExpressADView nativeExpressADView) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onADLeftApplication, cid=%s", this.a.s()));
        }

        @Override // com.qq.e.ads.nativ.NativeExpressAD.NativeExpressADListener
        public void onADLoaded(List<NativeExpressADView> list) {
            if (list == null || list.isEmpty()) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onADLoaded empty, cid=%s", this.a.s()));
                if (j.this.a != null) {
                    j.this.a.onAdLoadFail(this.a);
                    return;
                }
                return;
            }
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onADLoaded, cid=%s", this.a.s()));
            j.this.c = list.get(0);
            if (j.this.c.getBoundData().getAdPatternType() == 2) {
                j.this.c.setMediaListener(new a());
            }
            j.this.c.render();
        }

        @Override // com.qq.e.ads.nativ.NativeExpressAD.NativeExpressADListener
        public void onADOpenOverlay(NativeExpressADView nativeExpressADView) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onADOpenOverlay, cid=%s", this.a.s()));
        }

        @Override // com.qq.e.ads.NativeAbstractAD.BasicADListener
        public void onNoAD(AdError adError) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onNoAD, cid=%s, code=%d, msg=%s", this.a.s(), Integer.valueOf(adError.getErrorCode()), adError.getErrorMsg()));
            if (j.this.a != null) {
                j.this.a.onAdLoadFail(this.a);
            }
        }

        @Override // com.qq.e.ads.nativ.NativeExpressAD.NativeExpressADListener
        public void onRenderFail(NativeExpressADView nativeExpressADView) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onRenderFail, cid=%s", this.a.s()));
            if (j.this.a != null) {
                j.this.a.onAdLoadFail(this.a);
            }
        }

        @Override // com.qq.e.ads.nativ.NativeExpressAD.NativeExpressADListener
        public void onRenderSuccess(NativeExpressADView nativeExpressADView) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,NativeExpressAD onRenderSuccess, cid=%s", this.a.s()));
            if (j.this.a != null) {
                j.this.a.onAdLoadSuccess(this.a, nativeExpressADView, -2, false);
            }
        }
    }

    /* access modifiers changed from: package-private */
    public class d implements UnifiedBannerADListener {
        final /* synthetic */ f a;

        d(f fVar) {
            this.a = fVar;
        }

        @Override // com.qq.e.ads.banner2.UnifiedBannerADListener
        public void onADClicked() {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,UnifiedBannerView onADClicked, cid=%s", this.a.s()));
            if (j.this.a != null) {
                j.this.a.onAdClick(this.a, j.this.d);
            }
        }

        @Override // com.qq.e.ads.banner2.UnifiedBannerADListener
        public void onADCloseOverlay() {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,UnifiedBannerView onADCloseOverlay, cid=%s", this.a.s()));
        }

        @Override // com.qq.e.ads.banner2.UnifiedBannerADListener
        public void onADClosed() {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,UnifiedBannerView onADClosed, cid=%s", this.a.s()));
            if (j.this.a != null) {
                j.this.a.onAdClose(this.a, j.this.d);
            }
        }

        @Override // com.qq.e.ads.banner2.UnifiedBannerADListener
        public void onADExposure() {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,UnifiedBannerView onADExposure, cid=%s", this.a.s()));
            if (j.this.a != null) {
                j.this.a.onAdShow(this.a, j.this.d);
            }
        }

        @Override // com.qq.e.ads.banner2.UnifiedBannerADListener
        public void onADLeftApplication() {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,UnifiedBannerView onADLeftApplication, cid=%s", this.a.s()));
        }

        @Override // com.qq.e.ads.banner2.UnifiedBannerADListener
        public void onADOpenOverlay() {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,UnifiedBannerView onADOpenOverlay, cid=%s", this.a.s()));
        }

        @Override // com.qq.e.ads.banner2.UnifiedBannerADListener
        public void onADReceive() {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,UnifiedBannerView onADReceive, cid=%s", this.a.s()));
            if (j.this.a != null) {
                j.this.a.onAdLoadSuccess(this.a, j.this.d, -2, false);
            }
        }

        @Override // com.qq.e.ads.banner2.UnifiedBannerADListener
        public void onNoAD(AdError adError) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,UnifiedBannerView onNoAD, cid=%s, code=%d, msg=%s", this.a.s(), Integer.valueOf(adError.getErrorCode()), adError.getErrorMsg()));
            if (j.this.a != null) {
                j.this.a.onAdLoadFail(this.a);
            }
        }
    }

    /* access modifiers changed from: package-private */
    public class e implements BaiduNative.FeedLpCloseListener {
        final /* synthetic */ f a;
        final /* synthetic */ Context b;

        e(f fVar, Context context) {
            this.a = fVar;
            this.b = context;
        }

        public void onAdClick(NativeResponse nativeResponse) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,BaiduNative onAdClick, cid=%s", this.a.s()));
            if (j.this.a != null) {
                j.this.a.onAdClick(this.a, null);
            }
        }

        public void onLpClosed() {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,BaiduNative onLpClosed, cid=%s", this.a.s()));
        }

        public void onNativeFail(NativeErrorCode nativeErrorCode) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,BaiduNative onNativeFail, cid=%s, code=%d", this.a.s(), Integer.valueOf(nativeErrorCode.ordinal())));
            if (j.this.a != null) {
                j.this.a.onAdLoadFail(this.a);
            }
        }

        public void onNativeLoad(List<NativeResponse> list) {
            if (list == null || list.isEmpty()) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,BaiduNative onNativeLoad empty, cid=%s", this.a.s()));
                if (j.this.a != null) {
                    j.this.a.onAdLoadFail(this.a);
                    return;
                }
                return;
            }
            try {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,BaiduNative onNativeLoad, cid=%s", this.a.s()));
                NativeResponse nativeResponse = list.get(0);
                View a2 = j.this.a((j) this.b, (Context) this.a, (f) nativeResponse);
                if (a2 != null) {
                    j.this.f = nativeResponse;
                    j.this.f.recordImpression(a2);
                    if (j.this.a != null) {
                        j.this.a.onAdLoadSuccess(this.a, a2, -2, true);
                        j.this.a.onAdShow(this.a, a2);
                    }
                } else if (j.this.a != null) {
                    j.this.a.onAdLoadFail(this.a);
                }
            } catch (Throwable th) {
                th.printStackTrace();
                if (j.this.a != null) {
                    j.this.a.onAdLoadFail(this.a);
                }
            }
        }
    }

    /* access modifiers changed from: package-private */
    public class f implements AdViewListener {
        final /* synthetic */ f a;

        f(f fVar) {
            this.a = fVar;
        }

        public void onAdClick(JSONObject jSONObject) {
            Object[] objArr = new Object[2];
            objArr[0] = this.a.s();
            objArr[1] = jSONObject != null ? jSONObject.toString() : "";
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,AdView onAdClick, cid=%s, msg=%s", objArr));
            if (j.this.a != null) {
                j.this.a.onAdClick(this.a, j.this.g);
            }
        }

        public void onAdClose(JSONObject jSONObject) {
            Object[] objArr = new Object[2];
            objArr[0] = this.a.s();
            objArr[1] = jSONObject != null ? jSONObject.toString() : "";
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,AdView onAdClose, cid=%s, msg=%s", objArr));
            if (j.this.a != null) {
                j.this.a.onAdClose(this.a, j.this.g);
            }
        }

        public void onAdFailed(String str) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,AdView onAdFailed, cid=%s, msg=%s", this.a.s(), str));
            if (j.this.a != null) {
                j.this.a.onAdLoadFail(this.a);
            }
        }

        public void onAdReady(AdView adView) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,AdView onAdReady, cid=%s", this.a.s()));
            if (j.this.a != null) {
                j.this.a.onAdLoadSuccess(this.a, adView, -2, false);
            }
        }

        public void onAdShow(JSONObject jSONObject) {
            Object[] objArr = new Object[2];
            objArr[0] = this.a.s();
            objArr[1] = jSONObject != null ? jSONObject.toString() : "";
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,AdView onAdShow, cid=%s, msg=%s", objArr));
            if (j.this.a != null) {
                j.this.a.onAdShow(this.a, j.this.g);
            }
        }

        public void onAdSwitch() {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,AdView onAdSwitch, cid=%s", this.a.s()));
        }
    }

    /* access modifiers changed from: package-private */
    public class g implements SGAdNative.SGFeedAdListener {
        final /* synthetic */ f a;

        class a implements SGFeedAd.AdInteractionListener {
            a() {
            }

            public void onAdClick() {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,fetchSGFeedAd onAdClick, cid=%s", g.this.a.s()));
                if (j.this.a != null) {
                    i iVar = j.this.a;
                    g gVar = g.this;
                    iVar.onAdClick(gVar.a, j.this.i.getSGFeedView());
                }
            }

            public void onAdClickDownLoad() {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,fetchSGFeedAd onAdClickDownLoad, cid=%s", g.this.a.s()));
                if (j.this.a != null) {
                    i iVar = j.this.a;
                    g gVar = g.this;
                    iVar.onAdClick(gVar.a, j.this.i.getSGFeedView());
                }
            }

            public void onAdClose() {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,fetchSGFeedAd onAdClose, cid=%s", g.this.a.s()));
                if (j.this.a != null) {
                    i iVar = j.this.a;
                    g gVar = g.this;
                    iVar.onAdClose(gVar.a, j.this.i.getSGFeedView());
                }
            }

            public void onAdError(SGAdError sGAdError) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,fetchSGBannerAd onAdError, cid=%s", g.this.a.s()));
                if (j.this.a != null) {
                    j.this.a.onAdLoadFail(g.this.a);
                }
            }

            public void onAdShow() {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,fetchSGFeedAd onAdShow, cid=%s", g.this.a.s()));
                if (j.this.a != null) {
                    i iVar = j.this.a;
                    g gVar = g.this;
                    iVar.onAdShow(gVar.a, j.this.i.getSGFeedView());
                }
            }
        }

        g(f fVar) {
            this.a = fVar;
        }

        public void onError(SGAdError sGAdError) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,fetchSGFeedAd onError, cid=%s, code=%d, msg=%s", this.a.s(), Integer.valueOf(sGAdError.getErrorCode()), sGAdError.getErrorMessage()));
            if (j.this.a != null) {
                j.this.a.onAdLoadFail(this.a);
            }
        }

        public void onSGFeedLoad(List<SGFeedAd> list) {
            if (list == null || list.isEmpty()) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,fetchSGFeedAd onSGFeedLoad empty, cid=%s", this.a.s()));
                if (j.this.a != null) {
                    j.this.a.onAdLoadFail(this.a);
                    return;
                }
                return;
            }
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,fetchSGFeedAd onSGFeedLoad, cid=%s", this.a.s()));
            j.this.i = list.get(0);
            j.this.i.setSGFeedInteractionListener(new a());
            if (j.this.a != null) {
                j.this.a.onAdLoadSuccess(this.a, j.this.i.getSGFeedView(), -2, false);
            }
        }
    }

    /* access modifiers changed from: package-private */
    public class h implements SGAdNative.SGBannerAdListener {
        final /* synthetic */ f a;

        class a implements SGBannerAd.AdInteractionListener {
            final /* synthetic */ SGBannerAd a;

            a(SGBannerAd sGBannerAd) {
                this.a = sGBannerAd;
            }

            public void onAdClick() {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,fetchSGBannerAd onAdClick, cid=%s", h.this.a.s()));
                if (j.this.a != null) {
                    j.this.a.onAdClick(h.this.a, this.a.getSGBannerView());
                }
            }

            public void onAdClickDownLoad() {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,fetchSGBannerAd onAdClickDownLoad, cid=%s", h.this.a.s()));
                if (j.this.a != null) {
                    j.this.a.onAdClick(h.this.a, this.a.getSGBannerView());
                }
            }

            public void onAdClose() {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,fetchSGBannerAd onAdClose, cid=%s", h.this.a.s()));
                if (j.this.a != null) {
                    j.this.a.onAdClose(h.this.a, this.a.getSGBannerView());
                }
            }

            public void onAdError(SGAdError sGAdError) {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,fetchSGBannerAd onAdError, cid=%s", h.this.a.s()));
                if (j.this.a != null) {
                    j.this.a.onAdLoadFail(h.this.a);
                }
            }

            public void onAdShow() {
                p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,fetchSGBannerAd onAdShow, cid=%s", h.this.a.s()));
                if (j.this.a != null) {
                    j.this.a.onAdShow(h.this.a, this.a.getSGBannerView());
                }
            }
        }

        h(f fVar) {
            this.a = fVar;
        }

        public void onError(SGAdError sGAdError) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,fetchSGBannerAd onError, cid=%s, code=%d, msg=%s", this.a.s(), Integer.valueOf(sGAdError.getErrorCode()), sGAdError.getErrorMessage()));
            if (j.this.a != null) {
                j.this.a.onAdLoadFail(this.a);
            }
        }

        public void onSGBannerLoad(SGBannerAd sGBannerAd) {
            p.a("SdkAdsAdapter", String.format("vvvvvvvvvvvvvvvvvvv,fetchSGBannerAd onSGBannerLoad, cid=%s", this.a.s()));
            j.this.h = sGBannerAd;
            sGBannerAd.setCanClose(false);
            sGBannerAd.setSGBannerInteractionListener(new a(sGBannerAd));
            if (j.this.a != null) {
                j.this.a.onAdLoadSuccess(this.a, sGBannerAd.getSGBannerView(), k.a(60.0f), false);
            }
        }
    }

    public interface i {
        void onAdClick(f fVar, View view);

        void onAdClose(f fVar, View view);

        void onAdLoadFail(f fVar);

        void onAdLoadSuccess(f fVar, View view, int i, boolean z);

        void onAdPreLoad(f fVar, View view, int i, boolean z);

        void onAdRenderFail(f fVar);

        void onAdRenderSuccess(f fVar, View view, int i, boolean z);

        void onAdShow(f fVar, View view);
    }

    public j(i iVar) {
        this.a = iVar;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private View a(Context context, f fVar, NativeResponse nativeResponse) {
        if (s.a(fVar.H())) {
            return null;
        }
        try {
            if ("INFO_FLOW_PIC_BOTTOM_TITLE".equalsIgnoreCase(fVar.H())) {
                View inflate = ((LayoutInflater) com.iBookStar.b.a.k().getSystemService("layout_inflater")).inflate(k.a(R.layout.ym_bd_flow_pic_bottom_title, "ym_bd_flow_pic_bottom_title", TtmlNode.TAG_LAYOUT), (ViewGroup) null);
                m.a().a(inflate.findViewById(k.a(R.id.ym_bd_native_main_image, "ym_bd_native_main_image", "id")), nativeResponse.getImageUrl());
                ((TextView) inflate.findViewById(k.a(R.id.ym_bd_native_title, "ym_bd_native_title", "id"))).setText(nativeResponse.getTitle());
                ((TextView) inflate.findViewById(k.a(R.id.ym_bd_native_text, "ym_bd_native_text", "id"))).setText(nativeResponse.getDesc());
                ((TextView) inflate.findViewById(k.a(R.id.ym_bd_native_brand_name, "ym_bd_native_brand_name", "id"))).setText(nativeResponse.getBrandName());
                m.a().a(inflate.findViewById(k.a(R.id.ym_bd_native_adlogo, "ym_bd_native_adlogo", "id")), nativeResponse.getAdLogoUrl());
                m.a().a(inflate.findViewById(k.a(R.id.ym_bd_native_baidulogo, "ym_bd_native_baidulogo", "id")), nativeResponse.getBaiduLogoUrl());
                return inflate;
            } else if ("INFO_FLOW_PIC_TOP_TITLE".equalsIgnoreCase(fVar.H())) {
                View inflate2 = ((LayoutInflater) com.iBookStar.b.a.k().getSystemService("layout_inflater")).inflate(k.a(R.layout.ym_bd_flow_pic_top_title, "ym_bd_flow_pic_top_title", TtmlNode.TAG_LAYOUT), (ViewGroup) null);
                m.a().a(inflate2.findViewById(k.a(R.id.ym_bd_native_main_image, "ym_bd_native_main_image", "id")), nativeResponse.getImageUrl());
                ((TextView) inflate2.findViewById(k.a(R.id.ym_bd_native_text, "ym_bd_native_text", "id"))).setText(nativeResponse.getDesc());
                ((TextView) inflate2.findViewById(k.a(R.id.ym_bd_native_title, "ym_bd_native_title", "id"))).setText(nativeResponse.getTitle());
                ((TextView) inflate2.findViewById(k.a(R.id.ym_bd_native_brand_name, "ym_bd_native_brand_name", "id"))).setText(nativeResponse.getBrandName());
                m.a().a(inflate2.findViewById(k.a(R.id.ym_bd_native_adlogo, "ym_bd_native_adlogo", "id")), nativeResponse.getAdLogoUrl());
                m.a().a(inflate2.findViewById(k.a(R.id.ym_bd_native_baidulogo, "ym_bd_native_baidulogo", "id")), nativeResponse.getBaiduLogoUrl());
                return inflate2;
            } else if ("INFO_FLOW_PIC_LOGO".equalsIgnoreCase(fVar.H())) {
                View inflate3 = ((LayoutInflater) com.iBookStar.b.a.k().getSystemService("layout_inflater")).inflate(k.a(R.layout.ym_bd_flow_pic_logo, "ym_bd_flow_pic_logo", TtmlNode.TAG_LAYOUT), (ViewGroup) null);
                m.a().a(inflate3.findViewById(k.a(R.id.ym_bd_native_icon_image, "ym_bd_native_icon_image", "id")), nativeResponse.getIconUrl());
                m.a().a(inflate3.findViewById(k.a(R.id.ym_bd_native_main_image, "ym_bd_native_main_image", "id")), nativeResponse.getImageUrl());
                ((TextView) inflate3.findViewById(k.a(R.id.ym_bd_native_text, "ym_bd_native_text", "id"))).setText(nativeResponse.getDesc());
                ((TextView) inflate3.findViewById(k.a(R.id.ym_bd_native_title, "ym_bd_native_title", "id"))).setText(nativeResponse.getTitle());
                ((TextView) inflate3.findViewById(k.a(R.id.ym_bd_native_brand_name, "ym_bd_native_brand_name", "id"))).setText(nativeResponse.getBrandName());
                m.a().a(inflate3.findViewById(k.a(R.id.ym_bd_native_adlogo, "ym_bd_native_adlogo", "id")), nativeResponse.getAdLogoUrl());
                m.a().a(inflate3.findViewById(k.a(R.id.ym_bd_native_baidulogo, "ym_bd_native_baidulogo", "id")), nativeResponse.getBaiduLogoUrl());
                return inflate3;
            } else if ("INFO_FLOW_LEFT_PIC".equalsIgnoreCase(fVar.H())) {
                View inflate4 = ((LayoutInflater) com.iBookStar.b.a.k().getSystemService("layout_inflater")).inflate(k.a(R.layout.ym_bd_flow_left_pic, "ym_bd_flow_left_pic", TtmlNode.TAG_LAYOUT), (ViewGroup) null);
                m.a().a(inflate4.findViewById(k.a(R.id.ym_bd_native_icon_image, "ym_bd_native_icon_image", "id")), nativeResponse.getImageUrl());
                ((TextView) inflate4.findViewById(k.a(R.id.ym_bd_native_text, "ym_bd_native_text", "id"))).setText(nativeResponse.getDesc());
                ((TextView) inflate4.findViewById(k.a(R.id.ym_bd_native_title, "ym_bd_native_title", "id"))).setText(nativeResponse.getTitle());
                ((TextView) inflate4.findViewById(k.a(R.id.ym_bd_native_brand_name, "ym_bd_native_brand_name", "id"))).setText(nativeResponse.getBrandName());
                m.a().a(inflate4.findViewById(k.a(R.id.ym_bd_native_adlogo, "ym_bd_native_adlogo", "id")), nativeResponse.getAdLogoUrl());
                m.a().a(inflate4.findViewById(k.a(R.id.ym_bd_native_baidulogo, "ym_bd_native_baidulogo", "id")), nativeResponse.getBaiduLogoUrl());
                return inflate4;
            } else if ("INFO_FLOW_RIGHT_PIC".equalsIgnoreCase(fVar.H())) {
                View inflate5 = ((LayoutInflater) com.iBookStar.b.a.k().getSystemService("layout_inflater")).inflate(k.a(R.layout.ym_bd_flow_right_pic, "ym_bd_flow_right_pic", TtmlNode.TAG_LAYOUT), (ViewGroup) null);
                m.a().a(inflate5.findViewById(k.a(R.id.ym_bd_native_icon_image, "ym_bd_native_icon_image", "id")), nativeResponse.getImageUrl());
                ((TextView) inflate5.findViewById(k.a(R.id.ym_bd_native_text, "ym_bd_native_text", "id"))).setText(nativeResponse.getDesc());
                ((TextView) inflate5.findViewById(k.a(R.id.ym_bd_native_title, "ym_bd_native_title", "id"))).setText(nativeResponse.getTitle());
                ((TextView) inflate5.findViewById(k.a(R.id.ym_bd_native_brand_name, "ym_bd_native_brand_name", "id"))).setText(nativeResponse.getBrandName());
                m.a().a(inflate5.findViewById(k.a(R.id.ym_bd_native_adlogo, "ym_bd_native_adlogo", "id")), nativeResponse.getAdLogoUrl());
                m.a().a(inflate5.findViewById(k.a(R.id.ym_bd_native_baidulogo, "ym_bd_native_baidulogo", "id")), nativeResponse.getBaiduLogoUrl());
                return inflate5;
            } else if ("INFO_FLOW_GROUP_PIC".equalsIgnoreCase(fVar.H())) {
                View inflate6 = ((LayoutInflater) com.iBookStar.b.a.k().getSystemService("layout_inflater")).inflate(k.a(R.layout.ym_bd_flow_group_pic, "ym_bd_flow_group_pic", TtmlNode.TAG_LAYOUT), (ViewGroup) null);
                ((TextView) inflate6.findViewById(k.a(R.id.ym_bd_iv_desc, "ym_bd_iv_desc", "id"))).setText(nativeResponse.getDesc());
                ((TextView) inflate6.findViewById(k.a(R.id.ym_bd_iv_title, "ym_bd_iv_title", "id"))).setText(nativeResponse.getTitle());
                ((TextView) inflate6.findViewById(k.a(R.id.ym_bd_iv_brandname, "ym_bd_iv_brandname", "id"))).setText(nativeResponse.getBrandName());
                if (nativeResponse.getMultiPicUrls() != null && nativeResponse.getMultiPicUrls().size() > 2) {
                    m.a().a(inflate6.findViewById(k.a(R.id.ym_bd_iv_main1, "ym_bd_iv_main1", "id")), (String) nativeResponse.getMultiPicUrls().get(0));
                    m.a().a(inflate6.findViewById(k.a(R.id.ym_bd_iv_main2, "ym_bd_iv_main2", "id")), (String) nativeResponse.getMultiPicUrls().get(1));
                    m.a().a(inflate6.findViewById(k.a(R.id.ym_bd_iv_main3, "ym_bd_iv_main3", "id")), (String) nativeResponse.getMultiPicUrls().get(2));
                }
                m.a().a(inflate6.findViewById(k.a(R.id.ym_bd_iv_adlogo, "ym_bd_iv_adlogo", "id")), nativeResponse.getAdLogoUrl());
                m.a().a(inflate6.findViewById(k.a(R.id.ym_bd_iv_baidulogo, "ym_bd_iv_baidulogo", "id")), nativeResponse.getBaiduLogoUrl());
                return inflate6;
            } else if ("INFO_FLOW_GROUP_PIC_LOGO".equalsIgnoreCase(fVar.H())) {
                View inflate7 = ((LayoutInflater) com.iBookStar.b.a.k().getSystemService("layout_inflater")).inflate(k.a(R.layout.ym_bd_flow_group_pic_logo, "ym_bd_flow_group_pic_logo", TtmlNode.TAG_LAYOUT), (ViewGroup) null);
                m.a().a(inflate7.findViewById(k.a(R.id.ym_bd_iv_icon, "ym_bd_iv_icon", "id")), nativeResponse.getIconUrl());
                ((TextView) inflate7.findViewById(k.a(R.id.ym_bd_iv_desc, "ym_bd_iv_desc", "id"))).setText(nativeResponse.getDesc());
                ((TextView) inflate7.findViewById(k.a(R.id.ym_bd_iv_title, "ym_bd_iv_title", "id"))).setText(nativeResponse.getTitle());
                ((TextView) inflate7.findViewById(k.a(R.id.ym_bd_iv_brandname, "ym_bd_iv_brandname", "id"))).setText(nativeResponse.getBrandName());
                if (nativeResponse.getMultiPicUrls() != null && nativeResponse.getMultiPicUrls().size() > 2) {
                    m.a().a(inflate7.findViewById(k.a(R.id.ym_bd_iv_main1, "ym_bd_iv_main1", "id")), (String) nativeResponse.getMultiPicUrls().get(0));
                    m.a().a(inflate7.findViewById(k.a(R.id.ym_bd_iv_main2, "ym_bd_iv_main2", "id")), (String) nativeResponse.getMultiPicUrls().get(1));
                    m.a().a(inflate7.findViewById(k.a(R.id.ym_bd_iv_main3, "ym_bd_iv_main3", "id")), (String) nativeResponse.getMultiPicUrls().get(2));
                }
                m.a().a(inflate7.findViewById(k.a(R.id.ym_bd_iv_adlogo, "ym_bd_iv_adlogo", "id")), nativeResponse.getAdLogoUrl());
                m.a().a(inflate7.findViewById(k.a(R.id.ym_bd_iv_baidulogo, "ym_bd_iv_baidulogo", "id")), nativeResponse.getBaiduLogoUrl());
                return inflate7;
            } else {
                if ("INFO_FLOW_SMART_OPT".equalsIgnoreCase(fVar.H())) {
                    FeedNativeView feedNativeView = new FeedNativeView(context);
                    feedNativeView.setAdData((XAdNativeResponse) nativeResponse);
                    return feedNativeView;
                }
                return null;
            }
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    private void b(Context context, f fVar, float f2) {
        if (!com.iBookStar.b.a.n.contains("baidusdk")) {
            i iVar = this.a;
            if (iVar != null) {
                iVar.onAdLoadFail(fVar);
                return;
            }
            return;
        }
        AppActivity.setActionBarColorTheme(k.a(YmConfig.getTitleBarBgColor()) ? AppActivity.ActionBarColorTheme.ACTION_BAR_WHITE_THEME : AppActivity.ActionBarColorTheme.ACTION_BAR_BLACK_THEME);
        if (fVar.c() == 1) {
            BaiduNative.setAppSid(com.iBookStar.b.a.k(), fVar.l());
            BaiduNative baiduNative = new BaiduNative(context, fVar.s(), new e(fVar, context));
            this.e = baiduNative;
            baiduNative.makeRequest();
            return;
        }
        AdView.setAppSid(com.iBookStar.b.a.k(), fVar.l());
        AdView adView = new AdView(context, fVar.s());
        this.g = adView;
        adView.setListener(new f(fVar));
        i iVar2 = this.a;
        if (iVar2 != null) {
            iVar2.onAdPreLoad(fVar, this.g, -2, false);
        }
    }

    private boolean b() {
        try {
            Class.forName("com.bytedance.sdk.openadsdk.TTAdNative$NativeExpressAdListener");
            TTAdNative.class.getMethod("loadNativeExpressAd", AdSlot.class, TTAdNative.NativeExpressAdListener.class);
            return true;
        } catch (Throwable unused) {
            return false;
        }
    }

    private void c(Context context, f fVar, float f2) {
        if (!com.iBookStar.b.a.n.contains("gdtsdk")) {
            i iVar = this.a;
            if (iVar != null) {
                iVar.onAdLoadFail(fVar);
            }
        } else if (SDKStatus.getIntegrationSDKVersion().compareToIgnoreCase("4.250.1120") >= 0 && !GDTADManager.getInstance().isInitialized() && !GDTADManager.getInstance().initWith(com.iBookStar.b.a.k(), fVar.l())) {
            i iVar2 = this.a;
            if (iVar2 != null) {
                iVar2.onAdLoadFail(fVar);
            }
        } else if (fVar.c() == 1) {
            c cVar = new c(fVar);
            NativeExpressAD nativeExpressAD = SDKStatus.getIntegrationSDKVersion().compareToIgnoreCase("4.250.1120") >= 0 ? new NativeExpressAD(context, new ADSize(-1, -2), fVar.s(), cVar) : new NativeExpressAD(context, new ADSize(-1, -2), fVar.l(), fVar.s(), cVar);
            nativeExpressAD.setVideoOption(new VideoOption.Builder().setAutoPlayMuted(true).setDetailPageMuted(false).setAutoPlayPolicy(1).build());
            nativeExpressAD.setVideoPlayPolicy(1);
            nativeExpressAD.loadAD(1);
        } else {
            d dVar = new d(fVar);
            this.d = SDKStatus.getIntegrationSDKVersion().compareToIgnoreCase("4.250.1120") >= 0 ? new UnifiedBannerView((Activity) context, fVar.s(), dVar) : new UnifiedBannerView((Activity) context, fVar.l(), fVar.s(), dVar);
            i iVar3 = this.a;
            if (iVar3 != null) {
                iVar3.onAdPreLoad(fVar, this.d, -2, false);
            }
            this.d.loadAD();
        }
    }

    private void d(Context context, f fVar, float f2) {
        if (!com.iBookStar.b.a.n.contains("snssdk")) {
            i iVar = this.a;
            if (iVar != null) {
                iVar.onAdLoadFail(fVar);
                return;
            }
            return;
        }
        l.b(com.iBookStar.b.a.k(), fVar.l());
        if (b()) {
            float f3 = f2 / com.iBookStar.b.a.k().getResources().getDisplayMetrics().density;
            if (fVar.c() == 1) {
                l.a().createAdNative(context).loadNativeExpressAd(new AdSlot.Builder().setCodeId(fVar.s()).setSupportDeepLink(true).setAdCount(1).setExpressViewAcceptedSize(f3, 0.0f).setImageAcceptedSize(640, 320).build(), new a(fVar));
            } else {
                l.a().createAdNative(context).loadBannerExpressAd(new AdSlot.Builder().setCodeId(fVar.s()).setSupportDeepLink(true).setAdCount(1).setExpressViewAcceptedSize(f3, 0.0f).setImageAcceptedSize(640, 320).build(), new b(fVar));
            }
        } else {
            i iVar2 = this.a;
            if (iVar2 != null) {
                iVar2.onAdLoadFail(fVar);
            }
        }
    }

    private void e(Context context, f fVar, float f2) {
        if (!com.iBookStar.b.a.n.contains("sogousdk")) {
            i iVar = this.a;
            if (iVar != null) {
                iVar.onAdLoadFail(fVar);
                return;
            }
            return;
        }
        if (!AdClient.isInit()) {
            AdClient.init(com.iBookStar.b.a.k());
        }
        if (fVar.c() == 1) {
            AdClient.newClient(com.iBookStar.b.a.k()).pid(fVar.l()).mid(fVar.s()).addAdTemplate(101).addAdTemplate(201).addAdTemplate(102).addAdTemplate(103).addAdTemplate(203).addAdTemplate(105).addAdTemplate(205).debug(k.g()).create().with((Activity) context).fetchSGFeedAd(new g(fVar));
        } else {
            AdClient.newClient(com.iBookStar.b.a.k()).pid(fVar.l()).mid(fVar.s()).addAdTemplate(104).addAdTemplate(113).addAdTemplate(114).debug(k.g()).create().with((Activity) context).fetchSGBannerAd(new h(fVar));
        }
    }

    public void a() {
        TTNativeExpressAd tTNativeExpressAd = this.b;
        if (tTNativeExpressAd != null) {
            tTNativeExpressAd.destroy();
            this.b = null;
        }
        NativeExpressADView nativeExpressADView = this.c;
        if (nativeExpressADView != null) {
            nativeExpressADView.destroy();
            this.c = null;
        }
        UnifiedBannerView unifiedBannerView = this.d;
        if (unifiedBannerView != null) {
            unifiedBannerView.destroy();
            this.d = null;
        }
        BaiduNative baiduNative = this.e;
        if (baiduNative != null) {
            baiduNative.destroy();
            this.e = null;
        }
        AdView adView = this.g;
        if (adView != null) {
            adView.destroy();
            this.g = null;
        }
        SGBannerAd sGBannerAd = this.h;
        if (sGBannerAd != null) {
            sGBannerAd.destroy();
            this.h = null;
        }
        SGFeedAd sGFeedAd = this.i;
        if (sGFeedAd != null) {
            sGFeedAd.destroy();
            this.i = null;
        }
        this.f = null;
        this.a = null;
    }

    public void a(Context context, f fVar, float f2) {
        try {
            if (fVar.J().endsWith("snssdk")) {
                d(context, fVar, f2);
            } else if (fVar.J().endsWith("gdtsdk")) {
                c(context, fVar, f2);
            } else if (fVar.J().endsWith("baidusdk")) {
                b(context, fVar, f2);
            } else if (fVar.J().endsWith("sogousdk")) {
                e(context, fVar, f2);
            }
        } catch (Throwable th) {
            th.printStackTrace();
            i iVar = this.a;
            if (iVar != null) {
                iVar.onAdLoadFail(fVar);
            }
        }
    }

    public void a(View view) {
        NativeResponse nativeResponse = this.f;
        if (nativeResponse != null) {
            nativeResponse.handleClick(view);
        }
    }
}