| | |
| | | import com.bytedance.sdk.openadsdk.TTAdNative; |
| | | import com.bytedance.sdk.openadsdk.TTSplashAd; |
| | | import com.hanju.lib.library.util.ManifestDataUtil; |
| | | import com.hanju.video.app.entity.ad.AdPositionEnum; |
| | | import com.qq.e.ads.splash.SplashAD; |
| | | import com.qq.e.ads.splash.SplashADListener; |
| | | import com.qq.e.comm.util.AdError; |
| | |
| | | * @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) { |
| | | if (adType == null) { |
| | | splashAdListener.close(); |
| | | return; |
| | | } |
| | | if (AdUtil.AD_TYPE.csj==adType) { |
| | | if (AdUtil.AD_TYPE.csj == adType) { |
| | | loadCSJ(context, skip, vg_ad, splashAdListener); |
| | | } else if (AdUtil.AD_TYPE.gdt==adType) { |
| | | } else if (AdUtil.AD_TYPE.gdt == adType) { |
| | | loadGDT(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) { |
| | | |
| | | String channel = ManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL"); |
| | | String code = HanJuConstant.GDT_SPLASH_POSITION_ID; |
| | | if ("vivo".equalsIgnoreCase(channel)) { |
| | | code = HanJuConstant.GDT_SPLASH_VIVO_POSITION_ID; |
| | | } |
| | | new SplashAD(context, skip, code, new SplashADListener() { |
| | | String code = GDTADConstant.PID_SPLASH;//AdUtil.getAdPid(context, AdPositionEnum.splash); |
| | | new SplashAD(context, code, new SplashADListener() { |
| | | @Override |
| | | public void onADDismissed() { |
| | | splashAdListener.close(); |
| | |
| | | */ |
| | | private static void loadCSJ(Activity context, final View skip, final ViewGroup vg_ad, final SplashAdListener splashAdListener) { |
| | | skip.setVisibility(View.GONE); |
| | | TTAdManager ttAdManager = TTAdManagerHolder.get(); |
| | | TTAdManager ttAdManager = null; |
| | | try { |
| | | ttAdManager = TTAdManagerHolder.get(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (ttAdManager == null) { |
| | | if (splashAdListener != null) |
| | | splashAdListener.noAd(); |
| | | return; |
| | | } |
| | | TTAdNative mTTAdNative = ttAdManager.createAdNative(context.getApplicationContext()); |
| | | //穿山甲广告 |
| | | int width = DimenUtils.getScreenWidth(context.getApplicationContext()); |
| | |
| | | width = 720; |
| | | if (height == 0) |
| | | height = 1080; |
| | | String channel = ManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL"); |
| | | String code = CSJADConstant.SPLASH_AD; |
| | | if ("vivo".equalsIgnoreCase(channel)) { |
| | | code = CSJADConstant.SPLASH_AD_VIVO; |
| | | } |
| | | |
| | | String code = AdUtil.getAdPid(context, AdPositionEnum.splash); |
| | | AdSlot adSlot = new AdSlot.Builder() |
| | | .setCodeId(code) |
| | | .setSupportDeepLink(true) |
| | |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | }, 5000); |
| | | |
| | | |
| | | } |