Commit badca490 authored by mengcuiguang2's avatar mengcuiguang2

gromore 优化

parent 25d212f9
...@@ -7,11 +7,14 @@ import android.widget.FrameLayout ...@@ -7,11 +7,14 @@ import android.widget.FrameLayout
import com.bytedance.msdk.api.* import com.bytedance.msdk.api.*
import com.bytedance.msdk.api.nativeAd.* import com.bytedance.msdk.api.nativeAd.*
import com.mints.goodmoney.MintsApplication import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.manager.CsjGroMoreManager import com.mints.goodmoney.manager.CsjGroMoreManager
import com.mints.goodmoney.manager.TrackManager
import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
import com.mints.goodmoney.utils.LogUtil import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.UIUtils import com.mints.goodmoney.utils.UIUtils
import com.mints.goodmoney.utils.VideoOptionUtil import com.mints.goodmoney.utils.VideoOptionUtil
import java.util.HashMap
private val TAG = GroMoreCarrierExpressManager::class.java.simpleName private val TAG = GroMoreCarrierExpressManager::class.java.simpleName
...@@ -57,7 +60,7 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback { ...@@ -57,7 +60,7 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
} }
private fun loadAd() { private fun loadAd() {
mTTAdNative = TTUnifiedNativeAd(MintsApplication.getContext(), CsjGroMoreManager.AD_UNIT_ID) mTTAdNative = TTUnifiedNativeAd(MintsApplication.getContext(), CsjGroMoreManager.AD_UNIT_EXPRESS_ID)
//视频声音控制设置 //视频声音控制设置
var videoOption: TTVideoOption = VideoOptionUtil.getTTVideoOption() var videoOption: TTVideoOption = VideoOptionUtil.getTTVideoOption()
...@@ -125,6 +128,14 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback { ...@@ -125,6 +128,14 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
if (ads.size > 0) { if (ads.size > 0) {
frameLayout?.addView(ads[0].expressView) frameLayout?.addView(ads[0].expressView)
val ttNativeAd = ads[0]
val vo = HashMap<String, Any>()
vo["adcode"] = ttNativeAd.getAdNetworkRitId()
vo["ecpm"] = ttNativeAd.getPreEcpm()
vo["adSource"] = ttNativeAd.getAdNetworkPlatformId()
vo["adType"] = Constant.GRO_MORE_ADTYPE1
TrackManager.getInstance().cmtGroMoreInfo(vo)
// sAdFrameLayout.addView(createAdView(ads[0]))
} }
} }
......
...@@ -62,7 +62,7 @@ class GroMoreExpressManager : TTSettingConfigCallback { ...@@ -62,7 +62,7 @@ class GroMoreExpressManager : TTSettingConfigCallback {
} }
private fun loadAd() { private fun loadAd() {
mTTAdNative = TTUnifiedNativeAd(MintsApplication.getContext(), CsjGroMoreManager.AD_UNIT_ID) mTTAdNative = TTUnifiedNativeAd(MintsApplication.getContext(), CsjGroMoreManager.AD_UNIT_EXPRESS_ID)
//视频声音控制设置 //视频声音控制设置
var videoOption: TTVideoOption = VideoOptionUtil.getTTVideoOption() var videoOption: TTVideoOption = VideoOptionUtil.getTTVideoOption()
......
...@@ -22,6 +22,7 @@ import com.mints.goodmoney.ad.video.base.BaseVideoAd; ...@@ -22,6 +22,7 @@ import com.mints.goodmoney.ad.video.base.BaseVideoAd;
import com.mints.goodmoney.ad.video.base.VideoAdStatusListener; import com.mints.goodmoney.ad.video.base.VideoAdStatusListener;
import com.mints.goodmoney.common.AppConfig; import com.mints.goodmoney.common.AppConfig;
import com.mints.goodmoney.common.Constant; import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.CsjGroMoreManager;
import com.mints.goodmoney.manager.TTNativeExpressManager; import com.mints.goodmoney.manager.TTNativeExpressManager;
import com.mints.goodmoney.manager.TrackManager; import com.mints.goodmoney.manager.TrackManager;
import com.mints.goodmoney.manager.TtCsjAdManager; import com.mints.goodmoney.manager.TtCsjAdManager;
...@@ -52,7 +53,6 @@ public class CsjGroMoreVideoAdManager extends BaseVideoAd { ...@@ -52,7 +53,6 @@ public class CsjGroMoreVideoAdManager extends BaseVideoAd {
private Activity activity; private Activity activity;
private String adUnitId = "946018378"; //代码位
private boolean isClickScreen = true; // 是否点击屏幕跳转广告 private boolean isClickScreen = true; // 是否点击屏幕跳转广告
...@@ -98,7 +98,7 @@ public class CsjGroMoreVideoAdManager extends BaseVideoAd { ...@@ -98,7 +98,7 @@ public class CsjGroMoreVideoAdManager extends BaseVideoAd {
* 判断当前是否存在config 配置 ,如果存在直接加载广告 ,如果不存在则注册config加载回调 * 判断当前是否存在config 配置 ,如果存在直接加载广告 ,如果不存在则注册config加载回调
*/ */
if (TTMediationAdSdk.configLoadSuccess()) { if (TTMediationAdSdk.configLoadSuccess()) {
loadAd(adUnitId, TTAdConstant.VERTICAL); loadAd(CsjGroMoreManager.AD_UNIT_VIDEO_ID, TTAdConstant.VERTICAL);
} else { } else {
TTMediationAdSdk.registerConfigCallback(mSettingConfigCallback); //不用使用内部类,否则在ondestory中无法移除该回调 TTMediationAdSdk.registerConfigCallback(mSettingConfigCallback); //不用使用内部类,否则在ondestory中无法移除该回调
} }
...@@ -110,7 +110,7 @@ public class CsjGroMoreVideoAdManager extends BaseVideoAd { ...@@ -110,7 +110,7 @@ public class CsjGroMoreVideoAdManager extends BaseVideoAd {
private TTSettingConfigCallback mSettingConfigCallback = new TTSettingConfigCallback() { private TTSettingConfigCallback mSettingConfigCallback = new TTSettingConfigCallback() {
@Override @Override
public void configLoad() { public void configLoad() {
loadAd(adUnitId, TTAdConstant.VERTICAL); loadAd(CsjGroMoreManager.AD_UNIT_VIDEO_ID, TTAdConstant.VERTICAL);
} }
}; };
......
...@@ -5,7 +5,9 @@ import com.mints.goodmoney.MintsApplication ...@@ -5,7 +5,9 @@ import com.mints.goodmoney.MintsApplication
object CsjGroMoreManager { object CsjGroMoreManager {
const val AD_UNIT_ID = "946167770" const val AD_UNIT_EXPRESS_ID = "946167770"
const val AD_UNIT_SPLASH_ID = "887459392"
const val AD_UNIT_VIDEO_ID = "946018378"
fun init(application: MintsApplication) { fun init(application: MintsApplication) {
TTGroMoreAdManagerHolder.init(application) TTGroMoreAdManagerHolder.init(application)
......
...@@ -17,6 +17,7 @@ import com.mints.goodmoney.MintsApplication; ...@@ -17,6 +17,7 @@ import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.R; import com.mints.goodmoney.R;
import com.mints.goodmoney.common.Constant; import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.common.DeviceInfo; import com.mints.goodmoney.common.DeviceInfo;
import com.mints.goodmoney.manager.CsjGroMoreManager;
import com.mints.goodmoney.manager.TrackManager; import com.mints.goodmoney.manager.TrackManager;
import com.mints.goodmoney.manager.TtCsjAdManager; import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.manager.UserManager; import com.mints.goodmoney.manager.UserManager;
...@@ -39,7 +40,6 @@ public class SplashGroMoreActivity extends BaseActivity { ...@@ -39,7 +40,6 @@ public class SplashGroMoreActivity extends BaseActivity {
private FrameLayout mSplashContainer; private FrameLayout mSplashContainer;
//是否强制跳转到主页面 //是否强制跳转到主页面
private boolean mForceGoMain; private boolean mForceGoMain;
private String mAdUnitId = "887459392";
//开屏广告加载超时时间,建议大于1000,这里为了冷启动第一次加载到广告并且展示,示例设置了2000ms //开屏广告加载超时时间,建议大于1000,这里为了冷启动第一次加载到广告并且展示,示例设置了2000ms
private static final int AD_TIME_OUT = 4000; private static final int AD_TIME_OUT = 4000;
...@@ -78,12 +78,11 @@ public class SplashGroMoreActivity extends BaseActivity { ...@@ -78,12 +78,11 @@ public class SplashGroMoreActivity extends BaseActivity {
* 加载开屏广告 * 加载开屏广告
*/ */
private void loadSplashAd() { private void loadSplashAd() {
if (mAdUnitId == null) return;
/** /**
* 注:每次加载开屏广告的时候需要新建一个TTSplashAd,否则可能会出现广告填充问题 * 注:每次加载开屏广告的时候需要新建一个TTSplashAd,否则可能会出现广告填充问题
* ( 例如:mTTSplashAd = new TTSplashAd(this, mAdUnitId);) * ( 例如:mTTSplashAd = new TTSplashAd(this, mAdUnitId);)
*/ */
mTTSplashAd = new TTSplashAd(this, mAdUnitId); mTTSplashAd = new TTSplashAd(this, CsjGroMoreManager.AD_UNIT_SPLASH_ID);
mTTSplashAd.setTTAdSplashListener(mSplashAdListener); mTTSplashAd.setTTAdSplashListener(mSplashAdListener);
//step3:创建开屏广告请求参数AdSlot,具体参数含义参考文档 //step3:创建开屏广告请求参数AdSlot,具体参数含义参考文档
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment