From 2f9e1cb327b1d58e4035b77bd903a452774ce66b Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 17 十月 2020 17:28:57 +0800 Subject: [PATCH] 广告控制完善 --- BuWanVideo/src/com/weikou/beibeivideo/util/ad/SplashAdUtil.java | 28 ++++++++++++---------------- 1 files changed, 12 insertions(+), 16 deletions(-) diff --git a/BuWanVideo/src/com/weikou/beibeivideo/util/ad/SplashAdUtil.java b/BuWanVideo/src/com/weikou/beibeivideo/util/ad/SplashAdUtil.java index d927a90..0d49833 100644 --- a/BuWanVideo/src/com/weikou/beibeivideo/util/ad/SplashAdUtil.java +++ b/BuWanVideo/src/com/weikou/beibeivideo/util/ad/SplashAdUtil.java @@ -30,27 +30,25 @@ * @param tv_time * @param splashAdListener */ - public static void loadAD(AdUtil.AD_TYPE adType, Activity context, final View skip, ViewGroup vg_ad, final TextView tv_time, final SplashAdListener splashAdListener) { - if (adType==null) { + 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 (AdUtil.AD_TYPE.csj==adType) { - loadCSJ(context, skip, vg_ad, splashAdListener); - } else if (AdUtil.AD_TYPE.gdt==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) { + 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"); - String code = BeibeiConstant.GDT_SPLASH_POSITION_ID; - if ("vivo".equalsIgnoreCase(channel)) { - code = BeibeiConstant.GDT_SPLASH_VIVO_POSITION_ID; - } + if (StringUtils.isNullOrEmpty(code)) + code = BeibeiConstant.GDT_SPLASH_POSITION_ID; new SplashAD(context, skip, code, new SplashADListener() { @Override public void onADDismissed() { @@ -115,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()); @@ -127,10 +125,8 @@ if (height == 0) height = 1080; String channel = ManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL"); - String code = CSJConstant.SPLASH_AD; - if ("vivo".equalsIgnoreCase(channel)) { - code = CSJConstant.SPLASH_AD_VIVO; - } + if (StringUtils.isNullOrEmpty(code)) + code = CSJConstant.SPLASH_AD; AdSlot adSlot = new AdSlot.Builder() .setCodeId(code) -- Gitblit v1.8.0