| | |
| | | package com.mugua.mgvideo.util.ad; |
| | | |
| | | import android.app.Activity; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | |
| | | import android.util.Log; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.TextView; |
| | |
| | | import com.bytedance.sdk.openadsdk.TTAdNative; |
| | | import com.bytedance.sdk.openadsdk.TTSplashAd; |
| | | import com.lcjian.library.util.ManifestDataUtil; |
| | | import com.mugua.mgvideo.R; |
| | | import com.qq.e.ads.splash.SplashAD; |
| | | import com.qq.e.ads.splash.SplashADListener; |
| | | import com.qq.e.comm.util.AdError; |
| | |
| | | import com.yeshi.base.utils.downutil.StringUtils; |
| | | |
| | | public class SplashAdUtil { |
| | | |
| | | private static final String TAG ="SplashAdUtil" ; |
| | | |
| | | /** |
| | | * 加载开屏广告 |
| | |
| | | |
| | | String channel = ManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL"); |
| | | if (StringUtils.isNullOrEmpty(code)) |
| | | code = GDTConstant.GDT_SPLASH_AD_ID; |
| | | new SplashAD(context, GDTConstant.GDT_APP_ID, code, new SplashADListener() { |
| | | code =context.getString(R.string.ad_gdt_pid_splash); |
| | | new SplashAD(context, context.getString(com.yeshi.video.R.string.ad_gdt_app_id), code, new SplashADListener() { |
| | | @Override |
| | | public void onADDismissed() { |
| | | splashAdListener.close(); |
| | |
| | | private static void loadCSJ(String code, Activity context, final View skip, final ViewGroup vg_ad, final SplashAdListener splashAdListener) { |
| | | if (skip != null) |
| | | skip.setVisibility(View.GONE); |
| | | TTAdManager ttAdManager = TTAdManagerHolder.get(); |
| | | TTAdManager ttAdManager = null; |
| | | try { |
| | | ttAdManager = TTAdManagerHolder.get(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | if (ttAdManager == null) { |
| | | splashAdListener.noAd(); |
| | | return; |
| | | } |
| | | |
| | | TTAdNative mTTAdNative = ttAdManager.createAdNative(context.getApplicationContext()); |
| | | //穿山甲广告 |
| | | int width = DimenUtils.getScreenWidth(context.getApplicationContext()); |
| | |
| | | |
| | | @Override |
| | | public void onError(int i, String s) { |
| | | Log.i(TAG,s); |
| | | splashAdListener.noAd(); |
| | | } |
| | | |
| | |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | },3500); |
| | | |
| | | |
| | | } |