admin
2021-02-03 1981dee5aec45793d3c4ebdbc4e637528c71b3c5
BuWanVideo/src/com/weikou/beibeivideo/util/ad/SplashAdUtil.java
@@ -9,6 +9,7 @@
import com.bytedance.sdk.openadsdk.TTAdManager;
import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTSplashAd;
import com.lcjian.library.util.ManifestDataUtil;
import com.qq.e.ads.splash.SplashAD;
import com.qq.e.ads.splash.SplashADListener;
import com.qq.e.comm.util.AdError;
@@ -29,22 +30,26 @@
     * @param tv_time
     * @param splashAdListener
     */
    public static void loadAD(String adType, Activity context, final View skip, ViewGroup vg_ad, final TextView tv_time, final SplashAdListener splashAdListener) {
        if (StringUtils.isNullOrEmpty(adType)) {
    public static void loadAD(String pid, AdUtil.AD_TYPE adType, Activity context, final View skip, ViewGroup vg_ad, final TextView tv_time, final SplashAdListener splashAdListener) {
        if (adType == null) {
            splashAdListener.close();
            return;
        }
        if (AdTypeVO.TYPE_CSJ.equalsIgnoreCase(adType)) {
            loadCSJ(context, skip, vg_ad, splashAdListener);
        } else if (AdTypeVO.TYPE_GDT.equalsIgnoreCase(adType)) {
            loadGDT(context, skip, vg_ad, tv_time, splashAdListener);
        if (AdUtil.AD_TYPE.csj == adType) {
            loadCSJ(pid, context, skip, vg_ad, splashAdListener);
        } else if (AdUtil.AD_TYPE.gdt == adType) {
            loadGDT(pid, context, skip, vg_ad, tv_time, splashAdListener);
        } else {
            splashAdListener.close();
        }
    }
    private static void loadGDT(Activity context, final View skip, ViewGroup vg_ad, final TextView tv_time, final SplashAdListener splashAdListener) {
        new SplashAD(context, skip, BeibeiConstant.GDT_SPLASH_POSITION_ID, new SplashADListener() {
    private static void loadGDT(String code, Activity context, final View skip, ViewGroup vg_ad, final TextView tv_time, final SplashAdListener splashAdListener) {
        String channel = ManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL");
        if (StringUtils.isNullOrEmpty(code))
            code = BeibeiConstant.GDT_SPLASH_POSITION_ID;
        new SplashAD(context, skip, code, new SplashADListener() {
            @Override
            public void onADDismissed() {
                splashAdListener.close();
@@ -108,7 +113,7 @@
     * @param vg_ad
     * @param splashAdListener
     */
    private static void loadCSJ(Activity context, final View skip, final ViewGroup vg_ad, final SplashAdListener splashAdListener) {
    private static void loadCSJ(String code, Activity context, final View skip, final ViewGroup vg_ad, final SplashAdListener splashAdListener) {
        skip.setVisibility(View.GONE);
        TTAdManager ttAdManager = TTAdManagerHolder.get();
        TTAdNative mTTAdNative = ttAdManager.createAdNative(context.getApplicationContext());
@@ -119,8 +124,12 @@
            width = 720;
        if (height == 0)
            height = 1080;
        String channel = ManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL");
        if (StringUtils.isNullOrEmpty(code))
            code = CSJConstant.SPLASH_AD;
        AdSlot adSlot = new AdSlot.Builder()
                .setCodeId("887360667")
                .setCodeId(code)
                .setSupportDeepLink(true)
                .setImageAcceptedSize(width, height)
                .build();