Commit a18f8964 authored by jyx's avatar jyx

代码优化

parent 82e84ec3
......@@ -212,6 +212,10 @@ class DrawExpressManager {
private fun showExpressView(it: TTFeedAd) {
it.setExpressRenderListener(object : MediationExpressRenderListener {
override fun onRenderSuccess(p0: View?, p1: Float, p2: Float, p3: Boolean) {
LogUtil.d(
TAG,
"gromore draw信息流--> 3、Gromore onRenderSuccess expressId=${expressId} "
)
Log.i(TAG, "onRenderSuccess")
it.setDislikeCallback(ForegroundOrBackground.getTopActivity(),
object : TTAdDislike.DislikeInteractionCallback {
......
......@@ -6,12 +6,16 @@ import android.view.View
import com.airbnb.lottie.LottieComposition
import com.airbnb.lottie.LottieCompositionFactory
import com.airbnb.lottie.LottieDrawable
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.google.gson.Gson
import com.mints.helivideo.R
import com.mints.helivideo.common.Constant
import com.mints.helivideo.mvp.model.RecommendBean
import com.mints.helivideo.ui.activitys.base.BaseActivity
import com.mints.helivideo.utils.LogUtil
import com.mints.helivideo.video.tx.NewTxVideoActivity
import com.mints.helivideo.video.tx.TXVideoBaseView
import com.mints.helivideo.video.tx.TXVodPlayerWrapper
import com.mints.helivideo.video.tx.VideoModel
import com.mints.library.utils.json.JsonUtil
......@@ -58,9 +62,16 @@ class RecommendActivity : BaseActivity(), View.OnClickListener {
}
iv_recommend_top.setImageDrawable(lottieDrawable)
Glide.with(context).load(recommendBean?.vedioMsg?.coverImage)
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.ALL).centerCrop()
.into(baseItemView.findViewById(R.id.iv_cover))
val videoModel = VideoModel(recommendBean?.showVedioUrl)
val txVodPlayerWrapper = TXVodPlayerWrapper(mContext)
txVodPlayerWrapper.preStartPlay(videoModel)
txVodPlayerWrapper.setAutoLoop()
baseItemView.hideEmptyView()
baseItemView.setTXVodPlayer(txVodPlayerWrapper)
baseItemView.startPlay()
}
......
......@@ -22,6 +22,9 @@ import com.mints.helivideo.video.tx.adapter.TxVideoAdapter
import com.mints.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_new_tx_video.*
/**
* 推荐剧集二级页
*/
class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
VideoEpisodeAdapter.OnEpisodeClickListener, TxVideoAdapter.OnCustomChildClickListener {
......@@ -53,6 +56,7 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
val json = extras?.getString(Constant.VEDIO_BEAN)
isPlayNext = extras?.getBoolean(Constant.VEDIO_NEXT, false) == true
mVedioBean = Gson().fromJson(json, VedioBean::class.java)
mVedioBean?.isRecommendVedio = true
orderTagsList = mVedioBean?.orderTags
if (isPlayNext) {
mVedioBean?.let {
......@@ -67,7 +71,6 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
override fun onResume() {
super.onResume()
super_short_video_view.resume()
videoPresenter.showTurn()
if (mVipFlag != UserManager.getInstance().vipFlag && UserManager.getInstance().vipFlag) {
// 重置状态
......@@ -167,6 +170,7 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
tipList = indexList.tip
mVedioBean = indexList.vedioMsg
mVedioBean?.isRecommendVedio = true
indexBean = indexList
videos.clear()
videos.addAll(indexList.list)
......@@ -179,7 +183,6 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
}
override fun collectSuc() {
mVedioBean!!.collect = 1
}
override fun collectFail() {
......@@ -187,7 +190,6 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
}
override fun cancelCollectSuc() {
mVedioBean!!.collect = 0
}
override fun cancelCollectFail() {
......@@ -238,14 +240,7 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
override fun onCustomChildClick(view: View, position: Int) {
when (view.id) {
R.id.ll_collect -> {
// 收藏
mVedioBean?.let {
if (it.collect == 0) {
videoPresenter.collect("" + it.vedioId)
} else {
videoPresenter.cancelCollect("" + it.vedioId)
}
}
// 无收藏
}
R.id.leave -> {
// 返回
......
......@@ -12,6 +12,7 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
......@@ -19,6 +20,7 @@ import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.mints.helivideo.utils.UIUtils;
import com.tencent.rtmp.TXLiveConstants;
import com.tencent.rtmp.ui.TXCloudVideoView;
import com.mints.helivideo.R;
......@@ -37,6 +39,7 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
private ImageView mIvCover;
private ImageView mPauseImageView;
private TextView mProgressTime;
private View mEmptyView;
private TXVodPlayerWrapper mTXVodPlayerWrapper;
private boolean mStartSeek = false;
......@@ -78,6 +81,7 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
mTXCloudVideoView.setOnClickListener(this);
mProgressTime = mRootView.findViewById(R.id.tv_progress_time);
setProgressTimeColor(mProgressTime.getText().toString());
mEmptyView = mRootView.findViewById(R.id.empty_view);
mProgressTime.setVisibility(View.GONE);
mSeekBar.setOnTouchListener(new OnTouchListener() {
......@@ -208,6 +212,11 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
mStartSeek = false;
}
public void hideEmptyView() {
ViewGroup.LayoutParams layoutParams = mEmptyView.getLayoutParams();
layoutParams.height = UIUtils.dip2px(getContext(), 20);
mEmptyView.setLayoutParams(layoutParams);
}
public void pausePlayer() {
if (mTXVodPlayerWrapper != null) {
......
......@@ -153,6 +153,9 @@ public class TXVodPlayerWrapper implements ITXVodPlayListener {
mVodPlayer.setPlayerView(txCloudVideoView);
}
public void setAutoLoop() {
mVodPlayer.setLoop(true);
}
public void preStartPlay(VideoModel bean) {
this.mUrl = bean.videoURL;
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#90000000"
......@@ -16,11 +17,20 @@
android:layout_width="330dp"
android:layout_height="420dp">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardBackgroundColor="@android:color/transparent"
app:cardCornerRadius="@dimen/dp_10">
<com.mints.helivideo.video.tx.TXVideoBaseView
android:id="@+id/baseItemView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.cardview.widget.CardView>
<ImageView
android:id="@+id/ic_recommend_quit"
android:layout_width="60dp"
......@@ -28,6 +38,7 @@
android:layout_alignParentEnd="true"
android:layout_gravity="end"
android:layout_marginTop="2dp"
android:elevation="2dp"
android:padding="10dp"
android:scaleType="centerCrop"
android:src="@mipmap/ic_quit_yuan" />
......@@ -36,8 +47,8 @@
<RelativeLayout
android:id="@+id/fl_recommend_next"
android:layout_width="match_parent"
android:layout_marginTop="10dp"
android:layout_height="100dp">
android:layout_height="100dp"
android:layout_marginTop="10dp">
<ImageView
android:id="@+id/iv_recommend_top"
......
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