Commit 3d9c463a authored by wanglei's avatar wanglei

[商业化]修改ad_price bug

parent 4ad1f495
......@@ -42,7 +42,7 @@ class AdBannerMgr {
adView = AdView(parent.context)
parent.addView(adView)
adView?.onPaidEventListener = AdmobOnPaidEventListener(adView, admobEvent.scope)
adView?.let { it.onPaidEventListener = AdmobOnPaidEventListener(it, admobEvent.scope) }
listener = ViewTreeObserver.OnGlobalLayoutListener {
val screenPixelDensity = parent.context.resources.displayMetrics.density
......
......@@ -186,15 +186,16 @@ class AdInterMgr {
context, GlobalConfig.ID_ADMOB_INTER, AdRequest.Builder().build(),
object : InterstitialAdLoadCallback() {
override fun onAdLoaded(ad: InterstitialAd) {
val event = (adEvent as AdmobEvent)
ad.onPaidEventListener = AdmobOnPaidEventListener(ad, adEvent.scope)
adState.onAdLoaded(ad, adEvent)
loadCallBack?.invoke()
loadCallBack?.invoke()
loadingCallBack?.invoke()
loadingCallBack = null
(adEvent as AdmobEvent).pullAd(ad.responseInfo)
LimitUtils.addRequestNum()
ad.onPaidEventListener = AdmobOnPaidEventListener(adEvent.scope)
event.pullAd(ad.responseInfo)
}
override fun onAdFailedToLoad(loadAdError: LoadAdError) {
......
......@@ -141,16 +141,15 @@ class AdmobEvent : AdEvent {
class AdmobOnPaidEventListener(
private val ad: Any?,
private val ad: Any,
private val coroutineScope: CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
) : OnPaidEventListener {
override fun onPaidEvent(adValue: AdValue) {
ad ?: return
onPaidEvent2(ad, adValue)
}
fun onPaidEvent2(ad: Any?, adValue: AdValue) {
fun onPaidEvent2(ad: Any, adValue: AdValue) {
// coroutineScope.launch {
try {
val flag = eventAdRatio()
......
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