| | |
| | | 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; |
| | |
| | | * @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(); |
| | |
| | | * @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()); |
| | |
| | | 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(); |