Commit a1f29c05 authored by mengcuiguang's avatar mengcuiguang

优化空指针

parent 74768dd7
...@@ -70,7 +70,7 @@ object BannerManager { ...@@ -70,7 +70,7 @@ object BannerManager {
if (it.size > 0) { if (it.size > 0) {
val ad: TTNativeExpressAd = it[0] val ad: TTNativeExpressAd = it[0]
bannerAd = ad bannerAd = ad
if (bannerAd != null) { if (bannerAd != null && bannerAd!!.mediationManager != null && bannerAd!!.mediationManager.showEcpm != null) {
val vo = HashMap<String, Any>() val vo = HashMap<String, Any>()
vo["adType"] = Constant.GRO_MORE_ADTYPE3 vo["adType"] = Constant.GRO_MORE_ADTYPE3
vo["ecpm"] = bannerAd!!.mediationManager.showEcpm.ecpm vo["ecpm"] = bannerAd!!.mediationManager.showEcpm.ecpm
......
...@@ -14,6 +14,7 @@ import com.bytedance.sdk.openadsdk.mediation.ad.MediationViewBinder ...@@ -14,6 +14,7 @@ import com.bytedance.sdk.openadsdk.mediation.ad.MediationViewBinder
import com.duben.speedplayletu.MintsApplication import com.duben.speedplayletu.MintsApplication
import com.duben.speedplayletu.R import com.duben.speedplayletu.R
import com.duben.speedplayletu.ad.AdManager import com.duben.speedplayletu.ad.AdManager
import com.duben.speedplayletu.ad.banner.BannerManager
import com.duben.speedplayletu.common.Constant import com.duben.speedplayletu.common.Constant
import com.duben.speedplayletu.manager.TrackManager import com.duben.speedplayletu.manager.TrackManager
import com.duben.speedplayletu.utils.ForegroundOrBackground import com.duben.speedplayletu.utils.ForegroundOrBackground
...@@ -118,11 +119,13 @@ class ExpressManager { ...@@ -118,11 +119,13 @@ class ExpressManager {
private fun showAd() { private fun showAd() {
mTTFeedAd?.let { mTTFeedAd?.let {
if (it.mediationManager != null && it.mediationManager.showEcpm != null) {
val ecpm = it.mediationManager.showEcpm.ecpm val ecpm = it.mediationManager.showEcpm.ecpm
val vo = HashMap<String, Any>() val vo = HashMap<String, Any>()
vo["adType"] = Constant.GRO_MORE_ADTYPE1 vo["adType"] = Constant.GRO_MORE_ADTYPE1
vo["ecpm"] = ecpm vo["ecpm"] = ecpm
TrackManager.getInstance().cmtEcpm(vo) TrackManager.getInstance().cmtEcpm(vo)
}
if (it.mediationManager.isExpress) { if (it.mediationManager.isExpress) {
//--------------信息流模板广告渲染---------------- //--------------信息流模板广告渲染----------------
showExpressView(it) showExpressView(it)
......
...@@ -79,11 +79,13 @@ class MainExpressManager { ...@@ -79,11 +79,13 @@ class MainExpressManager {
expressAdCallback: ExpressAdCallback expressAdCallback: ExpressAdCallback
) { ) {
ttNativeAd?.let { ttNativeAd?.let {
if (it.mediationManager != null && it.mediationManager.showEcpm != null) {
val ecpm = it.mediationManager.showEcpm.ecpm val ecpm = it.mediationManager.showEcpm.ecpm
val vo = HashMap<String, Any>() val vo = HashMap<String, Any>()
vo["adType"] = Constant.GRO_MORE_ADTYPE1 vo["adType"] = Constant.GRO_MORE_ADTYPE1
vo["ecpm"] = ecpm vo["ecpm"] = ecpm
TrackManager.getInstance().cmtEcpm(vo) TrackManager.getInstance().cmtEcpm(vo)
}
if (it.mediationManager.isExpress) { if (it.mediationManager.isExpress) {
//--------------信息流模板广告渲染---------------- //--------------信息流模板广告渲染----------------
showExpressView(it, expressAdCallback) showExpressView(it, expressAdCallback)
......
...@@ -118,11 +118,13 @@ class MyExpressManager { ...@@ -118,11 +118,13 @@ class MyExpressManager {
private fun showAd() { private fun showAd() {
mTTFeedAd?.let { mTTFeedAd?.let {
if (it.mediationManager != null && it.mediationManager.showEcpm != null) {
val ecpm = it.mediationManager.showEcpm.ecpm val ecpm = it.mediationManager.showEcpm.ecpm
val vo = HashMap<String, Any>() val vo = HashMap<String, Any>()
vo["adType"] = Constant.GRO_MORE_ADTYPE1 vo["adType"] = Constant.GRO_MORE_ADTYPE1
vo["ecpm"] = ecpm vo["ecpm"] = ecpm
TrackManager.getInstance().cmtEcpm(vo) TrackManager.getInstance().cmtEcpm(vo)
}
if (it.mediationManager.isExpress) { if (it.mediationManager.isExpress) {
//--------------信息流模板广告渲染---------------- //--------------信息流模板广告渲染----------------
showExpressView(it) showExpressView(it)
......
...@@ -162,9 +162,9 @@ object SplashManager { ...@@ -162,9 +162,9 @@ object SplashManager {
isShowAd = true isShowAd = true
LogUtil.d(TAG, "gromore 开屏广告--> 6、onAdShow ") LogUtil.d(TAG, "gromore 开屏广告--> 6、onAdShow ")
if (mTTSplashAd != null) {
val vo = HashMap<String, Any>()
mTTSplashAd?.let { mTTSplashAd?.let {
if (it.mediationManager != null && it.mediationManager.showEcpm != null) {
val vo = HashMap<String, Any>()
vo["ecpm"] = it.mediationManager.showEcpm.ecpm vo["ecpm"] = it.mediationManager.showEcpm.ecpm
vo["adType"] = Constant.GRO_MORE_ADTYPE0 vo["adType"] = Constant.GRO_MORE_ADTYPE0
TrackManager.getInstance().cmtEcpm(vo) TrackManager.getInstance().cmtEcpm(vo)
......
...@@ -189,7 +189,7 @@ public class InMoneyVideo { ...@@ -189,7 +189,7 @@ public class InMoneyVideo {
@Override @Override
public void onAdShow() { public void onAdShow() {
if (mttRewardAd != null) { if (mttRewardAd != null) {
if (mttRewardAd.getMediationManager().getShowEcpm() != null) { if (mttRewardAd.getMediationManager() != null && mttRewardAd.getMediationManager().getShowEcpm() != null) {
nowAdcode = mttRewardAd.getMediationManager().getShowEcpm().getSlotId(); nowAdcode = mttRewardAd.getMediationManager().getShowEcpm().getSlotId();
nowEcpm = mttRewardAd.getMediationManager().getShowEcpm().getEcpm(); nowEcpm = mttRewardAd.getMediationManager().getShowEcpm().getEcpm();
nowAdSource = mttRewardAd.getMediationManager().getShowEcpm().getSdkName(); nowAdSource = mttRewardAd.getMediationManager().getShowEcpm().getSdkName();
...@@ -218,7 +218,7 @@ public class InMoneyVideo { ...@@ -218,7 +218,7 @@ public class InMoneyVideo {
int adCount = AppPreferencesManager.INSTANCE.get().getInt(Constant.VEDIO_AD_COUNT, 0); int adCount = AppPreferencesManager.INSTANCE.get().getInt(Constant.VEDIO_AD_COUNT, 0);
if (adCount < 50) { if (adCount < 50) {
AppPreferencesManager.INSTANCE.get().put(Constant.VEDIO_AD_COUNT, adCount+1); AppPreferencesManager.INSTANCE.get().put(Constant.VEDIO_AD_COUNT, adCount + 1);
} }
HashMap<String, Object> vo = new HashMap<>(); HashMap<String, Object> vo = new HashMap<>();
......
...@@ -128,7 +128,7 @@ public class InMoneyVideoNoPre { ...@@ -128,7 +128,7 @@ public class InMoneyVideoNoPre {
} }
if (mttRewardAd != null) { if (mttRewardAd != null) {
if (mttRewardAd.getMediationManager().getShowEcpm() != null) { if (mttRewardAd.getMediationManager() != null && mttRewardAd.getMediationManager().getShowEcpm() != null) {
nowAdcode = mttRewardAd.getMediationManager().getShowEcpm().getSlotId(); nowAdcode = mttRewardAd.getMediationManager().getShowEcpm().getSlotId();
nowEcpm = mttRewardAd.getMediationManager().getShowEcpm().getEcpm(); nowEcpm = mttRewardAd.getMediationManager().getShowEcpm().getEcpm();
nowAdSource = mttRewardAd.getMediationManager().getShowEcpm().getSdkName(); nowAdSource = mttRewardAd.getMediationManager().getShowEcpm().getSdkName();
......
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