Commit dfb91e38 authored by jyx's avatar jyx

添加draw信息流及信息流广告

parent d966e4f8
...@@ -64,6 +64,7 @@ android { ...@@ -64,6 +64,7 @@ android {
buildConfigField "String", "GROMORE_APP_ID", GROMORE_APP_ID buildConfigField "String", "GROMORE_APP_ID", GROMORE_APP_ID
buildConfigField "String", "GROMORE_SPLASH_CODE", GROMORE_SPLASH_CODE buildConfigField "String", "GROMORE_SPLASH_CODE", GROMORE_SPLASH_CODE
buildConfigField "String", "GROMORE_VIDEO_CODE", GROMORE_VIDEO_CODE buildConfigField "String", "GROMORE_VIDEO_CODE", GROMORE_VIDEO_CODE
buildConfigField "String", "GROMORE_DRAW_CODE", GROMORE_DRAW_CODE
buildConfigField "String", "GROMORE_EXPRESS_CODE", GROMORE_EXPRESS_CODE buildConfigField "String", "GROMORE_EXPRESS_CODE", GROMORE_EXPRESS_CODE
buildConfigField "String", "WEIXIN_APP_PAY_ID", WEIXIN_APP_PAY_ID buildConfigField "String", "WEIXIN_APP_PAY_ID", WEIXIN_APP_PAY_ID
...@@ -84,6 +85,7 @@ android { ...@@ -84,6 +85,7 @@ android {
buildConfigField "String", "GROMORE_APP_ID", GROMORE_APP_ID buildConfigField "String", "GROMORE_APP_ID", GROMORE_APP_ID
buildConfigField "String", "GROMORE_SPLASH_CODE", GROMORE_SPLASH_CODE buildConfigField "String", "GROMORE_SPLASH_CODE", GROMORE_SPLASH_CODE
buildConfigField "String", "GROMORE_VIDEO_CODE", GROMORE_VIDEO_CODE buildConfigField "String", "GROMORE_VIDEO_CODE", GROMORE_VIDEO_CODE
buildConfigField "String", "GROMORE_DRAW_CODE", GROMORE_DRAW_CODE
buildConfigField "String", "GROMORE_EXPRESS_CODE", GROMORE_EXPRESS_CODE buildConfigField "String", "GROMORE_EXPRESS_CODE", GROMORE_EXPRESS_CODE
buildConfigField "String", "WEIXIN_APP_PAY_ID", WEIXIN_APP_PAY_ID buildConfigField "String", "WEIXIN_APP_PAY_ID", WEIXIN_APP_PAY_ID
......
...@@ -31,6 +31,9 @@ object Constant { ...@@ -31,6 +31,9 @@ object Constant {
const val CARRIERTYPE_NINE = "2" const val CARRIERTYPE_NINE = "2"
const val CARRIERTYPE_NINE3 = "3" const val CARRIERTYPE_NINE3 = "3"
const val CARRIERTYPE_DRAW_EXPRESS = "4"
/** /**
* app应用首页 0-主页 1-中间 2-我 * app应用首页 0-主页 1-中间 2-我
*/ */
......
package com.mints.helivideo.mvp.model package com.mints.helivideo.mvp.model
import com.chad.library.adapter.base.entity.MultiItemEntity import com.chad.library.adapter.base.entity.MultiItemEntity
import com.mints.helivideo.video.tx.VideoModel
const val MULTI_ITEM_1 = 1
const val MULTI_ITEM_2 = 2
const val MULTI_ITEM_3 = 3
data class VideoMultiItemEntity( data class VideoMultiItemEntity(
override val itemType: Int, override val itemType: Int,
var video: IndexList.VedioEpisodeBean var video: IndexList.VedioEpisodeBean?,
) : MultiItemEntity, var videoModel: VideoModel?
java.io.Serializable { ) : MultiItemEntity, java.io.Serializable
companion object {
const val MULTI_ITEM_1 = 1 data class VideoMultiItemEntity2(
const val MULTI_ITEM_2 = 2 override val itemType: Int,
} var video: VedioBean?,
} var videoModel: VideoModel?
\ No newline at end of file ) : MultiItemEntity, java.io.Serializable
...@@ -20,6 +20,7 @@ import com.lzf.easyfloat.enums.SidePattern ...@@ -20,6 +20,7 @@ import com.lzf.easyfloat.enums.SidePattern
import com.mints.helivideo.MintsApplication import com.mints.helivideo.MintsApplication
import com.mints.helivideo.R import com.mints.helivideo.R
import com.mints.helivideo.ad.AdManager import com.mints.helivideo.ad.AdManager
import com.mints.helivideo.ad.express.ExpressManager
import com.mints.helivideo.common.AppConfig import com.mints.helivideo.common.AppConfig
import com.mints.helivideo.common.Constant import com.mints.helivideo.common.Constant
import com.mints.helivideo.ui.activitys.base.BaseActivity import com.mints.helivideo.ui.activitys.base.BaseActivity
...@@ -61,6 +62,8 @@ class MainActivity : BaseActivity(), View.OnClickListener { ...@@ -61,6 +62,8 @@ class MainActivity : BaseActivity(), View.OnClickListener {
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
DPHolderManager.initDpSdk(MintsApplication.getContext()); DPHolderManager.initDpSdk(MintsApplication.getContext());
ExpressManager.instance.preLoadAd()
audioManager = getSystemService(Context.AUDIO_SERVICE) as AudioManager audioManager = getSystemService(Context.AUDIO_SERVICE) as AudioManager
contentLayout = findViewById(R.id.content_layout) contentLayout = findViewById(R.id.content_layout)
......
package com.mints.helivideo.ui.widgets;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.widget.FrameLayout;
/**
* @author jyx
* @date 2021/6/30
* @des 圆角view
*/
public class RoundRectLayout extends FrameLayout {
private Path mPath;
private int mRadius;
private int mWidth;
private int mHeight;
private int mLastRadius;
public static final int MODE_NONE = 0;
public static final int MODE_ALL = 1;
public static final int MODE_LEFT = 2;
public static final int MODE_TOP = 3;
public static final int MODE_RIGHT = 4;
public static final int MODE_BOTTOM = 5;
private int mRoundMode = MODE_ALL;
public RoundRectLayout(Context context) {
super(context);
init();
}
public RoundRectLayout(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
private void init() {
// setBackgroundDrawable(new ColorDrawable(0x33ff0000));
mPath = new Path();
mPath.setFillType(Path.FillType.EVEN_ODD);
setCornerRadius(dp2px(10));
}
/**
* 设置是否圆角裁边
*
* @param roundMode
*/
public void setRoundMode(int roundMode) {
mRoundMode = roundMode;
}
/**
* 设置圆角半径
*
* @param radius
*/
public void setCornerRadius(int radius) {
mRadius = radius;
}
private void checkPathChanged() {
if (getWidth() == mWidth && getHeight() == mHeight && mLastRadius == mRadius) {
return;
}
mWidth = getWidth();
mHeight = getHeight();
mLastRadius = mRadius;
mPath.reset();
switch (mRoundMode) {
case MODE_ALL:
mPath.addRoundRect(new RectF(0, 0, mWidth, mHeight), mRadius, mRadius, Path.Direction.CW);
break;
case MODE_LEFT:
mPath.addRoundRect(new RectF(0, 0, mWidth, mHeight),
new float[]{mRadius, mRadius, 0, 0, 0, 0, mRadius, mRadius},
Path.Direction.CW);
break;
case MODE_TOP:
mPath.addRoundRect(new RectF(0, 0, mWidth, mHeight),
new float[]{mRadius, mRadius, mRadius, mRadius, 0, 0, 0, 0},
Path.Direction.CW);
break;
case MODE_RIGHT:
mPath.addRoundRect(new RectF(0, 0, mWidth, mHeight),
new float[]{0, 0, mRadius, mRadius, mRadius, mRadius, 0, 0},
Path.Direction.CW);
break;
case MODE_BOTTOM:
mPath.addRoundRect(new RectF(0, 0, mWidth, mHeight),
new float[]{0, 0, 0, 0, mRadius, mRadius, mRadius, mRadius},
Path.Direction.CW);
break;
}
}
@Override
public void draw(Canvas canvas) {
if (mRoundMode != MODE_NONE) {
int saveCount = canvas.save();
checkPathChanged();
canvas.clipPath(mPath);
super.draw(canvas);
canvas.restoreToCount(saveCount);
} else {
super.draw(canvas);
}
}
public static int dp2px(int dp) {
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp,
Resources.getSystem().getDisplayMetrics());
}
}
\ No newline at end of file
...@@ -26,6 +26,8 @@ class VideoEpisodeDialog( ...@@ -26,6 +26,8 @@ class VideoEpisodeDialog(
) : ) :
Dialog(context, R.style.dialog) { Dialog(context, R.style.dialog) {
private var mRealSeeIndex = 0
private val lp: WindowManager.LayoutParams private val lp: WindowManager.LayoutParams
private val vp2: ViewPager2 private val vp2: ViewPager2
...@@ -107,8 +109,13 @@ class VideoEpisodeDialog( ...@@ -107,8 +109,13 @@ class VideoEpisodeDialog(
} }
}) })
if (mRealSeeIndex == 0) {
tab.getTabAt(vedioBean.seeIndex / 30)?.select() tab.getTabAt(vedioBean.seeIndex / 30)?.select()
} else {
tab.getTabAt(mRealSeeIndex / 30)?.select()
} }
}
private fun getTabView(text: String, position: Int): View { private fun getTabView(text: String, position: Int): View {
val view = LayoutInflater.from(context).inflate(R.layout.item_epsiode_tab, null) val view = LayoutInflater.from(context).inflate(R.layout.item_epsiode_tab, null)
...@@ -139,6 +146,7 @@ class VideoEpisodeDialog( ...@@ -139,6 +146,7 @@ class VideoEpisodeDialog(
} }
fun setCurrentIndex(position: Int) { fun setCurrentIndex(position: Int) {
mRealSeeIndex = position
for (mDatum in mData) { for (mDatum in mData) {
mDatum.playing = false mDatum.playing = false
} }
......
...@@ -282,6 +282,6 @@ public class UIUtils { ...@@ -282,6 +282,6 @@ public class UIUtils {
} }
public static float getAdWidth(Context context) { public static float getAdWidth(Context context) {
return getScreenWidth(context) / getDensity(context) - 40; return getScreenWidth(context) - dp2px(30);
} }
} }
...@@ -5,6 +5,7 @@ import android.os.Bundle ...@@ -5,6 +5,7 @@ import android.os.Bundle
import android.util.Log import android.util.Log
import android.view.View import android.view.View
import android.widget.Button import android.widget.Button
import android.widget.FrameLayout
import android.widget.ImageView import android.widget.ImageView
import android.widget.LinearLayout import android.widget.LinearLayout
import com.airbnb.lottie.LottieAnimationView import com.airbnb.lottie.LottieAnimationView
...@@ -17,6 +18,8 @@ import com.mints.helivideo.R ...@@ -17,6 +18,8 @@ import com.mints.helivideo.R
import com.mints.helivideo.ad.AdManager import com.mints.helivideo.ad.AdManager
import com.mints.helivideo.ad.AdStatusListener import com.mints.helivideo.ad.AdStatusListener
import com.mints.helivideo.ad.NoPreAdManager import com.mints.helivideo.ad.NoPreAdManager
import com.mints.helivideo.ad.express.ExpressAdCallback
import com.mints.helivideo.ad.express.ExpressManager
import com.mints.helivideo.common.Constant import com.mints.helivideo.common.Constant
import com.mints.helivideo.manager.LocalVedioManager import com.mints.helivideo.manager.LocalVedioManager
import com.mints.helivideo.manager.UserManager import com.mints.helivideo.manager.UserManager
...@@ -34,6 +37,7 @@ import com.mints.helivideo.ui.widgets.VideoEpisodeDialog ...@@ -34,6 +37,7 @@ import com.mints.helivideo.ui.widgets.VideoEpisodeDialog
import com.mints.helivideo.ui.widgets.VipCountDialog import com.mints.helivideo.ui.widgets.VipCountDialog
import com.mints.helivideo.utils.AppPreferencesManager import com.mints.helivideo.utils.AppPreferencesManager
import com.mints.helivideo.utils.SpanUtils import com.mints.helivideo.utils.SpanUtils
import com.mints.helivideo.utils.UIUtils
import com.mints.library.utils.nodoubleclick.AntiShake import com.mints.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.drama_activity_api_detail.* import kotlinx.android.synthetic.main.drama_activity_api_detail.*
...@@ -62,7 +66,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -62,7 +66,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
private var orderTagsList: ArrayList<String>? = null private var orderTagsList: ArrayList<String>? = null
private var isLuckyShow = false private var isLuckyShow = false
private var unlockCallback: IDPDramaListener.Callback? = null private var unlockCallback: IDPDramaListener.Callback? = null
private var mInitUnlockIndex = 0 private var mInitUnlockIndex = 0
...@@ -105,7 +108,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -105,7 +108,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
isThirdId = extras?.getBoolean(Constant.VEDIO_THIRD, false) == true isThirdId = extras?.getBoolean(Constant.VEDIO_THIRD, false) == true
isPlayNext = extras?.getBoolean(Constant.VEDIO_NEXT, false) == true isPlayNext = extras?.getBoolean(Constant.VEDIO_NEXT, false) == true
mVedioBean = Gson().fromJson(json, VedioBean::class.java) mVedioBean = Gson().fromJson(json, VedioBean::class.java)
orderTagsList = mVedioBean?.orderTags orderTagsList = mVedioBean?.orderTags
...@@ -125,6 +127,10 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -125,6 +127,10 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
videoPresenter.attachView(this) videoPresenter.attachView(this)
mVedioBean?.let { videoPresenter.getIndexList(it.thirdId, true) } mVedioBean?.let { videoPresenter.getIndexList(it.thirdId, true) }
if (!UserManager.getInstance().vipFlag) {
ExpressManager.instance.preLoadAd()
}
fm_bottom.setOnClickListener { fm_bottom.setOnClickListener {
if (AntiShake.check(it.id)) return@setOnClickListener if (AntiShake.check(it.id)) return@setOnClickListener
showEpisodeDialog() showEpisodeDialog()
...@@ -399,6 +405,9 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -399,6 +405,9 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
blockView?.visibility = View.VISIBLE blockView?.visibility = View.VISIBLE
unlockCallback = callback unlockCallback = callback
// 展示广告
showAdView()
dpWidget?.let { widget -> dpWidget?.let { widget ->
unlockBtn?.setOnClickListener { unlockBtn?.setOnClickListener {
val carrierType = Constant.CARRIERTYPE_CSJ_VEDIO val carrierType = Constant.CARRIERTYPE_CSJ_VEDIO
...@@ -761,6 +770,27 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic ...@@ -761,6 +770,27 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
} }
} }
} }
}
private fun showAdView() {
if (UserManager.getInstance().vipFlag) return
ExpressManager.instance.getAdView(object : ExpressAdCallback {
override fun loadSuccess(adView: FrameLayout?) {
adView?.let {
UIUtils.removeFromParent(it)
fl_ad.removeAllViews()
fl_ad.addView(it)
}
}
override fun renderSuccess(adView: FrameLayout?): Boolean {
return false
}
override fun loadFail() {
}
})
} }
} }
\ No newline at end of file
...@@ -10,14 +10,13 @@ import com.mints.helivideo.R ...@@ -10,14 +10,13 @@ import com.mints.helivideo.R
import com.mints.helivideo.ad.AdManager import com.mints.helivideo.ad.AdManager
import com.mints.helivideo.ad.AdStatusListener import com.mints.helivideo.ad.AdStatusListener
import com.mints.helivideo.ad.NoPreAdManager import com.mints.helivideo.ad.NoPreAdManager
import com.mints.helivideo.ad.draw.DrawExpressManager
import com.mints.helivideo.ad.express.ExpressManager
import com.mints.helivideo.common.Constant import com.mints.helivideo.common.Constant
import com.mints.helivideo.manager.LocalVedioManager import com.mints.helivideo.manager.LocalVedioManager
import com.mints.helivideo.manager.UserManager import com.mints.helivideo.manager.UserManager
import com.mints.helivideo.mvp.model.IndexList import com.mints.helivideo.mvp.model.*
import com.mints.helivideo.mvp.model.IndexList.VedioEpisodeBean import com.mints.helivideo.mvp.model.IndexList.VedioEpisodeBean
import com.mints.helivideo.mvp.model.NineShowBean
import com.mints.helivideo.mvp.model.VedioBean
import com.mints.helivideo.mvp.model.VideoMultiItemEntity
import com.mints.helivideo.mvp.presenters.VideoPresenter import com.mints.helivideo.mvp.presenters.VideoPresenter
import com.mints.helivideo.mvp.views.VideoView import com.mints.helivideo.mvp.views.VideoView
import com.mints.helivideo.ui.activitys.NineActivity import com.mints.helivideo.ui.activitys.NineActivity
...@@ -29,6 +28,7 @@ import com.mints.helivideo.ui.widgets.VideoEpisodeDialog ...@@ -29,6 +28,7 @@ import com.mints.helivideo.ui.widgets.VideoEpisodeDialog
import com.mints.helivideo.ui.widgets.VipCountDialog import com.mints.helivideo.ui.widgets.VipCountDialog
import com.mints.helivideo.utils.AppPreferencesManager import com.mints.helivideo.utils.AppPreferencesManager
import com.mints.helivideo.utils.SpanUtils import com.mints.helivideo.utils.SpanUtils
import com.mints.helivideo.video.tx.VideoModel
import com.mints.helivideo.video.tx.adapter.TxVideoAdapter import com.mints.helivideo.video.tx.adapter.TxVideoAdapter
import com.mints.library.utils.nodoubleclick.AntiShake import com.mints.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_tx_video.* import kotlinx.android.synthetic.main.activity_tx_video.*
...@@ -102,6 +102,11 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -102,6 +102,11 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
} }
private fun initView() { private fun initView() {
if (!UserManager.getInstance().vipFlag) {
ExpressManager.instance.preLoadAd()
DrawExpressManager.instance.preLoadAd()
}
episode_tv.text = String.format( episode_tv.text = String.format(
"共%d集 %s", "共%d集 %s",
mVedioBean?.vedioTotal, mVedioBean?.vedioTotal,
...@@ -110,12 +115,23 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -110,12 +115,23 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
super_short_video_view.setOnCustomChildClickListener(this) super_short_video_view.setOnCustomChildClickListener(this)
super_short_video_view.setOnPageChangeListener { super_short_video_view.setOnPageChangeListener {
showVipCountDialog(it) if (super_short_video_view.isAdPosition(it)) {
localShowLucky(it) fm_bottom.visibility = View.GONE
super_short_video_view.pause()
return@setOnPageChangeListener
}
fm_bottom.visibility = View.VISIBLE
val readPosition = getRealPosition(it)
showVipCountDialog(readPosition)
localShowLucky(readPosition)
// VIdeoindex -> seeIndex // VIdeoindex -> seeIndex
if (videos.size > it) { val data = super_short_video_view.data
mVedioBean!!.seeIndex = videos[it].vedioIndex if (data.size > it && data[it].itemType == MULTI_ITEM_1) {
mVedioBean!!.seeIndex = data[it].video!!.vedioIndex
mVedioBean!!.orderTags = orderTagsList mVedioBean!!.orderTags = orderTagsList
LocalVedioManager.commitVedio(mVedioBean!!) LocalVedioManager.commitVedio(mVedioBean!!)
} }
...@@ -153,7 +169,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -153,7 +169,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
dialog?.dismiss() dialog?.dismiss()
} }
}) })
dialog?.setCurrentIndex(getPosition()) dialog?.setCurrentIndex(super_short_video_view.realSeeIndex)
dialog?.setOnEpisodeClickListener(this) dialog?.setOnEpisodeClickListener(this)
dialog?.show() dialog?.show()
} }
...@@ -238,14 +254,23 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -238,14 +254,23 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
override fun onEpisodeClick(position: Int) { override fun onEpisodeClick(position: Int) {
dialog?.dismiss() dialog?.dismiss()
val data = super_short_video_view.data
if (position >= mVedioBean!!.unlockIndex) { if (position >= mVedioBean!!.unlockIndex) {
super_short_video_view.onItemClick(mVedioBean!!.unlockIndex) super_short_video_view.onItemClick(data.size - 1)
// super_short_video_view.onItemClick(mVedioBean!!.unlockIndex)
return return
} }
super_short_video_view.onItemClick(position)
val readPosition = getRealPosition(position)
if (readPosition != position) {
super_short_video_view.pause()
}
super_short_video_view.onItemClick(readPosition)
Handler(Looper.getMainLooper()).postDelayed({ Handler(Looper.getMainLooper()).postDelayed({
showVipCountDialog(position) showVipCountDialog(readPosition)
localShowLucky(position) localShowLucky(readPosition)
}, 300) }, 300)
} }
...@@ -253,11 +278,12 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -253,11 +278,12 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
val data = mutableListOf<VideoMultiItemEntity>() val data = mutableListOf<VideoMultiItemEntity>()
if (videos.size > 0) { if (videos.size > 0) {
for (video in videos) { for (video in videos) {
val item = VideoMultiItemEntity(VideoMultiItemEntity.MULTI_ITEM_1, video) val item = VideoMultiItemEntity(MULTI_ITEM_1, video, VideoModel(video.vedioUrl))
data.add(item) data.add(item)
} }
if (mVedioBean!!.unlockIndex < mVedioBean!!.vedioTotal) { if (mVedioBean!!.unlockIndex < mVedioBean!!.vedioTotal) {
val item = VideoMultiItemEntity(VideoMultiItemEntity.MULTI_ITEM_2, videos[0]) val item =
VideoMultiItemEntity(MULTI_ITEM_2, videos[0], VideoModel(videos[0].vedioUrl))
data.add(item) data.add(item)
} }
} }
...@@ -338,7 +364,6 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -338,7 +364,6 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
private fun showVipCountDialog(position: Int) { private fun showVipCountDialog(position: Int) {
if (isFinishing) return if (isFinishing) return
if (position == 0 || mVedioBean!!.tipMaxIndex == 0 || mVedioBean!!.tipMaxIndex - 1 < position) { if (position == 0 || mVedioBean!!.tipMaxIndex == 0 || mVedioBean!!.tipMaxIndex - 1 < position) {
return return
} }
...@@ -354,8 +379,13 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -354,8 +379,13 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
private fun localShowLucky(position: Int) { private fun localShowLucky(position: Int) {
val localLucky = AppPreferencesManager.get() val localLucky = AppPreferencesManager.get()
.getBoolean(Constant.LUCKY_FLAG, false) .getBoolean(Constant.LUCKY_FLAG, false)
val data = super_short_video_view.data
if (mVedioBean != null && (isLuckyShow || localLucky)) { if (mVedioBean != null && (isLuckyShow || localLucky)) {
if (position > mVedioBean!!.unlockIndex - 1) { // if (position > mVedioBean!!.unlockIndex - 1) {
if (data[position].itemType != MULTI_ITEM_1 || UserManager.getInstance().vipFlag
|| position > mVedioBean!!.unlockIndex - 1
) {
// 解锁界面 // 解锁界面
ll_lucky.visibility = View.GONE ll_lucky.visibility = View.GONE
} else { } else {
...@@ -369,5 +399,17 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView, ...@@ -369,5 +399,17 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
} }
} }
private fun getPosition() = super_short_video_view.currentPosition private fun getRealPosition(position: Int): Int {
var readPosition = position
val data = super_short_video_view.data
for (i in 0 until data.size) {
if (data[i].itemType == MULTI_ITEM_1) {
if (data[i].video!!.vedioIndex == position + 1) {
readPosition = i
break
}
}
}
return readPosition
}
} }
\ No newline at end of file
package com.mints.helivideo.video.tx; package com.mints.helivideo.video.tx;
import android.content.Context; import android.content.Context;
import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -14,7 +15,7 @@ public class PlayerManager { ...@@ -14,7 +15,7 @@ public class PlayerManager {
private Map<VideoModel, TXVodPlayerWrapper> mUrlPlayerMap; private Map<VideoModel, TXVodPlayerWrapper> mUrlPlayerMap;
private VideoModel mLastPlayedVideoBean; private VideoModel mLastPlayedVideoBean;
private Context mContext; private final Context mContext;
public PlayerManager(Context context) { public PlayerManager(Context context) {
mContext = context.getApplicationContext(); mContext = context.getApplicationContext();
...@@ -36,16 +37,16 @@ public class PlayerManager { ...@@ -36,16 +37,16 @@ public class PlayerManager {
List<VideoModel> exprList = findDiffBeanList(shortVideoBeanList, lastBeanList); List<VideoModel> exprList = findDiffBeanList(shortVideoBeanList, lastBeanList);
//找到 urlList中不包含lastUrlList的 //找到 urlList中不包含lastUrlList的
List<VideoModel> newList = findDiffBeanList(lastBeanList, shortVideoBeanList); List<VideoModel> newList = findDiffBeanList(lastBeanList, shortVideoBeanList);
if (exprList != null) { // if (exprList != null) {
for (int i = 0; i < exprList.size(); i++) { // for (int i = 0; i < exprList.size(); i++) {
Log.i(TAG, "[updateManager] exprUrl " + exprList.get(i).videoURL); // Log.i(TAG, "[updateManager] exprUrl " + exprList.get(i).videoURL);
} // }
} // }
if (newList != null) { // if (newList != null) {
for (int i = 0; i < newList.size(); i++) { // for (int i = 0; i < newList.size(); i++) {
Log.i(TAG, "[updateManager] newUrl " + newList.get(i).videoURL); // Log.i(TAG, "[updateManager] newUrl " + newList.get(i).videoURL);
} // }
} // }
if (newList.size() > 0) { if (newList.size() > 0) {
for (int i = 0; i < newList.size(); i++) { for (int i = 0; i < newList.size(); i++) {
TXVodPlayerWrapper tempPlayer = null; TXVodPlayerWrapper tempPlayer = null;
...@@ -56,8 +57,9 @@ public class PlayerManager { ...@@ -56,8 +57,9 @@ public class PlayerManager {
tempPlayer = new TXVodPlayerWrapper(mContext); tempPlayer = new TXVodPlayerWrapper(mContext);
} }
if (!TextUtils.isEmpty(newList.get(i).videoURL)) {
tempPlayer.preStartPlay(newList.get(i)); tempPlayer.preStartPlay(newList.get(i));
}
mUrlPlayerMap.put(newList.get(i), tempPlayer); mUrlPlayerMap.put(newList.get(i), tempPlayer);
} }
} }
......
package com.mints.helivideo.video.tx; package com.mints.helivideo.video.tx;
import static com.mints.helivideo.mvp.model.VideoMultiItemEntityKt.MULTI_ITEM_1;
import static com.mints.helivideo.mvp.model.VideoMultiItemEntityKt.MULTI_ITEM_3;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
...@@ -13,6 +15,8 @@ import androidx.recyclerview.widget.PagerSnapHelper; ...@@ -13,6 +15,8 @@ import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.mints.helivideo.R; import com.mints.helivideo.R;
import com.mints.helivideo.ad.draw.DrawExpressManager;
import com.mints.helivideo.manager.UserManager;
import com.mints.helivideo.mvp.model.VedioBean; import com.mints.helivideo.mvp.model.VedioBean;
import com.mints.helivideo.mvp.model.VideoMultiItemEntity; import com.mints.helivideo.mvp.model.VideoMultiItemEntity;
import com.mints.helivideo.video.tx.adapter.TxVideoAdapter; import com.mints.helivideo.video.tx.adapter.TxVideoAdapter;
...@@ -27,12 +31,10 @@ public class SuperShortVideoView extends RelativeLayout { ...@@ -27,12 +31,10 @@ public class SuperShortVideoView extends RelativeLayout {
private RecyclerView mRecyclerView; private RecyclerView mRecyclerView;
private TxVideoAdapter mAdapter; private TxVideoAdapter mAdapter;
private List<VideoModel> mUrlList;
private LinearLayoutManager mLayoutManager; private LinearLayoutManager mLayoutManager;
private PagerSnapHelper mSnapHelper; private PagerSnapHelper mSnapHelper;
private int mLastPositionInIDLE = -1; private int mLastPositionInIDLE = -1;
private TXVideoBaseView mBaseItemView; private TXVideoBaseView mBaseItemView;
private Context mContext;
private boolean mIsOnDestroy; private boolean mIsOnDestroy;
private PlayerManager mPlayerManager; private PlayerManager mPlayerManager;
...@@ -50,20 +52,12 @@ public class SuperShortVideoView extends RelativeLayout { ...@@ -50,20 +52,12 @@ public class SuperShortVideoView extends RelativeLayout {
public SuperShortVideoView(Context context, AttributeSet attrs, int defStyleAttr) { public SuperShortVideoView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
mContext = context; init(context);
init(mContext);
} }
public void loadMoreData(List<VideoMultiItemEntity> list) { public void loadMoreData(List<VideoMultiItemEntity> list) {
this.mList.clear();
this.mList = list; this.mList = list;
this.mUrlList.clear();
List<VideoModel> videoList = new ArrayList();
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getItemType() == VideoMultiItemEntity.MULTI_ITEM_1) {
videoList.add(new VideoModel(list.get(i).getVideo().getVedioUrl()));
}
}
mUrlList.addAll(videoList);
mAdapter.setNewInstance(mList); mAdapter.setNewInstance(mList);
onItemClick(mCurrentPosition); onItemClick(mCurrentPosition);
...@@ -72,14 +66,6 @@ public class SuperShortVideoView extends RelativeLayout { ...@@ -72,14 +66,6 @@ public class SuperShortVideoView extends RelativeLayout {
public void loadData(VedioBean vedioBean, List<VideoMultiItemEntity> list, int currentPosition) { public void loadData(VedioBean vedioBean, List<VideoMultiItemEntity> list, int currentPosition) {
this.mList = list; this.mList = list;
this.mCurrentPosition = currentPosition; this.mCurrentPosition = currentPosition;
List<VideoModel> videoList = new ArrayList();
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getItemType() == VideoMultiItemEntity.MULTI_ITEM_1) {
videoList.add(new VideoModel(list.get(i).getVideo().getVedioUrl()));
}
}
mUrlList.clear();
mUrlList.addAll(videoList);
mAdapter.setVedioBean(vedioBean); mAdapter.setVedioBean(vedioBean);
mAdapter.setNewInstance(mList); mAdapter.setNewInstance(mList);
...@@ -91,7 +77,6 @@ public class SuperShortVideoView extends RelativeLayout { ...@@ -91,7 +77,6 @@ public class SuperShortVideoView extends RelativeLayout {
addView(mRootView); addView(mRootView);
mPlayerManager = new PlayerManager(getContext()); mPlayerManager = new PlayerManager(getContext());
mRecyclerView = mRootView.findViewById(R.id.rv_super_short_video); mRecyclerView = mRootView.findViewById(R.id.rv_super_short_video);
mUrlList = new ArrayList<>();
mSnapHelper = new PagerSnapHelper(); mSnapHelper = new PagerSnapHelper();
mSnapHelper.attachToRecyclerView(mRecyclerView); mSnapHelper.attachToRecyclerView(mRecyclerView);
mAdapter = new TxVideoAdapter(); mAdapter = new TxVideoAdapter();
...@@ -109,7 +94,6 @@ public class SuperShortVideoView extends RelativeLayout { ...@@ -109,7 +94,6 @@ public class SuperShortVideoView extends RelativeLayout {
mRecyclerView.setDrawingCacheEnabled(true); mRecyclerView.setDrawingCacheEnabled(true);
mRecyclerView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_LOW); mRecyclerView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_LOW);
mRecyclerView.setAdapter(mAdapter); mRecyclerView.setAdapter(mAdapter);
// mLayoutManager.scrollToPosition(0);
addListener(); addListener();
} }
...@@ -131,6 +115,8 @@ public class SuperShortVideoView extends RelativeLayout { ...@@ -131,6 +115,8 @@ public class SuperShortVideoView extends RelativeLayout {
if (position == mCurrentPosition) return; if (position == mCurrentPosition) return;
Log.i(TAG, "[SCROLL_STATE_IDLE] mLastPositionInIDLE " + mLastPositionInIDLE + " position " + position); Log.i(TAG, "[SCROLL_STATE_IDLE] mLastPositionInIDLE " + mLastPositionInIDLE + " position " + position);
mCurrentPosition = position; mCurrentPosition = position;
addAdView(position);
onPageSelectedMethod(position); onPageSelectedMethod(position);
break; break;
case RecyclerView.SCROLL_STATE_DRAGGING://拖动 case RecyclerView.SCROLL_STATE_DRAGGING://拖动
...@@ -145,7 +131,10 @@ public class SuperShortVideoView extends RelativeLayout { ...@@ -145,7 +131,10 @@ public class SuperShortVideoView extends RelativeLayout {
private void onPageSelectedMethod(int position) { private void onPageSelectedMethod(int position) {
if (mOnPageChangeListener != null) mOnPageChangeListener.onPageChange(position); if (mOnPageChangeListener != null) mOnPageChangeListener.onPageChange(position);
if (position == mUrlList.size()) { if (position >= mList.size() || this.mList.get(position).getItemType() != MULTI_ITEM_1)
return;
if (position == mList.size()) {
if (mBaseItemView != null) { if (mBaseItemView != null) {
mLastPositionInIDLE = -1; mLastPositionInIDLE = -1;
mBaseItemView.stopForPlaying(); mBaseItemView.stopForPlaying();
...@@ -162,9 +151,9 @@ public class SuperShortVideoView extends RelativeLayout { ...@@ -162,9 +151,9 @@ public class SuperShortVideoView extends RelativeLayout {
Log.i(TAG, "onPageSelected " + position); Log.i(TAG, "onPageSelected " + position);
List<VideoModel> tempUrlList = initUrlList(position, MAX_PLAYER_COUNT_ON_PASS); List<VideoModel> tempUrlList = initUrlList(position, MAX_PLAYER_COUNT_ON_PASS);
mPlayerManager.updateManager(tempUrlList); mPlayerManager.updateManager(tempUrlList);
TXVodPlayerWrapper txVodPlayerWrapper = mPlayerManager.getPlayer(mUrlList.get(position)); TXVodPlayerWrapper txVodPlayerWrapper = mPlayerManager.getPlayer(mList.get(position).getVideoModel());
if (txVodPlayerWrapper != null) { if (txVodPlayerWrapper != null) {
Log.i(TAG, "txVodPlayerWrapper " + txVodPlayerWrapper + "url-- " + mUrlList.get(position).videoURL); Log.i(TAG, "txVodPlayerWrapper " + txVodPlayerWrapper + "url-- " + mList.get(position).getVideoModel().videoURL);
Log.i(TAG, "txVodPlayerWrapper " + txVodPlayerWrapper); Log.i(TAG, "txVodPlayerWrapper " + txVodPlayerWrapper);
mBaseItemView.setTXVodPlayer(txVodPlayerWrapper); mBaseItemView.setTXVodPlayer(txVodPlayerWrapper);
} }
...@@ -183,17 +172,21 @@ public class SuperShortVideoView extends RelativeLayout { ...@@ -183,17 +172,21 @@ public class SuperShortVideoView extends RelativeLayout {
* @return * @return
*/ */
private List<VideoModel> initUrlList(int startIndex, int maxCount) { private List<VideoModel> initUrlList(int startIndex, int maxCount) {
List<VideoModel> videoModels = new ArrayList<>();
for (VideoMultiItemEntity videoMultiItemEntity : this.mList) {
videoModels.add(videoMultiItemEntity.getVideoModel());
}
int i = startIndex - 1; int i = startIndex - 1;
if (i + maxCount > mUrlList.size()) { if (i + maxCount > videoModels.size()) {
i = mUrlList.size() - maxCount; i = videoModels.size() - maxCount;
} }
if (i < 0) { if (i < 0) {
i = 0; i = 0;
} }
int addedCount = 0; int addedCount = 0;
List<VideoModel> cacheList = new ArrayList<>(); List<VideoModel> cacheList = new ArrayList<>();
while (i < mUrlList.size() && addedCount < maxCount) { while (i < videoModels.size() && addedCount < maxCount) {
cacheList.add(mUrlList.get(i)); cacheList.add(videoModels.get(i));
addedCount++; addedCount++;
i++; i++;
} }
...@@ -219,12 +212,6 @@ public class SuperShortVideoView extends RelativeLayout { ...@@ -219,12 +212,6 @@ public class SuperShortVideoView extends RelativeLayout {
mPlayerManager.releasePlayer(); mPlayerManager.releasePlayer();
} }
public void onListPageScrolled() {
if (mBaseItemView != null) {
mBaseItemView.pausePlayer();
}
}
public void onItemClick(final int position) { public void onItemClick(final int position) {
mRecyclerView.scrollToPosition(position); mRecyclerView.scrollToPosition(position);
mRecyclerView.post(() -> { mRecyclerView.post(() -> {
...@@ -234,6 +221,20 @@ public class SuperShortVideoView extends RelativeLayout { ...@@ -234,6 +221,20 @@ public class SuperShortVideoView extends RelativeLayout {
}); });
} }
public List<VideoMultiItemEntity> getData() {
return mList;
}
public int getRealSeeIndex() {
if (mList != null && mList.size() > 0) {
VideoMultiItemEntity videoMultiItemEntity = mList.get(mCurrentPosition);
if (videoMultiItemEntity.getItemType() == MULTI_ITEM_1) {
return videoMultiItemEntity.getVideo().getVedioIndex() - 1;
}
}
return mCurrentPosition;
}
public int getCurrentPosition() { public int getCurrentPosition() {
return mCurrentPosition; return mCurrentPosition;
} }
...@@ -255,4 +256,27 @@ public class SuperShortVideoView extends RelativeLayout { ...@@ -255,4 +256,27 @@ public class SuperShortVideoView extends RelativeLayout {
public void setOnPageChangeListener(OnPageChangeListener onPageChangeListener) { public void setOnPageChangeListener(OnPageChangeListener onPageChangeListener) {
this.mOnPageChangeListener = onPageChangeListener; this.mOnPageChangeListener = onPageChangeListener;
} }
public boolean isAdPosition(int position) {
if (mList != null && mList.size() > 0) {
return mList.get(position).getItemType() == MULTI_ITEM_3;
}
return false;
}
private int lastAddAdPosition = 0;
private void addAdView(int position) {
// VIP 不展示
if (UserManager.getInstance().getVipFlag()) return;
// 每隔3个视频出现一个广告
if (position + 1 < 2 || (position + 1) % 3 != 0 || lastAddAdPosition > position) return;
if (DrawExpressManager.Companion.getInstance().getAdIsLoadSuc()) {
VideoMultiItemEntity itemAD = new VideoMultiItemEntity(MULTI_ITEM_3, null, new VideoModel(""));
mList.add(position + 1, itemAD);
mAdapter.notifyItemInserted(position + 1);
lastAddAdPosition = position + 1;
}
}
} }
...@@ -3,7 +3,6 @@ package com.mints.helivideo.video.tx; ...@@ -3,7 +3,6 @@ package com.mints.helivideo.video.tx;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.Spanned; import android.text.Spanned;
...@@ -32,7 +31,7 @@ import java.util.Locale; ...@@ -32,7 +31,7 @@ import java.util.Locale;
public class TXVideoBaseView extends RelativeLayout implements View.OnClickListener, public class TXVideoBaseView extends RelativeLayout implements View.OnClickListener,
SeekBar.OnSeekBarChangeListener, TXVodPlayerWrapper.OnPlayEventChangedListener { SeekBar.OnSeekBarChangeListener, TXVodPlayerWrapper.OnPlayEventChangedListener {
private static final String TAG = "TXVideoBaseView"; private static final String TAG = "TXVideoBaseView";
private View mRootView;
private SeekBar mSeekBar; private SeekBar mSeekBar;
private TXCloudVideoView mTXCloudVideoView; private TXCloudVideoView mTXCloudVideoView;
private ImageView mIvCover; private ImageView mIvCover;
...@@ -58,17 +57,17 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe ...@@ -58,17 +57,17 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
init(context); init(context);
} }
public void setTXVodPlayer(TXVodPlayerWrapper TXVodPlayerWrapper) { public void setTXVodPlayer(TXVodPlayerWrapper tXVodPlayerWrapper) {
mTXVodPlayerWrapper = TXVodPlayerWrapper; mTXVodPlayerWrapper = tXVodPlayerWrapper;
mTXVodPlayerWrapper.setPlayerView(mTXCloudVideoView); mTXVodPlayerWrapper.setPlayerView(mTXCloudVideoView);
mTXVodPlayerWrapper.setVodChangeListener(this); mTXVodPlayerWrapper.setVodChangeListener(this);
mTXCloudVideoView.requestLayout(); mTXCloudVideoView.requestLayout();
Log.i(TAG, "[setTXVodPlayer] , PLAY_EVT_PLAY_PROGRESS," + mTXVodPlayerWrapper.getVodPlayer().hashCode() + " url " + TXVodPlayerWrapper.getUrl()); Log.i(TAG, "[setTXVodPlayer] , PLAY_EVT_PLAY_PROGRESS," + mTXVodPlayerWrapper.getVodPlayer().hashCode() + " url " + tXVodPlayerWrapper.getUrl());
} }
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
private void init(Context context) { private void init(Context context) {
mRootView = LayoutInflater.from(context).inflate(R.layout.player_item_base_view, null); View mRootView = LayoutInflater.from(context).inflate(R.layout.player_item_base_view, null);
addView(mRootView); addView(mRootView);
mSeekBar = mRootView.findViewById(R.id.seekbar_short_video); mSeekBar = mRootView.findViewById(R.id.seekbar_short_video);
mSeekBar.setOnSeekBarChangeListener(this); mSeekBar.setOnSeekBarChangeListener(this);
...@@ -217,9 +216,11 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe ...@@ -217,9 +216,11 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
} }
} }
public void startPlay() { public void startPlay() {
if (mTXVodPlayerWrapper != null) { if (mTXVodPlayerWrapper != null) {
if (mIvCover.getVisibility() == View.VISIBLE) {
mIvCover.setVisibility(View.GONE);
}
mPauseImageView.setVisibility(View.GONE); mPauseImageView.setVisibility(View.GONE);
mTXVodPlayerWrapper.setVodChangeListener(this); mTXVodPlayerWrapper.setVodChangeListener(this);
mTXVodPlayerWrapper.resumePlay(); mTXVodPlayerWrapper.resumePlay();
...@@ -227,6 +228,13 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe ...@@ -227,6 +228,13 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
} }
} }
public TXVodPlayerWrapper getPlayer() {
if (mTXVodPlayerWrapper != null) {
return mTXVodPlayerWrapper;
}
return null;
}
public void stopPlayer() { public void stopPlayer() {
if (mTXVodPlayerWrapper != null) { if (mTXVodPlayerWrapper != null) {
mTXVodPlayerWrapper.stopPlay(); mTXVodPlayerWrapper.stopPlay();
......
...@@ -102,7 +102,6 @@ public class TXVodPlayerWrapper implements ITXVodPlayListener { ...@@ -102,7 +102,6 @@ public class TXVodPlayerWrapper implements ITXVodPlayListener {
playerStatusChanged(TxVodStatus.TX_VIDEO_PLAYER_STATUS_PAUSED); playerStatusChanged(TxVodStatus.TX_VIDEO_PLAYER_STATUS_PAUSED);
} }
public void resumePlay() { public void resumePlay() {
Log.i(TAG, "[resumePlay] , startOnPrepare, " + mStartOnPrepare Log.i(TAG, "[resumePlay] , startOnPrepare, " + mStartOnPrepare
+ " mVodPlayer " + mVodPlayer.hashCode() + " url " + mUrl); + " mVodPlayer " + mVodPlayer.hashCode() + " url " + mUrl);
...@@ -185,6 +184,7 @@ public class TXVodPlayerWrapper implements ITXVodPlayListener { ...@@ -185,6 +184,7 @@ public class TXVodPlayerWrapper implements ITXVodPlayListener {
void onRcvFirstFrame(); void onRcvFirstFrame();
void onEnded(); void onEnded();
void onResume(); void onResume();
} }
......
...@@ -4,18 +4,16 @@ import android.os.Bundle ...@@ -4,18 +4,16 @@ import android.os.Bundle
import android.view.View import android.view.View
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.mints.helivideo.R import com.mints.helivideo.R
import com.mints.helivideo.ad.draw.DrawExpressManager
import com.mints.helivideo.common.AppConfig import com.mints.helivideo.common.AppConfig
import com.mints.helivideo.common.Constant import com.mints.helivideo.common.Constant
import com.mints.helivideo.manager.LocalVedioManager import com.mints.helivideo.manager.LocalVedioManager
import com.mints.helivideo.manager.UserManager
import com.mints.helivideo.mvp.model.BannerList import com.mints.helivideo.mvp.model.BannerList
import com.mints.helivideo.mvp.model.NineShowBean
import com.mints.helivideo.mvp.model.VedioBean
import com.mints.helivideo.mvp.presenters.RecommendPresenter import com.mints.helivideo.mvp.presenters.RecommendPresenter
import com.mints.helivideo.mvp.views.RecommendView import com.mints.helivideo.mvp.views.RecommendView
import com.mints.helivideo.ui.activitys.NineActivity
import com.mints.helivideo.ui.fragment.base.BaseFragment import com.mints.helivideo.ui.fragment.base.BaseFragment
import com.mints.helivideo.utils.AppPreferencesManager import com.mints.helivideo.video.tx.adapter.TxRecommendVideo2Adapter
import com.mints.helivideo.video.tx.adapter.TxRecommendVideoAdapter
import kotlinx.android.synthetic.main.fragment_tx_video.* import kotlinx.android.synthetic.main.fragment_tx_video.*
/** /**
...@@ -27,7 +25,6 @@ class TxVideoFragment : BaseFragment(), RecommendView { ...@@ -27,7 +25,6 @@ class TxVideoFragment : BaseFragment(), RecommendView {
private val recommendPresenter by lazy { RecommendPresenter() } private val recommendPresenter by lazy { RecommendPresenter() }
var videos = arrayListOf<VedioBean>()
private var recommendPage = 1 // 分页 private var recommendPage = 1 // 分页
companion object { companion object {
...@@ -42,6 +39,10 @@ class TxVideoFragment : BaseFragment(), RecommendView { ...@@ -42,6 +39,10 @@ class TxVideoFragment : BaseFragment(), RecommendView {
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
recommendPresenter.attachView(this) recommendPresenter.attachView(this)
if (!UserManager.getInstance().vipFlag) {
DrawExpressManager.instance.preLoadAd()
}
recommendPresenter.autoList() recommendPresenter.autoList()
recommend_view.setOnLoadMoreListener { recommend_view.setOnLoadMoreListener {
...@@ -51,28 +52,28 @@ class TxVideoFragment : BaseFragment(), RecommendView { ...@@ -51,28 +52,28 @@ class TxVideoFragment : BaseFragment(), RecommendView {
recommend_view.setOnVideoEndListener { recommend_view.setOnVideoEndListener {
LocalVedioManager.startVedioDetailActivityForType( LocalVedioManager.startVedioDetailActivityForType(
requireActivity(), requireActivity(),
videos[recommend_view.currentPosition], recommend_view.data[recommend_view.currentPosition].video,
true true
) )
} }
recommend_view.setOnCustomChildClickListener(object : recommend_view.setOnCustomChildClickListener(object :
TxRecommendVideoAdapter.OnCustomChildClickListener { TxRecommendVideo2Adapter.OnCustomChildClickListener {
override fun onCustomChildClick(view: View, position: Int) { override fun onCustomChildClick(view: View, position: Int) {
when (view.id) { when (view.id) {
R.id.ll_bottom -> { R.id.ll_bottom -> {
LocalVedioManager.startVedioDetailActivityForType( LocalVedioManager.startVedioDetailActivityForType(
requireActivity(), requireActivity(),
videos[position], recommend_view.data[position].video,
true true
) )
} }
R.id.ll_collect -> { R.id.ll_collect -> {
if (videos[position].collect == 0) { if (recommend_view.data[position].video?.collect == 0) {
videos[position].collect = 1 recommend_view.data[position].video?.collect = 1
recommendPresenter.collect("" + videos[position].vedioId) recommendPresenter.collect("" + recommend_view.data[position].video?.vedioId)
} else { } else {
videos[position].collect = 0 recommend_view.data[position].video?.collect = 0
recommendPresenter.cancelCollect("" + videos[position].vedioId) recommendPresenter.cancelCollect("" + recommend_view.data[position].video?.vedioId)
} }
} }
else -> {} else -> {}
...@@ -108,6 +109,8 @@ class TxVideoFragment : BaseFragment(), RecommendView { ...@@ -108,6 +109,8 @@ class TxVideoFragment : BaseFragment(), RecommendView {
recommend_view.onDestroy() recommend_view.onDestroy()
super.onDestroyView() super.onDestroyView()
recommend_view.releasePlayer() recommend_view.releasePlayer()
DrawExpressManager.instance.destroy()
} }
override fun onDetach() { override fun onDetach() {
...@@ -133,11 +136,8 @@ class TxVideoFragment : BaseFragment(), RecommendView { ...@@ -133,11 +136,8 @@ class TxVideoFragment : BaseFragment(), RecommendView {
override fun autoListSuc(list: BannerList) { override fun autoListSuc(list: BannerList) {
if (recommendPage == 1) { if (recommendPage == 1) {
videos.clear()
videos.addAll(list.list)
recommend_view.loadData(list.list) recommend_view.loadData(list.list)
} else { } else {
videos.addAll(list.list)
recommend_view.loadMoreData(list.list) recommend_view.loadMoreData(list.list)
recommend_view.hideLoadMore() recommend_view.hideLoadMore()
} }
......
package com.mints.helivideo.video.tx.adapter;
import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.tencent.rtmp.ui.TXCloudVideoView;
import com.mints.helivideo.R;
import com.mints.helivideo.video.tx.TXVideoBaseView;
import com.mints.helivideo.video.tx.VideoModel;
import java.util.List;
public class ShortVideoPlayAdapter extends AbsPlayerRecyclerViewAdapter<VideoModel,
ShortVideoPlayAdapter.VideoViewHolder> {
private static final String TAG = "ShortVideoDemo:ShortVideoPlayAdapter";
private Context mContext;
public ShortVideoPlayAdapter(Context context, List<VideoModel> list) {
super(list);
mContext = context;
}
@Override
public void onHolder(VideoViewHolder holder, VideoModel bean, int position) {
if (bean != null && bean.placeholderImage != null) {
Glide.with(mContext).load(bean.placeholderImage)
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.ALL).centerCrop()
.into(holder.mImageViewCover);
}
}
@Override
public void onViewRecycled(@NonNull VideoViewHolder holder) {
super.onViewRecycled(holder);
Glide.with(mContext).clear(holder.mImageViewCover);
}
@Override
public VideoViewHolder onCreateHolder(ViewGroup viewGroup) {
return new VideoViewHolder(getViewByRes(R.layout.player_item_short_video_play, viewGroup));
}
@Override
public void onViewDetachedFromWindow(@NonNull VideoViewHolder holder) {
super.onViewDetachedFromWindow(holder);
Log.i(TAG, "onViewDetachedFromWindow");
TXVideoBaseView videoView = (TXVideoBaseView) holder.mRootView.findViewById(R.id.baseItemView);
videoView.stopForPlaying();
}
public class VideoViewHolder extends AbsViewHolder {
public View mRootView;
public TextView mEpisodeTv;
public ImageView mImageViewCover;
public TXCloudVideoView mVideoView;
public VideoViewHolder(View rootView) {
super(rootView);
this.mRootView = rootView;
this.mImageViewCover = rootView.findViewById(R.id.iv_cover);
this.mVideoView = rootView.findViewById(R.id.tcv_video_view);
}
}
}
package com.mints.helivideo.video.tx.adapter
import android.view.View
import android.widget.FrameLayout
import com.airbnb.lottie.LottieAnimationView
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.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.express.ExpressAdCallback
import com.mints.helivideo.mvp.model.*
import com.mints.helivideo.utils.UIUtils
import com.mints.helivideo.video.tx.TXVideoBaseView
class TxRecommendVideo2Adapter :
BaseMultiItemQuickAdapter<VideoMultiItemEntity2, BaseViewHolder>() {
private var mCurrentPosition = 0
init {
addItemType(MULTI_ITEM_1, R.layout.item_tx_video)
addItemType(MULTI_ITEM_3, R.layout.item_draw_ad)
}
override fun convert(holder: BaseViewHolder, item: VideoMultiItemEntity2) {
if (holder.itemViewType == MULTI_ITEM_1) {
initVideoHolder(holder, item.video)
} else {
initAdHolder(holder)
}
}
private fun initVideoHolder(holder: BaseViewHolder, item: VedioBean?) {
if (item?.completeStatus == 0) {
holder.setText(R.id.episode_tv, "共" + item.vedioTotal + "集 已完结")
} else {
holder.setText(R.id.episode_tv, "共" + item?.vedioTotal + "集 更新中")
}
//用户名
holder.setText(R.id.username_tv, item?.title)
//标题
holder.setText(R.id.usertitle_tv, "第" + item?.recommendIndex + "集")
//缩略图
Glide.with(context).load(item?.coverImage)
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.ALL).centerCrop()
.into(holder.getView<TXVideoBaseView>(R.id.baseItemView).findViewById(R.id.iv_cover))
if (item?.collect == 0) {
// 未收藏
setCollectImage(holder.getView(R.id.iv_collect))
} else {
// 已收藏
setCancelCollectImage(holder.getView(R.id.iv_collect))
}
// 热度
holder.setText(R.id.tv_collect_num, item?.hot)
holder.getView<View>(R.id.ll_collect).setOnClickListener {
if (item?.collect == 0) {
playCollectAnim(holder.getView(R.id.iv_collect))
} else {
playCancelCollectAnim(holder.getView(R.id.iv_collect))
}
mOnCustomChildClickListener?.onCustomChildClick(it, holder.adapterPosition)
}
holder.getView<View>(R.id.ll_bottom).setOnClickListener {
mOnCustomChildClickListener?.onCustomChildClick(it, holder.adapterPosition)
}
holder.getView<TXVideoBaseView>(R.id.baseItemView)
.setOnVideoEndListener(mOnVideoEndListener)
}
private fun initAdHolder(holder: BaseViewHolder) {
DrawExpressManager.instance.getAdView(object : ExpressAdCallback {
override fun loadSuccess(adView: FrameLayout?) {
adView?.let {
UIUtils.removeFromParent(it)
val fmAd = holder.getView<FrameLayout>(R.id.fl_ad)
fmAd.removeAllViews()
fmAd.addView(it)
}
DrawExpressManager.instance.preLoadAd()
}
override fun renderSuccess(adView: FrameLayout?): Boolean {
return false
}
override fun loadFail() {
}
})
}
override fun onViewDetachedFromWindow(holder: BaseViewHolder) {
super.onViewDetachedFromWindow(holder)
if (holder.itemViewType == MULTI_ITEM_1) {
val tXVideoBaseView = holder.getView<TXVideoBaseView>(R.id.baseItemView)
if (data[mCurrentPosition].itemType == MULTI_ITEM_1) {
if (tXVideoBaseView.player.url != data[mCurrentPosition].video!!.recommendUrl) {
tXVideoBaseView.stopForPlaying()
}
} else {
tXVideoBaseView.stopForPlaying()
}
}
}
override fun onViewRecycled(holder: BaseViewHolder) {
super.onViewRecycled(holder)
if (holder.itemViewType == MULTI_ITEM_1) {
Glide.with(context).clear(holder.getView<View>(R.id.iv_cover))
}
}
private fun setCollectImage(view: LottieAnimationView) {
val lottieDrawable = LottieDrawable()
LottieCompositionFactory.fromAsset(context, "home_collect.json")
.addListener { result: LottieComposition? ->
lottieDrawable.setImagesAssetsFolder("images/")
lottieDrawable.composition = result
}
view.setImageDrawable(lottieDrawable)
}
private fun setCancelCollectImage(view: LottieAnimationView) {
val lottieDrawable = LottieDrawable()
LottieCompositionFactory.fromAsset(context, "home_cancel_collect.json")
.addListener { result: LottieComposition? ->
lottieDrawable.setImagesAssetsFolder("images/")
lottieDrawable.composition = result
}
view.setImageDrawable(lottieDrawable)
}
private fun playCollectAnim(view: LottieAnimationView) {
view.setImageDrawable(null)
val lottieDrawable = LottieDrawable()
LottieCompositionFactory.fromAsset(context, "home_collect.json")
.addListener { result: LottieComposition? ->
lottieDrawable.setImagesAssetsFolder("images/")
lottieDrawable.composition = result
lottieDrawable.loop(false)
lottieDrawable.playAnimation()
}
view.setImageDrawable(lottieDrawable)
}
private fun playCancelCollectAnim(view: LottieAnimationView) {
view.setImageDrawable(null)
val lottieDrawable = LottieDrawable()
LottieCompositionFactory.fromAsset(context, "home_cancel_collect.json")
.addListener { result: LottieComposition? ->
lottieDrawable.setImagesAssetsFolder("images/")
lottieDrawable.composition = result
lottieDrawable.loop(false)
lottieDrawable.playAnimation()
}
view.setImageDrawable(lottieDrawable)
}
fun setCurrentPosition(currentPosition: Int) {
this.mCurrentPosition = currentPosition
}
private var mOnVideoEndListener: TXVideoBaseView.OnVideoEndListener? = null
fun setOnVideoEndListener(onVideoEndListener: TXVideoBaseView.OnVideoEndListener) {
this.mOnVideoEndListener = onVideoEndListener
}
private var mOnCustomChildClickListener: OnCustomChildClickListener? = null
fun setOnCustomChildClickListener(onCustomChildClickListener: OnCustomChildClickListener) {
this.mOnCustomChildClickListener = onCustomChildClickListener
}
interface OnCustomChildClickListener {
fun onCustomChildClick(view: View, position: Int)
}
}
\ No newline at end of file
...@@ -10,10 +10,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy ...@@ -10,10 +10,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.chad.library.adapter.base.BaseQuickAdapter import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.mints.helivideo.R import com.mints.helivideo.R
import com.mints.helivideo.common.Constant
import com.mints.helivideo.manager.UserManager
import com.mints.helivideo.mvp.model.VedioBean import com.mints.helivideo.mvp.model.VedioBean
import com.mints.helivideo.utils.AppPreferencesManager
import com.mints.helivideo.video.tx.TXVideoBaseView import com.mints.helivideo.video.tx.TXVideoBaseView
class TxRecommendVideoAdapter : class TxRecommendVideoAdapter :
......
package com.mints.helivideo.video.tx.adapter package com.mints.helivideo.video.tx.adapter
import android.view.View import android.view.View
import android.widget.FrameLayout
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import android.widget.Toast
import com.airbnb.lottie.LottieAnimationView import com.airbnb.lottie.LottieAnimationView
import com.airbnb.lottie.LottieComposition import com.airbnb.lottie.LottieComposition
import com.airbnb.lottie.LottieCompositionFactory import com.airbnb.lottie.LottieCompositionFactory
...@@ -13,11 +13,13 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy ...@@ -13,11 +13,13 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.mints.helivideo.R import com.mints.helivideo.R
import com.mints.helivideo.common.Constant import com.mints.helivideo.ad.draw.DrawExpressManager
import com.mints.helivideo.ad.express.ExpressAdCallback
import com.mints.helivideo.ad.express.ExpressManager
import com.mints.helivideo.manager.UserManager import com.mints.helivideo.manager.UserManager
import com.mints.helivideo.mvp.model.VedioBean import com.mints.helivideo.mvp.model.*
import com.mints.helivideo.mvp.model.VideoMultiItemEntity import com.mints.helivideo.utils.LogUtil
import com.mints.helivideo.utils.AppPreferencesManager import com.mints.helivideo.utils.UIUtils
import com.mints.helivideo.video.tx.TXVideoBaseView import com.mints.helivideo.video.tx.TXVideoBaseView
class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewHolder>() { class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewHolder>() {
...@@ -25,16 +27,45 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH ...@@ -25,16 +27,45 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
private var vedioBean: VedioBean? = null private var vedioBean: VedioBean? = null
init { init {
addItemType(VideoMultiItemEntity.MULTI_ITEM_1, R.layout.player_item_short_video_play) addItemType(MULTI_ITEM_1, R.layout.player_item_short_video_play)
addItemType(VideoMultiItemEntity.MULTI_ITEM_2, R.layout.item_block_view) addItemType(MULTI_ITEM_2, R.layout.item_block_view)
addItemType(MULTI_ITEM_3, R.layout.item_draw_ad)
} }
override fun convert(holder: BaseViewHolder, item: VideoMultiItemEntity) { override fun convert(holder: BaseViewHolder, item: VideoMultiItemEntity) {
if (holder.itemViewType == VideoMultiItemEntity.MULTI_ITEM_1) { when (holder.itemViewType) {
initVideoHolder(holder, item) MULTI_ITEM_1 -> {
} else { initVideoHolder(holder, item.video)
}
MULTI_ITEM_2 -> {
initLockHolder(holder) initLockHolder(holder)
} }
else -> {
initAdHolder(holder)
}
}
}
private fun initAdHolder(holder: BaseViewHolder) {
DrawExpressManager.instance.getAdView(object : ExpressAdCallback {
override fun loadSuccess(adView: FrameLayout?) {
adView?.let {
UIUtils.removeFromParent(it)
val fmAd = holder.getView<FrameLayout>(R.id.fl_ad)
fmAd.removeAllViews()
fmAd.addView(it)
}
DrawExpressManager.instance.preLoadAd()
}
override fun renderSuccess(adView: FrameLayout?): Boolean {
return false
}
override fun loadFail() {
}
})
} }
private fun initLockHolder(holder: BaseViewHolder) { private fun initLockHolder(holder: BaseViewHolder) {
...@@ -56,13 +87,33 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH ...@@ -56,13 +87,33 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
holder.getView<View>(R.id.unlock).setOnClickListener { holder.getView<View>(R.id.unlock).setOnClickListener {
mOnCustomChildClickListener?.onCustomChildClick(it, holder.adapterPosition) mOnCustomChildClickListener?.onCustomChildClick(it, holder.adapterPosition)
} }
ExpressManager.instance.getAdView(object : ExpressAdCallback {
override fun loadSuccess(adView: FrameLayout?) {
adView?.let {
UIUtils.removeFromParent(it)
val fmAd = holder.getView<FrameLayout>(R.id.fl_ad)
fmAd.removeAllViews()
fmAd.addView(it)
}
ExpressManager.instance.preLoadAd()
}
override fun renderSuccess(adView: FrameLayout?): Boolean {
return false
}
override fun loadFail() {
}
})
} }
private fun initVideoHolder(holder: BaseViewHolder, item: VideoMultiItemEntity) { private fun initVideoHolder(holder: BaseViewHolder, item: IndexList.VedioEpisodeBean?) {
//标题 //标题
holder.setText(R.id.title_tv, vedioBean?.title) holder.setText(R.id.title_tv, vedioBean?.title)
//集数 //集数
holder.setText(R.id.info_tv, "第" + item.video.vedioIndex + "集") holder.setText(R.id.info_tv, "第" + item?.vedioIndex + "集")
//收藏数量 //收藏数量
holder.setText(R.id.zan_num_tv, "" + vedioBean?.hot) holder.setText(R.id.zan_num_tv, "" + vedioBean?.hot)
//缩略图 //缩略图
...@@ -95,9 +146,9 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH ...@@ -95,9 +146,9 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
override fun onViewDetachedFromWindow(holder: BaseViewHolder) { override fun onViewDetachedFromWindow(holder: BaseViewHolder) {
super.onViewDetachedFromWindow(holder) super.onViewDetachedFromWindow(holder)
if (holder.itemViewType == VideoMultiItemEntity.MULTI_ITEM_1) { if (holder.itemViewType == MULTI_ITEM_1) {
vedioBean?.let { vedioBean?.let {
if (it.seeIndex != holder.layoutPosition + 1) { if (it.seeIndex == data[holder.layoutPosition].video!!.vedioIndex) {
holder.getView<TXVideoBaseView>(R.id.baseItemView).pausePlayer() holder.getView<TXVideoBaseView>(R.id.baseItemView).pausePlayer()
holder.getView<TXVideoBaseView>(R.id.baseItemView).stopForPlaying() holder.getView<TXVideoBaseView>(R.id.baseItemView).stopForPlaying()
} }
...@@ -107,7 +158,7 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH ...@@ -107,7 +158,7 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
override fun onViewRecycled(holder: BaseViewHolder) { override fun onViewRecycled(holder: BaseViewHolder) {
super.onViewRecycled(holder) super.onViewRecycled(holder)
if (holder.itemViewType == VideoMultiItemEntity.MULTI_ITEM_1) { if (holder.itemViewType == MULTI_ITEM_1) {
Glide.with(context).clear(holder.getView<View>(R.id.iv_cover)) Glide.with(context).clear(holder.getView<View>(R.id.iv_cover))
} }
} }
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<corners android:radius="60dp" />
<stroke android:color="#ff6666" android:width="1dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<corners android:radius="6dp" />
<stroke android:color="#f85959" android:width="1dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<corners android:radius="6dp" />
<stroke android:color="#3C93CD" android:width="1dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" >
<shape >
<stroke android:color="#7f2a90d7" />
<solid android:color="#2a90d7" />
<corners android:radius="6dp"/>
</shape>
</item>
<item >
<shape >
<stroke android:color="#2a90d7" />
<solid android:color="#2a90d7" />
<corners android:radius="6dp"/>
</shape>
</item>
</selector>
...@@ -206,6 +206,15 @@ ...@@ -206,6 +206,15 @@
android:textColor="@color/white" android:textColor="@color/white"
android:visibility="gone" /> android:visibility="gone" />
<com.mints.helivideo.ui.widgets.RoundRectLayout
android:id="@+id/fl_ad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="15dp"
android:background="@drawable/shape_bg_write"
android:elevation="2dp" />
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
<ImageView <ImageView
android:id="@+id/iv_bg" android:id="@+id/iv_bg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:scaleType="center" android:layout_height="match_parent"
android:layout_height="match_parent" /> android:scaleType="center" />
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
android:background="#99000000"> android:background="#99000000">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
...@@ -41,14 +41,25 @@ ...@@ -41,14 +41,25 @@
android:textColor="@color/white" /> android:textColor="@color/white" />
<Button <Button
android:visibility="gone"
android:id="@+id/vip" android:id="@+id/vip"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@mipmap/bg_detail_bottom" android:background="@mipmap/bg_detail_bottom"
android:textColor="@color/white" /> android:textColor="@color/white"
android:visibility="gone" />
<com.mints.helivideo.ui.widgets.RoundRectLayout
android:id="@+id/fl_ad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="15dp"
android:background="@drawable/shape_bg_write" />
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>
</FrameLayout> </FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/draw_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#99000000">
<FrameLayout
android:id="@+id/fl_ad"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#99000000" />
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ad_title_creative_btn_layout"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:visibility="gone"
android:orientation="horizontal">
<Button
android:id="@+id/btn_listitem_stop"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/btn_bg_blue"
android:textColor="#3C93CD"
android:text="暂停下载"
android:visibility="gone" />
<Button
android:id="@+id/btn_listitem_remove"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:background="@drawable/btn_bg_red"
android:textColor="#f85959"
android:text="删除下载"
android:visibility="gone" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="HardcodedText">
<!-- icon+广告源+关闭按钮 layout -->
<include
android:id="@+id/icon_source_layout"
layout="@layout/mediation_listitem_ad_icon_source_layout"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:paddingEnd="10dp"
android:paddingRight="10dp" />
<TextView
android:id="@+id/tv_listitem_ad_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/icon_source_layout"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:ellipsize="end"
android:lineSpacingMultiplier="1"
android:maxLines="2"
android:singleLine="false"
android:text="劳力士服务中心,清洗保养,更换配件,9秒费用查询"
android:textColor="@android:color/black"
android:textSize="18sp" />
<!-- -->
<LinearLayout
android:id="@+id/layout_image_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tv_listitem_ad_desc"
android:layout_centerHorizontal="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_listitem_image1"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/iv_listitem_image2"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/iv_listitem_image3"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_weight="1"
android:scaleType="centerCrop" />
</LinearLayout>
<!-- title+creativeBtn layout -->
<include
android:id="@+id/ad_title_creative_btn_layout"
layout="@layout/mediation_listitem_ad_title_creative_btn_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/layout_image_group"
android:layout_marginLeft="10dp"
android:layout_marginTop="4dp"
android:layout_marginRight="10dp" />
<!--==== 测试下载状态控制功能 begin ========-->
<include
layout="@layout/mediation_listitem_ad_download_btn_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ad_title_creative_btn_layout"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:gravity="center"
android:orientation="horizontal" />
<!--==== 测试下载状态控制功能 end ========-->
</RelativeLayout>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/icon_source_layout"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:paddingEnd="10dp"
android:paddingRight="10dp">
<ImageView
android:id="@+id/iv_listitem_icon"
android:layout_width="30dp"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp" />
<TextView
android:id="@+id/tv_listitem_ad_source"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/iv_listitem_icon"
android:layout_toLeftOf="@+id/iv_listitem_dislike_layout"
android:layout_toRightOf="@+id/iv_listitem_icon"
android:layout_toStartOf="@+id/iv_listitem_dislike_layout"
android:ellipsize="end"
android:gravity="center_vertical"
android:singleLine="true"
android:text="着陆无双"
android:textColor="#70000000"
android:textSize="16sp" />
<FrameLayout
android:id="@+id/iv_listitem_dislike_layout"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_listitem_dislike"
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:visibility="gone"
android:clickable="true"
android:focusable="true"
android:src="@drawable/dislike_icon" />
</FrameLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="HardcodedText">
<include
android:id="@+id/icon_source_layout"
layout="@layout/mediation_listitem_ad_icon_source_layout" />
<TextView
android:id="@+id/tv_listitem_ad_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/icon_source_layout"
android:layout_marginLeft="10dp"
android:layout_marginTop="3dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="3dp"
android:ellipsize="end"
android:lineSpacingMultiplier="1"
android:maxLines="2"
android:singleLine="false"
android:text="劳力士服务中心,清洗保养,更换配件,9秒费用查询"
android:textColor="@android:color/black"
android:textSize="18sp" />
<ImageView
android:id="@+id/iv_listitem_image"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_below="@id/tv_listitem_ad_desc"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/tt_ad_cover_btn_begin_bg"
android:scaleType="centerCrop" />
<!-- title+creativeBtn layout -->
<include
android:id="@+id/ad_title_creative_btn_layout"
layout="@layout/mediation_listitem_ad_title_creative_btn_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_listitem_image"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
</RelativeLayout>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="HardcodedText">
<include
android:id="@+id/icon_source_layout"
layout="@layout/mediation_listitem_ad_icon_source_layout" />
<TextView
android:id="@+id/tv_listitem_ad_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/icon_source_layout"
android:layout_marginLeft="10dp"
android:layout_marginTop="3dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="3dp"
android:ellipsize="end"
android:lineSpacingMultiplier="1"
android:maxLines="2"
android:singleLine="false"
android:text="劳力士服务中心,清洗保养,更换配件,9秒费用查询"
android:textColor="@android:color/black"
android:textSize="18sp" />
<FrameLayout
android:id="@+id/iv_listitem_video"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_below="@id/tv_listitem_ad_desc"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@android:color/background_dark"
android:scaleType="centerCrop" />
<!-- title+creativeBtn layout -->
<include
android:id="@+id/ad_title_creative_btn_layout"
layout="@layout/mediation_listitem_ad_title_creative_btn_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_listitem_video"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
</RelativeLayout>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="HardcodedText">
<RelativeLayout
android:id="@+id/ad_contentPanel"
android:layout_width="match_parent"
android:layout_height="85dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp">
<ImageView
android:id="@+id/iv_listitem_image"
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:background="@drawable/tt_ad_cover_btn_begin_bg"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/iv_listitem_image"
android:layout_toLeftOf="@+id/iv_listitem_image"
android:orientation="vertical">
<TextView
android:id="@+id/tv_listitem_ad_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:lineSpacingMultiplier="1.1"
android:maxLines="2"
android:text="80后的回忆!经典三国完美复刻,安卓用户的福利"
android:textColor="@android:color/black"
android:textSize="18sp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="3dp"
android:paddingEnd="10dp"
android:paddingRight="10dp">
<ImageView
android:id="@+id/iv_listitem_icon"
android:layout_width="30dp"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:src="@drawable/tt_mute" />
<TextView
android:id="@+id/tv_listitem_ad_source"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toStartOf="@+id/iv_listitem_dislike"
android:layout_toLeftOf="@+id/iv_listitem_dislike"
android:layout_toEndOf="@+id/iv_listitem_icon"
android:layout_toRightOf="@+id/iv_listitem_icon"
android:ellipsize="end"
android:gravity="center_vertical"
android:singleLine="true"
android:text="着陆无双"
android:textColor="#70000000"
android:textSize="16sp" />
<ImageView
android:id="@+id/iv_listitem_dislike"
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:src="@drawable/dislike_icon"
android:clickable="true"
android:focusable="true" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<!-- title+creativeBtn layout -->
<include
android:id="@+id/ad_title_creative_btn_layout"
layout="@layout/mediation_listitem_ad_title_creative_btn_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ad_contentPanel"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
</RelativeLayout>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ad_title_creative_btn_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="2dp"
android:background="#F4F5F7"
android:paddingTop="5dp">
<RelativeLayout
android:id="@+id/tt_ad_logo"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_centerVertical="true"
android:gravity="center_vertical"
android:visibility="gone" />
<TextView
android:id="@+id/tv_listitem_ad_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_toLeftOf="@+id/btn_listitem_creative"
android:layout_toRightOf="@+id/tt_ad_logo"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLength="14"
android:singleLine="true"
android:text="计策略,才真三国!计策略,才真三国!"
android:textSize="18sp" />
<Button
android:id="@+id/btn_listitem_creative"
android:layout_width="wrap_content"
android:layout_height="28dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginStart="3dp"
android:layout_marginLeft="3dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:background="@drawable/mediation_btn_bg_creative"
android:gravity="center"
android:padding="3dp"
android:text="立即下载"
android:textColor="#3399cc"
android:textSize="14sp" />
<LinearLayout
android:id="@+id/app_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_listitem_ad_title"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/app_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000"
android:textSize="14sp"
tools:text="Nidddddddddd" />
<TextView
android:id="@+id/author_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000"
android:textSize="14sp"
tools:text="Nidddddddddd" />
<TextView
android:id="@+id/package_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000"
android:textSize="14sp"
tools:text="Nidddddddddd" />
<TextView
android:id="@+id/permissions_url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="#000"
android:textSize="14sp"
tools:text="Nidddddddddd" />
<TextView
android:id="@+id/privacy_agreement"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="#000"
android:textSize="14sp"
tools:text="Nidddddddddd" />
<TextView
android:id="@+id/version_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000"
android:textSize="14sp"
tools:text="Nidddddddddd" />
<TextView
android:id="@+id/permissions_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000"
android:textSize="14sp"
tools:text="Nidddddddddd" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
...@@ -46,4 +46,5 @@ RELEASE_UMENG_KEY=64b8de13a1a164591b5133df ...@@ -46,4 +46,5 @@ RELEASE_UMENG_KEY=64b8de13a1a164591b5133df
GROMORE_APP_ID="5412556" GROMORE_APP_ID="5412556"
GROMORE_SPLASH_CODE="102398740" GROMORE_SPLASH_CODE="102398740"
GROMORE_VIDEO_CODE="102398300" GROMORE_VIDEO_CODE="102398300"
GROMORE_EXPRESS_CODE="102398300" GROMORE_EXPRESS_CODE="102405261"
GROMORE_DRAW_CODE="102405069"
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