Commit 0841eb5a authored by jyx's avatar jyx

优化Draw信息流黑屏

parent 9e15f83d
......@@ -14,8 +14,9 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.SimpleItemAnimator;
import com.mints.helivideo.ad.draw.DrawExpressManager;
import com.mints.helivideo.ad.draw.HomeDrawExpressManager;
import com.mints.helivideo.manager.UserManager;
import com.mints.helivideo.mvp.model.VideoMultiItemEntity2;
import com.mints.helivideo.video.tx.adapter.TxRecommendVideoAdapter;
......@@ -91,11 +92,13 @@ public class RecommendVideoView extends RelativeLayout {
}
};
mRecyclerView.setLayoutManager(mLayoutManager);
// mRecyclerView.setItemViewCacheSize(10);
mRecyclerView.setItemViewCacheSize(6);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setDrawingCacheEnabled(true);
mRecyclerView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_LOW);
((SimpleItemAnimator) mRecyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
mRecyclerView.setAdapter(mAdapter);
addListener();
}
......@@ -280,7 +283,7 @@ public class RecommendVideoView extends RelativeLayout {
// 每隔3个视频出现一个广告
if (position + 1 < 2 || (position + 1) % 3 != 0 || lastAddAdPosition > position) return;
if (DrawExpressManager.Companion.getInstance().getAdIsLoadSuc()) {
if (HomeDrawExpressManager.Companion.getInstance().getAdIsLoadSuc()) {
VideoMultiItemEntity2 itemAD = new VideoMultiItemEntity2(MULTI_ITEM_3, null, new VideoModel(""));
mList.add(position + 1, itemAD);
mAdapter.notifyItemInserted(position + 1);
......
......@@ -4,7 +4,7 @@ import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import com.mints.helivideo.R
import com.mints.helivideo.ad.draw.DrawExpressManager
import com.mints.helivideo.ad.draw.HomeDrawExpressManager
import com.mints.helivideo.common.AppConfig
import com.mints.helivideo.common.Constant
import com.mints.helivideo.manager.LocalVedioManager
......@@ -39,10 +39,6 @@ class TxVideoFragment : BaseFragment(), RecommendView {
override fun initViewsAndEvents() {
recommendPresenter.attachView(this)
if (!UserManager.getInstance().vipFlag) {
DrawExpressManager.instance.preLoadAd()
}
recommendPresenter.autoList()
recommend_view.setOnLoadMoreListener {
......@@ -97,6 +93,10 @@ class TxVideoFragment : BaseFragment(), RecommendView {
super.onResume()
if (AppConfig.fragmentClickFlag != Constant.FRAGMENT_CLICK_TWO) return
if (!UserManager.getInstance().vipFlag) {
HomeDrawExpressManager.instance.preLoadAd()
}
recommend_view.resume()
}
......@@ -110,7 +110,7 @@ class TxVideoFragment : BaseFragment(), RecommendView {
super.onDestroyView()
recommend_view.releasePlayer()
DrawExpressManager.instance.destroy()
HomeDrawExpressManager.instance.destroy()
}
override fun onDetach() {
......
......@@ -11,7 +11,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.mints.helivideo.R
import com.mints.helivideo.ad.draw.DrawExpressManager
import com.mints.helivideo.ad.draw.HomeDrawExpressManager
import com.mints.helivideo.ad.express.ExpressAdCallback
import com.mints.helivideo.mvp.model.*
import com.mints.helivideo.utils.UIUtils
......@@ -78,7 +78,7 @@ class TxRecommendVideoAdapter :
}
private fun initAdHolder(holder: BaseViewHolder) {
DrawExpressManager.instance.getAdView(object : ExpressAdCallback {
HomeDrawExpressManager.instance.getAdView(object : ExpressAdCallback {
override fun loadSuccess(adView: FrameLayout?) {
adView?.let {
UIUtils.removeFromParent(it)
......@@ -86,7 +86,7 @@ class TxRecommendVideoAdapter :
fmAd.removeAllViews()
fmAd.addView(it)
}
DrawExpressManager.instance.preLoadAd()
HomeDrawExpressManager.instance.preLoadAd()
}
override fun renderSuccess(adView: FrameLayout?): Boolean {
......
......@@ -6,6 +6,7 @@
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/src_video"
app:srlEnableRefresh="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srlAccentColor="@color/black"
......
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