Commit aae34a3e authored by jyx's avatar jyx

代码优化

parent 6464f500
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" />
<bytecodeTargetLevel target="11" />
</component>
</project>
\ No newline at end of file
......@@ -43,8 +43,6 @@ class DrawExpressManager {
private var expressId: String = ""
private var isClickScreen = true // 是否点击屏幕跳转广告
private val adLoadTime: Long = 0 // 广告展示时间,45分钟后当前广告失效,重新预加载广告
private var adPreingTime: Long = 0 // 防止预加载超时 2分钟
......@@ -60,13 +58,23 @@ class DrawExpressManager {
private var adcode = ""
private var ecpm = ""
private var adSource = ""
// private var mTTFeedAd: TTFeedAd? = null
fun getAdIsLoadSuc(): Boolean {
isAdDestroy()
val isOversped = TimeRender.isOverspedMin(adLoadTime, AdManager.AD_NO_SHOWTIME_OUT)
return isLoadSuccess == 2 && !isOversped
}
private fun isAdDestroy() {
if (isLoadSuccess == 2 && (viewCache.isEmpty() || ttFeedAdCache.isEmpty())) {
// 重置广告状态
isLoadSuccess = 0
isShowAd = true
adShowTime = System.currentTimeMillis()
}
}
fun preLoadAd() {
val isOversped = TimeRender.isOverspedMin(adLoadTime, AdManager.AD_NO_SHOWTIME_OUT)
val isPreingOversped = TimeRender.isOverspedMin(adPreingTime, AdManager.AD_REQUEST_TIME_OUT)
......@@ -90,7 +98,6 @@ class DrawExpressManager {
}
private fun loadAd() {
isClickScreen = true
expressId = BuildConfig.GROMORE_DRAW_CODE
val activity = ForegroundOrBackground.getTopActivity()
......@@ -190,7 +197,6 @@ class DrawExpressManager {
isShowAd = true
adShowTime = System.currentTimeMillis()
isLoadSuccess = 0
isClickScreen = true
// callback?.loadSuccess(frameLayout)
if (viewCache.size > 0) {
callback?.loadSuccess(viewCache.lastElement())
......@@ -246,7 +252,6 @@ class DrawExpressManager {
* 销毁
*/
fun destroy() {
// 数据重置
adcode = ""
ecpm = ""
......@@ -261,6 +266,8 @@ class DrawExpressManager {
ttFeedAd.destroy()
}
ttFeedAdCache.clear()
isAdDestroy()
this.mExpressAdCallback = null
}
......
......@@ -66,6 +66,7 @@ public class SuperShortVideoView extends RelativeLayout {
}
public void loadData(VedioBean vedioBean, List<VideoMultiItemEntity> list, int currentPosition) {
mLastPositionInIDLE = -1;
this.mList.clear();
this.mList = list;
this.mCurrentPosition = currentPosition;
......
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