Commit 94cabbbf authored by jyx's avatar jyx

代码优化

parent b8430428
...@@ -55,7 +55,7 @@ class MainExpressManager { ...@@ -55,7 +55,7 @@ class MainExpressManager {
UIUtils.getAdWidth3(MintsApplication.getContext()).toInt(), UIUtils.getAdWidth3(MintsApplication.getContext()).toInt(),
UIUtils.dip2px(MintsApplication.getContext(), 192f) UIUtils.dip2px(MintsApplication.getContext(), 192f)
) )
.setAdCount(3)//请求广告数量为1到3条 (优先采用平台配置的数量) .setAdCount(2)//请求广告数量为1到3条 (优先采用平台配置的数量)
.build() .build()
adNativeLoader.loadFeedAd(adslot, object : TTAdNative.FeedAdListener { adNativeLoader.loadFeedAd(adslot, object : TTAdNative.FeedAdListener {
......
...@@ -18,6 +18,7 @@ import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener ...@@ -18,6 +18,7 @@ import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener
import com.mints.helivideo.common.AppConfig import com.mints.helivideo.common.AppConfig
import com.mints.helivideo.ui.adapter.NewHotStyle2Adapter import com.mints.helivideo.ui.adapter.NewHotStyle2Adapter
import com.mints.helivideo.ui.widgets.MyGridLayoutManager import com.mints.helivideo.ui.widgets.MyGridLayoutManager
import com.mints.helivideo.utils.LogUtil
import kotlinx.android.synthetic.main.fragment_movie.* import kotlinx.android.synthetic.main.fragment_movie.*
class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener { class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener {
...@@ -84,7 +85,6 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener ...@@ -84,7 +85,6 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener
override fun onLoadMore(refreshLayout: RefreshLayout) { override fun onLoadMore(refreshLayout: RefreshLayout) {
hotPage = ++hotPage hotPage = ++hotPage
loadAd()
picContentPresenter.getHomePageImageList(mType, hotPage, Constant.PAGE_SIZE) picContentPresenter.getHomePageImageList(mType, hotPage, Constant.PAGE_SIZE)
} }
...@@ -102,6 +102,7 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener ...@@ -102,6 +102,7 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener
if (data.list.size < Constant.PAGE_SIZE) { if (data.list.size < Constant.PAGE_SIZE) {
srlMainPage.finishLoadMoreWithNoMoreData() srlMainPage.finishLoadMoreWithNoMoreData()
} else { } else {
loadAd()
srlMainPage.finishLoadMore() srlMainPage.finishLoadMore()
} }
hotStyleAdapter.addData(getAdapterData(data.list)) hotStyleAdapter.addData(getAdapterData(data.list))
...@@ -164,13 +165,13 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener ...@@ -164,13 +165,13 @@ class MovieFragment : LazyLoadBaseFragment(), PicContentView, OnLoadMoreListener
var insertIndex = 3 var insertIndex = 3
val itemEntity3s = hotStyleAdapter.data val itemEntity3s = hotStyleAdapter.data
for (i in 0 until itemEntity3s.size) { for (i in itemEntity3s.size - 1 downTo 0) {
if (itemEntity3s[i].itemType == MULTI_ITEM_3) { if (itemEntity3s[i].itemType == MULTI_ITEM_3) {
insertIndex += 4 insertIndex += 4
} }
} }
if (insertIndex >= itemEntity3s.size - 1) { if (insertIndex >= itemEntity3s.size) {
insertIndex = itemEntity3s.size - 1 insertIndex = itemEntity3s.size
} }
val data = VideoMultiItemEntity3(MULTI_ITEM_3, null, adView) val data = VideoMultiItemEntity3(MULTI_ITEM_3, null, adView)
......
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