Commit 11910e77 authored by mengcuiguang's avatar mengcuiguang

test

parent 60aa978b
......@@ -4,6 +4,7 @@ import android.app.Activity;
import com.bytedance.msdk.api.AdError;
import com.bytedance.msdk.api.AdSlot;
import com.bytedance.msdk.api.GDTExtraOption;
import com.bytedance.msdk.api.TTMediationAdSdk;
import com.bytedance.msdk.api.TTSettingConfigCallback;
import com.bytedance.msdk.api.TTVideoOption;
......@@ -76,15 +77,15 @@ public class InterstitialGroManager {
* 注:每次加载插屏广告的时候需要新建一个TTInterstitialAd,否则可能会出现广告填充问题
* ( 例如:mInterstitialAd = new TTInterstitialAd(this, adUnitId);)
*/
// if (isMain) {
// mInterstitialAd = new TTInterstitialAd(activity, CsjGroMoreManager.INSTANCE.getAPP_IN_MAIN_AD_UNIT_INTERSTITIAL_ID());
// } else {
// mInterstitialAd = new TTInterstitialAd(activity, CsjGroMoreManager.INSTANCE.getAPP_IN_MAIN_AD_UNIT_INTERSTITIAL_ID());
// }
mInterstitialAd = new TTInterstitialAd(activity, CsjGroMoreManager.INSTANCE.getAPP_IN_MAIN_AD_UNIT_INTERSTITIAL_ID());
mInterstitialAd = new TTInterstitialAd(activity, "946369785");
//模板1.0
TTVideoOption videoOption = VideoOptionUtil.getTTVideoOption();
// //模板2.0
// if (mExpressType == GDTExtraOption.FeedExpressType.FEED_EXPRESS_TYPE_2) {
// }
videoOption = VideoOptionUtil.getTTVideoOption2();
//创建插屏广告请求参数AdSlot,具体参数含义参考文档
AdSlot adSlot = new AdSlot.Builder()
......
......@@ -2,6 +2,9 @@ package com.mints.flowbox.ad.wifi
import android.app.Activity
import com.mints.flowbox.ad.full.FullGroManager
import com.mints.flowbox.ad.inscreen.InterstitialGroManager
import com.mints.flowbox.common.Constant
import java.util.*
/**
* wifi广告管理
......@@ -19,28 +22,28 @@ class WifiAdManager private constructor() {
private var wifiAdStatusListener: WifiAdStatusListener? = null
// groMore插屏
// private var interstitialGroManager: InterstitialGroManager? = null
private var interstitialGroManager: InterstitialGroManager? = null
// groMore全屏
private var fullGroManager: FullGroManager? = null
// 当前广告类型
// private var currentAdType = ""
private var currentAdType = ""
/**
* 预加载广告,必须传入activity
*/
fun loadWifiAd(activity: Activity) {
// currentAdType = getCurrentAdType()
//
// when (currentAdType) {
// Constant.GROMORE_INSERTSCREEN_AD -> {
// preLoadInterstitialGroMore(activity)
// }
// Constant.GROMORE_FULL_AD -> {
// preLoadFullGroMore(activity,true)
// }
// }
currentAdType = getCurrentAdType()
when (currentAdType) {
Constant.GROMORE_INSERTSCREEN_AD -> {
preLoadInterstitialGroMore(activity)
}
Constant.GROMORE_FULL_AD -> {
preLoadFullGroMore(activity, true)
}
}
preLoadFullGroMore(activity, true)
}
......@@ -48,7 +51,7 @@ class WifiAdManager private constructor() {
/**
* 定义广告类型规则
*/
// private fun getCurrentAdType(): String {
private fun getCurrentAdType(): String {
// var tempAdType = ""
// val randomInt = Random().nextInt(10)
// if (randomInt % 2 == 0) {
......@@ -58,19 +61,19 @@ class WifiAdManager private constructor() {
// }
//
// return tempAdType
// return Constant.GROMORE_FULL_AD
// }
return Constant.GROMORE_INSERTSCREEN_AD
}
/**
* 插屏
*/
// private fun preLoadInterstitialGroMore(activity: Activity) {
// if (interstitialGroManager != null) {
// interstitialGroManager?.onDestroy()
// }
// interstitialGroManager = InterstitialGroManager()
// interstitialGroManager?.loadInsertScreenAd(activity, false)
// }
private fun preLoadInterstitialGroMore(activity: Activity) {
if (interstitialGroManager != null) {
interstitialGroManager?.onDestroy()
}
interstitialGroManager = InterstitialGroManager()
interstitialGroManager?.loadInsertScreenAd(activity, false,2)
}
/**
* 全屏
......@@ -88,61 +91,61 @@ class WifiAdManager private constructor() {
* 展示广告
*/
fun showInterstitial() {
// when (currentAdType) {
//// Constant.GROMORE_INSERTSCREEN_AD -> {
//// interstitialGroManager?.setWifiAdStatusListener(object : WifiAdStatusListener {
//// override fun adSuccess() {
////
//// }
////
//// override fun adFail() {
////
//// }
////
//// override fun adClose() {
//// wifiAdStatusListener?.adClose()
//// }
//// })
//// interstitialGroManager?.showInteractionAd()
//// }
// Constant.GROMORE_FULL_AD -> {
when (currentAdType) {
Constant.GROMORE_INSERTSCREEN_AD -> {
interstitialGroManager?.setWifiAdStatusListener(object : WifiAdStatusListener {
override fun adSuccess() {
}
override fun adFail() {
}
override fun adClose() {
wifiAdStatusListener?.adClose()
}
})
interstitialGroManager?.showInteractionAd()
}
Constant.GROMORE_FULL_AD -> {
fullGroManager?.setWifiAdStatusListener(wifiAdStatusListener)
fullGroManager?.showFullAd()
// }
// }
}
}
}
/**
* 展示广告
*/
fun showInterstitial(_activity: Activity) {
// when (currentAdType) {
// Constant.GROMORE_INSERTSCREEN_AD -> {
// interstitialGroManager?.setWifiAdStatusListener(object : WifiAdStatusListener {
// override fun adSuccess() {
//
// }
//
// override fun adFail() {
//
// }
//
// override fun adClose() {
// wifiAdStatusListener?.adClose()
// }
// })
// interstitialGroManager?.showInteractionAd(_activity)
// }
// Constant.GROMORE_FULL_AD -> {
fullGroManager?.showFullAd(_activity,wifiAdStatusListener)
// }
// }
when (currentAdType) {
Constant.GROMORE_INSERTSCREEN_AD -> {
interstitialGroManager?.setWifiAdStatusListener(object : WifiAdStatusListener {
override fun adSuccess() {
}
override fun adFail() {
}
override fun adClose() {
wifiAdStatusListener?.adClose()
}
})
interstitialGroManager?.showInteractionAd(_activity)
}
Constant.GROMORE_FULL_AD -> {
fullGroManager?.showFullAd(_activity, wifiAdStatusListener)
}
}
}
fun onDestroy() {
// interstitialGroManager?.onDestroy()
// interstitialGroManager?.setWifiAdStatusListener(null)
// interstitialGroManager = null
interstitialGroManager?.onDestroy()
interstitialGroManager?.setWifiAdStatusListener(null)
interstitialGroManager = null
fullGroManager?.onDestroy()
fullGroManager = null
......
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