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


package com.baidu.mobads.sdk.internal;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.widget.RelativeLayout;
import com.baidu.mobads.sdk.api.IAdInterListener;
import com.baidu.mobads.sdk.api.IOAdEvent;
import com.baidu.mobads.sdk.api.RequestParameters;
import com.baidu.mobads.sdk.api.SplashAd;
import com.baidu.mobads.sdk.api.SplashAdListener;
import com.baidu.mobads.sdk.api.SplashInteractionListener;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.json.JSONException;
import org.json.JSONObject;

public class cv extends ar {
    private static int D;
    private static cv I;
    private boolean A;
    private boolean B;
    private int C = 60;
    private SplashAdListener E;
    private SplashAd.OnFinishListener F;
    private SplashAd.SplashFocusAdListener G;
    private RequestParameters H;
    private a J;

    /* renamed from: K  reason: collision with root package name */
    private SplashAd.SplashAdDownloadDialogListener f98K;
    public boolean o;
    public boolean p = false;
    public boolean q = false;
    public boolean r = false;
    private RelativeLayout s;
    private String t;
    private int u;
    private int v;
    private int w;
    private int x;
    private boolean y;
    private boolean z;

    public cv(Context context, RelativeLayout relativeLayout, String str, int i, int i2, int i3, int i4, boolean z2, boolean z3, boolean z4, boolean z5) {
        super(context);
        this.s = relativeLayout;
        this.t = str;
        this.u = i;
        this.v = i2;
        this.w = i3;
        this.x = i4;
        this.y = z2;
        this.z = z3;
        this.A = z5;
        this.B = z4;
    }

    public void a(int i) {
        this.C = i;
    }

    public void a(SplashAdListener splashAdListener) {
        this.E = splashAdListener;
    }

    public void a(SplashAd.SplashFocusAdListener splashFocusAdListener) {
        this.G = splashFocusAdListener;
    }

    public void a(RequestParameters requestParameters) {
        this.H = requestParameters;
    }

    @Override // com.baidu.mobads.sdk.internal.ar
    public void a_() {
        String str = "1";
        if (this.j == null) {
            this.k = false;
            return;
        }
        this.k = true;
        JSONObject jSONObject = new JSONObject();
        JSONObject jSONObject2 = new JSONObject();
        try {
            JSONObject jSONObject3 = new JSONObject();
            jSONObject3.put(IAdInterListener.AdReqParam.PROD, IAdInterListener.AdProdType.PRODUCT_SPLASH);
            this.j.createProdHandler(jSONObject3);
            this.j.setAdContainer(this.s);
            j();
            jSONObject.put(IAdInterListener.AdReqParam.PROD, IAdInterListener.AdProdType.PRODUCT_SPLASH);
            jSONObject.put(IAdInterListener.AdReqParam.APID, this.t);
            jSONObject.put(IAdInterListener.AdReqParam.FET, "ANTI,HTML,MSSP,VIDEO,RSPLASHHTML");
            jSONObject.put("n", str);
            jSONObject.put("at", "" + 26);
            jSONObject.put(IAdInterListener.AdReqParam.MIME_TYPE, "video/mp4,image/jpg,image/gif,image/png");
            jSONObject.put(IAdInterListener.AdReqParam.WIDTH, "" + this.u);
            jSONObject.put("h", "" + this.v);
            jSONObject.put("msa", 7);
            if (!TextUtils.isEmpty(this.n)) {
                jSONObject.put("appid", this.n);
            }
            String a = a(SplashAd.KEY_USE_ADAPTIVE_AD);
            if (!TextUtils.isEmpty(a)) {
                if (!Boolean.parseBoolean(a)) {
                    str = "0";
                }
                jSONObject.put("adtv", str);
            }
            jSONObject2.put("timeout", this.x);
            jSONObject2.put("splashTipStyle", this.w);
            jSONObject2.put("bitmapDisplayMode", D);
            jSONObject2.put("countDownNew", "true");
            jSONObject2.put("Display_Down_Info", "" + this.y);
            jSONObject2.put("popDialogIfDl", "" + this.z);
            jSONObject2.put("limitRegionClick", "" + this.A);
            jSONObject2.put("displayClickButton", "" + this.B);
            jSONObject2.put("needCache", true);
            jSONObject2.put("onlyLoadAd", this.o);
            jSONObject2.put("cacheVideoOnlyWifi", true);
            jSONObject2.put("shakeLogoSize", this.C);
            RequestParameters requestParameters = this.H;
            if (requestParameters != null) {
                a(requestParameters.getExtras());
            }
            jSONObject2 = j.a(jSONObject2, a(this.l));
        } catch (Exception e) {
            e.printStackTrace();
        }
        this.j.loadAd(jSONObject, jSONObject2);
    }

    public static void c(int i) {
        D = i;
    }

    public void e() {
        if (!this.o && this.j != null) {
            this.j.showAd();
        }
    }

    public void a(Intent intent, SplashAd.OnFinishListener onFinishListener) {
        try {
            if (this.p || intent == null || this.j == null || this.r || !(this.g instanceof Activity)) {
                b(intent, onFinishListener);
                return;
            }
            this.F = onFinishListener;
            JSONObject jSONObject = new JSONObject();
            HashMap hashMap = new HashMap();
            try {
                jSONObject.putOpt("event_type", "splash_focus_start_activity");
                hashMap.put("splash_focus_user_intent", intent);
            } catch (JSONException e) {
                az.a().a(e);
            }
            this.j.removeAllListeners();
            this.j.addEventListener(r.W, this.i);
            this.j.addEventListener(r.L, this.i);
            this.j.addEventListener(r.F, this.i);
            this.j.addEventListener(r.U, this.i);
            this.j.addEventListener(r.V, this.i);
            a(jSONObject, hashMap);
            this.E = null;
            I = this;
            am.a().a(new cw(this), 3, TimeUnit.SECONDS);
        } catch (Throwable th) {
            th.printStackTrace();
            b(intent, onFinishListener);
        }
    }

    private void b(Intent intent, SplashAd.OnFinishListener onFinishListener) {
        if (this.g != null && intent != null) {
            if (!(this.g instanceof Activity)) {
                intent.addFlags(268435456);
            }
            this.g.startActivity(intent);
            if (onFinishListener != null) {
                onFinishListener.onFinishActivity();
            } else if (this.g instanceof Activity) {
                ((Activity) this.g).finish();
            }
        }
    }

    public static void a(Activity activity, JSONObject jSONObject, SplashAd.SplashFocusAdListener splashFocusAdListener) {
        cv cvVar = I;
        if (cvVar != null) {
            cvVar.a(splashFocusAdListener);
            HashMap hashMap = new HashMap();
            JSONObject jSONObject2 = new JSONObject();
            try {
                jSONObject2.putOpt("event_type", "splash_focus_register_transition");
                jSONObject2.putOpt("splash_focus_params", jSONObject);
                hashMap.put("splash_focus_activity", activity);
                I.a(jSONObject2, hashMap);
            } catch (JSONException e) {
                az.a().c(e);
            } catch (Throwable th) {
                I = null;
                throw th;
            }
            I = null;
        }
    }

    public a f() {
        return this.J;
    }

    /* access modifiers changed from: protected */
    @Override // com.baidu.mobads.sdk.internal.ar
    public void d(IOAdEvent iOAdEvent) {
        Map<String, Object> data = iOAdEvent.getData();
        if (this.G != null && data != null && data.containsKey("splash_show_reason")) {
            this.G.onAdIconShow();
        }
    }

    /* access modifiers changed from: protected */
    @Override // com.baidu.mobads.sdk.internal.ar
    public void g(IOAdEvent iOAdEvent) {
        this.p = true;
        SplashAdListener splashAdListener = this.E;
        if (splashAdListener != null && (splashAdListener instanceof SplashInteractionListener)) {
            ((SplashInteractionListener) splashAdListener).onAdClick();
        }
        SplashAd.SplashFocusAdListener splashFocusAdListener = this.G;
        if (splashFocusAdListener != null) {
            splashFocusAdListener.onAdClick();
        }
    }

    /* access modifiers changed from: protected */
    @Override // com.baidu.mobads.sdk.internal.ar
    public void a(IOAdEvent iOAdEvent) {
        List<a> a;
        if (!(iOAdEvent == null || (a = b.a(iOAdEvent.getMessage()).a()) == null || a.size() <= 0)) {
            this.J = a.get(0);
        }
        SplashAdListener splashAdListener = this.E;
        if (splashAdListener != null) {
            splashAdListener.onADLoaded();
        }
    }

    /* access modifiers changed from: protected */
    @Override // com.baidu.mobads.sdk.internal.ar
    public void m() {
        SplashAdListener splashAdListener = this.E;
        if (splashAdListener != null && (splashAdListener instanceof SplashInteractionListener)) {
            ((SplashInteractionListener) splashAdListener).onAdPresent();
        }
    }

    /* access modifiers changed from: protected */
    @Override // com.baidu.mobads.sdk.internal.ar
    public void f(IOAdEvent iOAdEvent) {
        Map<String, Object> data = iOAdEvent.getData();
        if (this.G != null && data != null && data.containsKey("splash_close_reason")) {
            this.G.onAdClose();
        } else if (!this.q) {
            super.f(iOAdEvent);
            SplashAdListener splashAdListener = this.E;
            if (splashAdListener != null && (splashAdListener instanceof SplashInteractionListener)) {
                ((SplashInteractionListener) splashAdListener).onAdDismissed();
            }
            this.q = true;
        }
    }

    /* access modifiers changed from: protected */
    @Override // com.baidu.mobads.sdk.internal.ar
    public void a(int i, String str) {
        this.r = true;
        SplashAdListener splashAdListener = this.E;
        if (splashAdListener != null) {
            splashAdListener.onAdFailed("广告无填充");
        }
        super.a(i, str);
    }

    /* access modifiers changed from: protected */
    @Override // com.baidu.mobads.sdk.internal.ar
    public void a(String str, int i) {
        this.r = true;
        SplashAdListener splashAdListener = this.E;
        if (splashAdListener != null) {
            splashAdListener.onAdFailed(str);
        }
        super.a(str, i);
    }

    /* access modifiers changed from: protected */
    @Override // com.baidu.mobads.sdk.internal.ar
    public void o() {
        SplashAdListener splashAdListener = this.E;
        if (splashAdListener != null && (splashAdListener instanceof SplashInteractionListener)) {
            ((SplashInteractionListener) splashAdListener).onLpClosed();
        }
        SplashAd.SplashFocusAdListener splashFocusAdListener = this.G;
        if (splashFocusAdListener != null) {
            splashFocusAdListener.onLpClosed();
        }
        super.o();
    }

    /* access modifiers changed from: protected */
    @Override // com.baidu.mobads.sdk.internal.ar
    public void c_() {
        SplashAdListener splashAdListener = this.E;
        if (splashAdListener != null && (splashAdListener instanceof SplashInteractionListener)) {
            ((SplashInteractionListener) splashAdListener).onAdCacheSuccess();
        }
        super.c_();
    }

    /* access modifiers changed from: protected */
    @Override // com.baidu.mobads.sdk.internal.ar
    public void c() {
        SplashAdListener splashAdListener = this.E;
        if (splashAdListener != null && (splashAdListener instanceof SplashInteractionListener)) {
            ((SplashInteractionListener) splashAdListener).onAdCacheFailed();
        }
        super.c();
    }

    /* access modifiers changed from: protected */
    @Override // com.baidu.mobads.sdk.internal.ar
    public void q() {
        SplashAd.OnFinishListener onFinishListener = this.F;
        if (onFinishListener != null) {
            onFinishListener.onFinishActivity();
            this.F = null;
        } else if (this.g instanceof Activity) {
            ((Activity) this.g).finish();
        }
        this.g = null;
        this.s = null;
        super.q();
    }

    /* access modifiers changed from: protected */
    @Override // com.baidu.mobads.sdk.internal.ar
    public void a(String str, boolean z2) {
        SplashAd.SplashAdDownloadDialogListener splashAdDownloadDialogListener = this.f98K;
        if (splashAdDownloadDialogListener != null && (splashAdDownloadDialogListener instanceof SplashAd.SplashAdDownloadDialogListener)) {
            if (z2) {
                splashAdDownloadDialogListener.onADPermissionShow();
            } else {
                splashAdDownloadDialogListener.onADPermissionClose();
            }
        }
    }

    /* access modifiers changed from: protected */
    @Override // com.baidu.mobads.sdk.internal.ar
    public void b(String str, boolean z2) {
        SplashAd.SplashAdDownloadDialogListener splashAdDownloadDialogListener = this.f98K;
        if (splashAdDownloadDialogListener != null && (splashAdDownloadDialogListener instanceof SplashAd.SplashAdDownloadDialogListener)) {
            if (z2) {
                splashAdDownloadDialogListener.adDownloadWindowShow();
            } else {
                splashAdDownloadDialogListener.adDownloadWindowClose();
            }
        }
    }

    /* access modifiers changed from: protected */
    @Override // com.baidu.mobads.sdk.internal.ar
    public void r() {
        SplashAd.SplashAdDownloadDialogListener splashAdDownloadDialogListener = this.f98K;
        if (splashAdDownloadDialogListener != null && (splashAdDownloadDialogListener instanceof SplashAd.SplashAdDownloadDialogListener)) {
            splashAdDownloadDialogListener.onADPrivacyLpClose();
        }
    }

    /* access modifiers changed from: protected */
    @Override // com.baidu.mobads.sdk.internal.ar
    public void c(String str) {
        SplashAd.SplashAdDownloadDialogListener splashAdDownloadDialogListener = this.f98K;
        if (splashAdDownloadDialogListener != null && (splashAdDownloadDialogListener instanceof SplashAd.SplashAdDownloadDialogListener)) {
            splashAdDownloadDialogListener.onADPrivacyLpShow();
        }
    }

    public void a(SplashAd.SplashAdDownloadDialogListener splashAdDownloadDialogListener) {
        this.f98K = splashAdDownloadDialogListener;
    }

    private String a(String str) {
        if (this.H == null || TextUtils.isEmpty(str)) {
            return null;
        }
        try {
            Map<String, String> extras = this.H.getExtras();
            if (extras != null) {
                return extras.get(str);
            }
            return null;
        } catch (Throwable th) {
            this.h.d(ar.a, th);
            return null;
        }
    }

    public void a(boolean z2, String str) {
        a aVar = this.J;
        if (aVar != null) {
            a(aVar.F(), z2, str);
        }
    }
}