From 7c04c8301daa9d7b6d9bf5bbe5b29b389d3f45c3 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 08 五月 2021 12:50:28 +0800
Subject: [PATCH] 3.9.5完善

---
 BuWanVideo/src/com/weikou/beibeivideo/util/ad/ExpressAdManager.java |   81 +++++++++++++++++++++++++++++-----------
 1 files changed, 59 insertions(+), 22 deletions(-)

diff --git a/BuWanVideo/src/com/weikou/beibeivideo/util/ad/ExpressAdManager.java b/BuWanVideo/src/com/weikou/beibeivideo/util/ad/ExpressAdManager.java
index c0af154..de6e80c 100644
--- a/BuWanVideo/src/com/weikou/beibeivideo/util/ad/ExpressAdManager.java
+++ b/BuWanVideo/src/com/weikou/beibeivideo/util/ad/ExpressAdManager.java
@@ -12,6 +12,7 @@
 import com.bytedance.sdk.openadsdk.TTAdManager;
 import com.bytedance.sdk.openadsdk.TTAdNative;
 import com.bytedance.sdk.openadsdk.TTNativeExpressAd;
+import com.google.gson.Gson;
 import com.qq.e.ads.cfg.VideoOption;
 import com.qq.e.ads.nativ.ADSize;
 import com.qq.e.ads.nativ.NativeExpressAD;
@@ -22,6 +23,7 @@
 import com.qq.e.ads.nativ.express2.VideoOption2;
 import com.qq.e.comm.util.AdError;
 import com.weikou.beibeivideo.entity.ad.ExpressAdContainer;
+import com.weikou.beibeivideo.ui.recommend.SearchActivity;
 import com.weikou.beibeivideo.util.BeibeiConstant;
 import com.weikou.beibeivideo.util.DimenUtils;
 
@@ -125,12 +127,12 @@
         //鍔犺浇澶у浘
         int deviceWidth = DimenUtils.getScreenWidth(mContext);
         deviceWidth = DimenUtils.px2dip(mContext, deviceWidth);
-        int width = deviceWidth - 6;
+        int width = deviceWidth - 9 * 2;
         int height = (int) (width * 0.8);
         String pid = null;
         if (sourceType == AdUtil.AD_TYPE.csj) {
             pid = CSJConstant.RECOMMEND_BIG_IMG_AD;
-            height = (int) (width * 0.56);
+            height = (int) (width * 0.78);
         } else if (sourceType == AdUtil.AD_TYPE.gdt) {
             pid = BeibeiConstant.GDT_RECOMMAND_NATIVE;
         } else if (sourceType == AdUtil.AD_TYPE.gdt2) {
@@ -170,18 +172,21 @@
      * @param adLoadListener
      */
     public void loadVideoDetailPlayerBottomAd(final IAdLoadListener adLoadListener) {
+        Log.i(TAG, "loadVideoDetailPlayerBottomAd");
         //鍔犺浇澶у浘
         String pid = null;
         if (sourceType == AdUtil.AD_TYPE.csj) {
-            pid = "945375047";
+            pid = CSJConstant.VIDEO_DETAIL_PLAYER_BOTTOM;
         } else if (sourceType == AdUtil.AD_TYPE.gdt2) {
             pid = GDTConstant.PID_2_VIDEO_DETAIL_PLAY_EXPRESS1;
         }
+        if (mContext == null)
+            return;
         //鑾峰彇灞忓箷鐨勫
         int deviceWidth = DimenUtils.getScreenWidth(mContext);
         deviceWidth = DimenUtils.px2dip(mContext, deviceWidth);
         int width = (deviceWidth - 20);
-        int height = 80;
+        int height = 100;
         loadAd(width, height, pid, 1, adLoadListener);
     }
 
@@ -195,7 +200,7 @@
         //鍔犺浇澶у浘
         String pid = null;
         if (sourceType == AdUtil.AD_TYPE.csj) {
-            pid = "945375047";
+            pid = CSJConstant.VIDEO_DETAIL_GUESSLIKE_TOP;
         } else if (sourceType == AdUtil.AD_TYPE.gdt2) {
             pid = GDTConstant.PID_2_VIDEO_DETAIL_PLAY_EXPRESS2;
         }
@@ -242,7 +247,7 @@
         String pid = null;
         if (sourceType == AdUtil.AD_TYPE.csj) {
             pid = "945379581";
-        } else if (sourceType == AdUtil.AD_TYPE.gdt) {
+        } else if (sourceType == AdUtil.AD_TYPE.gdt2) {
             pid = BeibeiConstant.GDT_SEARCH_RESULT_MIN_NATIVE;
         }
         //鑾峰彇灞忓箷鐨勫
@@ -301,8 +306,8 @@
         String pid = null;
         if (sourceType == AdUtil.AD_TYPE.csj) {
             pid = CSJConstant.APP_EXIT;
-        } else if (sourceType == AdUtil.AD_TYPE.gdt) {
-            pid = BeibeiConstant.GDT_EXIT_DIALOG;
+        } else {
+            pid = GDTConstant.PID_2_EXIT;
         }
         //鑾峰彇灞忓箷鐨勫
         int deviceWidth = DimenUtils.getScreenWidth(mContext);
@@ -315,6 +320,25 @@
 
 
     /**
+     * 鍔犺浇瑙嗛鎼滅储骞垮憡
+     *
+     * @param adLoadListener
+     */
+    public void loadSearchAd(int widthDP, final IAdLoadListener adLoadListener) {
+        //鍔犺浇澶у浘
+        String pid = null;
+        if (sourceType == AdUtil.AD_TYPE.csj) {
+            pid = CSJConstant.VIDEO_SEARCH;
+        } else if (sourceType == AdUtil.AD_TYPE.gdt2) {
+            pid = BeibeiConstant.GDT_SEARCH_NATIVE;
+        }
+        int height = (int) (widthDP / 1.78f);
+
+        loadAd(widthDP, height, pid, 1, adLoadListener);
+    }
+
+
+    /**
      * 鍔犺浇骞跨偣閫氬箍鍛�
      *
      * @param positionId
@@ -323,6 +347,8 @@
      * @param context
      */
     private void loadGDT(String positionId, int widthDP, int heightDP, int count, final IGDTAdLoadListener adLoadListener, Context context) {
+
+
         NativeExpressAD nativeExpressAD = new NativeExpressAD(context, new ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT),
                 positionId, new NativeExpressAD.NativeExpressADListener() {
 
@@ -397,6 +423,9 @@
      * @param context
      */
     private void loadGDT2(String positionId, int widthDP, int heightDP, int count, final IGDTAdLoadListener adLoadListener, Context context) {
+
+        Log.i(TAG, String.format("loadGDT2:positionId-%s  widthDP-%s heightDP-%s", positionId, widthDP, heightDP));
+
         NativeExpressAD2 nativeExpressAD2 = new NativeExpressAD2(context, positionId, new NativeExpressAD2.AdLoadListener() {
             @Override
             public void onLoadSuccess(List<NativeExpressADData2> list) {
@@ -521,10 +550,17 @@
                     return;
                 }
 
+
                 ad.getCsj().setDislikeCallback(activity, new TTAdDislike.DislikeInteractionCallback() {
 
+
                     @Override
-                    public void onSelected(int i, String s) {
+                    public void onShow() {
+
+                    }
+
+                    @Override
+                    public void onSelected(int i, String s, boolean b) {
                         if (adEventListener != null) {
                             adEventListener.closeAd(ad);
                         }
@@ -535,10 +571,6 @@
 
                     }
 
-                    @Override
-                    public void onRefuse() {
-
-                    }
                 });
                 ad.getCsj().render();
                 if (ad.getCsj().getExpressAdView().getParent() != null) {
@@ -639,8 +671,14 @@
             if (activity != null)
                 ad.getCsj().setDislikeCallback(activity, new TTAdDislike.DislikeInteractionCallback() {
 
+
                     @Override
-                    public void onSelected(int i, String s) {
+                    public void onShow() {
+
+                    }
+
+                    @Override
+                    public void onSelected(int i, String s, boolean b) {
                         if (adEventListener != null) {
                             adEventListener.closeAd(ad);
                         }
@@ -651,10 +689,7 @@
 
                     }
 
-                    @Override
-                    public void onRefuse() {
 
-                    }
                 });
             ad.getCsj().render();
         }
@@ -729,8 +764,14 @@
             });
             ad.getCsj().setDislikeCallback(activity, new TTAdDislike.DislikeInteractionCallback() {
 
+
                 @Override
-                public void onSelected(int i, String s) {
+                public void onShow() {
+
+                }
+
+                @Override
+                public void onSelected(int i, String s, boolean b) {
                     if (adEventListener != null) {
                         adEventListener.closeAd(ad);
                     }
@@ -741,10 +782,6 @@
 
                 }
 
-                @Override
-                public void onRefuse() {
-
-                }
             });
         }
 

--
Gitblit v1.8.0