Commit a0ad52d4 authored by jyx's avatar jyx

代码优化

parent 62ffa5ee
......@@ -54,6 +54,8 @@ class DrawExpressManager {
private var mExpressAdCallback: ExpressAdCallback? = null
private var viewCache = Stack<FrameLayout>()
// 载体
private var adcode = ""
private var ecpm = ""
......@@ -190,8 +192,8 @@ class DrawExpressManager {
adShowTime = System.currentTimeMillis()
isLoadSuccess = 0
isClickScreen = true
callback?.loadSuccess(frameLayout)
// callback?.loadSuccess(viewCache.lastElement())
// callback?.loadSuccess(frameLayout)
callback?.loadSuccess(viewCache.lastElement())
} else {
LogUtil.e(TAG, "gromore draw信息流--> 5、展示广告时失败了,广告可能超时45分钟 onError ")
// 状态重置
......@@ -223,11 +225,25 @@ class DrawExpressManager {
(view.parent as ViewGroup).removeView(view)
}
frameLayout?.addView(view)
// val view: FrameLayout = frameLayout!!
// val frameLayout = FrameLayout(MintsApplication.getContext())
// frameLayout.addView(view)
// viewCache.add(frameLayout)
}
// val view: FrameLayout = frameLayout!!
// val frameLayout = FrameLayout(MintsApplication.getContext())
// frameLayout.addView(view)
viewCache.add(frameLayout)
// mExpressAdCallback?.let {
// if (it.renderSuccess(viewCache.lastElement())) {
// LogUtil.d(
// TAG,
// "gromore信息流 onRenderSuccess -> showAd->$isShowAd \n adcode->$adcode ecpm->$ecpm"
// )
//
// isLoadSuccess = 0
// isShowAd = true
// adShowTime = System.currentTimeMillis()
// }
// }
// mExpressAdCallback = null
}
override fun onRenderFail(p0: View?, p1: String?, p2: Int) {
......@@ -259,6 +275,8 @@ class DrawExpressManager {
ecpm = ""
adSource = ""
viewCache.clear()
mTTFeedAd?.destroy()
this.mExpressAdCallback = null
}
......
......@@ -194,20 +194,6 @@ class ExpressManager {
private fun showExpressView(it: TTFeedAd) {
it.setExpressRenderListener(object : MediationExpressRenderListener {
override fun onRenderSuccess(p0: View?, p1: Float, p2: Float, p3: Boolean) {
mExpressAdCallback?.let {
if (it.renderSuccess(frameLayout)) {
LogUtil.d(
TAG,
"gromore信息流 onRenderSuccess -> showAd->$isShowAd \n adcode->$adcode ecpm->$ecpm"
)
isLoadSuccess = 0
isShowAd = true
adShowTime = System.currentTimeMillis()
}
}
mExpressAdCallback = null
Log.i(TAG, "onRenderSuccess")
it.setDislikeCallback(ForegroundOrBackground.getTopActivity(),
object : TTAdDislike.DislikeInteractionCallback {
......@@ -229,6 +215,20 @@ class ExpressManager {
}
frameLayout?.addView(view)
}
mExpressAdCallback?.let {
if (it.renderSuccess(frameLayout)) {
LogUtil.d(
TAG,
"gromore信息流 onRenderSuccess -> showAd->$isShowAd \n adcode->$adcode ecpm->$ecpm"
)
isLoadSuccess = 0
isShowAd = true
adShowTime = System.currentTimeMillis()
}
}
mExpressAdCallback = null
}
override fun onRenderFail(p0: View?, p1: String?, p2: Int) {
......
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