Commit e3002302 authored by jyx's avatar jyx

优化信息流展示,优化自有剧弹框逻辑

parent cc8228fe
......@@ -40,6 +40,11 @@ object BannerManager {
UIUtils.getAdWidth2(MintsApplication.getContext()).toInt(),
0
) // 单位px
.supportRenderControl() //支持模板样式
.setExpressViewAcceptedSize(
UIUtils.getAdWidth2(MintsApplication.getContext()),
0f
)//设置模板宽高(dp)
.setUserID("1234")
.setMediationAdSlot(
MediationAdSlot.Builder()
......
......@@ -51,9 +51,10 @@ class MainExpressManager {
*/
.setImageAcceptedSize(
UIUtils.getAdWidth2(MintsApplication.getContext()).toInt(),
// UIUtils.dip2px(MintsApplication.getContext(), 192f)
0
)
.supportRenderControl() //支持模板样式
.setExpressViewAcceptedSize(330f,0f)//设置模板宽高(dp)
.setAdCount(2)//请求广告数量为1到3条 (优先采用平台配置的数量)
.build()
......@@ -153,7 +154,9 @@ class MainExpressManager {
}
override fun onAdShow() {
if (it != null && it!!.getMediationManager()!=null&& it!!.getMediationManager().getShowEcpm() != null) {
if (it != null && it!!.getMediationManager() != null && it!!.getMediationManager()
.getShowEcpm() != null
) {
val vo = HashMap<String, Any>()
vo["adcode"] = it!!.getMediationManager().getShowEcpm().getSlotId()
vo["ecpm"] = it!!.getMediationManager().getShowEcpm().getEcpm()
......
......@@ -89,6 +89,8 @@ class MyExpressManager {
* 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
*/
.setImageAcceptedSize(UIUtils.getAdWidth(MintsApplication.getContext()).toInt(), 0)
.supportRenderControl() //支持模板样式
.setExpressViewAcceptedSize(300f,0f)//设置模板宽高(dp)
.setAdCount(3)//请求广告数量为1到3条 (优先采用平台配置的数量)
.build()
......@@ -217,8 +219,9 @@ class MyExpressManager {
}
override fun onAdShow() {
if (it != null && it!!.getMediationManager()!=null
&& it!!.getMediationManager().getShowEcpm() != null) {
if (it != null && it!!.getMediationManager() != null
&& it!!.getMediationManager().getShowEcpm() != null
) {
val vo = HashMap<String, Any>()
vo["adcode"] = it!!.getMediationManager().getShowEcpm().getSlotId()
vo["ecpm"] = it!!.getMediationManager().getShowEcpm().getEcpm()
......@@ -799,7 +802,7 @@ class MyExpressManager {
adViewHolder.mDescription?.text = it.description //description为广告的较长的说明
println("mcg -->>> title="+it.title+" description="+it.description)
println("mcg -->>> title=" + it.title + " description=" + it.description)
adViewHolder.mSource?.text =
if (TextUtils.isEmpty(it.source)) "广告来源" else it.source
......
......@@ -9,7 +9,7 @@ const val MULTI_ITEM_2 = 2
const val MULTI_ITEM_3 = 3
data class VideoMultiItemEntity(
override val itemType: Int,
override var itemType: Int,
var video: IndexList.VedioEpisodeBean?,
var videoModel: VideoModel?
) : MultiItemEntity, java.io.Serializable
......
......@@ -53,6 +53,49 @@ class VideoPresenter : BasePresenter<VideoView>() {
})
}
fun getIndexListA(thirdId: String, csj: Boolean = false) {
val vo = HashMap<String, Any>()
if (csj) {
vo["thirdId"] = thirdId
} else {
vo["vedioId"] = thirdId
}
AppHttpManager.getInstance(loanApplication)
.call(loanService.getIndexListA(vo),
object : BaseSubscriber<BaseResponse<IndexList>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<IndexList>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.getIndexListSuc(baseResponse.data)
else -> {
view.getIndexListFail()
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
view.getIndexListFail()
}
})
}
fun unlock(vo: HashMap<String, Any>) {
AppHttpManager.getInstance(loanApplication)
.call(
......
......@@ -153,6 +153,14 @@ public interface LoanService {
@POST("api/vedio/getIndexList")
Observable<BaseResponse<IndexList>> getIndexList(@Body Map<String, Object> vo);
/**
* 剧情列表
*
* @return
*/
@POST("api/vedio/getIndexLista")
Observable<BaseResponse<IndexList>> getIndexListA(@Body Map<String, Object> vo);
/**
* 收藏
*
......
......@@ -20,7 +20,6 @@ import com.duben.supertheater.R
import com.duben.supertheater.ad.AdManager
import com.duben.supertheater.ad.AdStatusListener
import com.duben.supertheater.ad.NoPreAdManager
import com.duben.supertheater.ad.draw.DrawExpressManager
import com.duben.supertheater.ad.express.ExpressManager
import com.duben.supertheater.common.Constant
import com.duben.supertheater.manager.LocalVedioManager
......@@ -82,7 +81,7 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
HalfScreenManager.getInstance().preLoadAd(this)
videoPresenter.attachView(this)
mVedioBean?.let { videoPresenter.getIndexList("" + it.vedioId) }
mVedioBean?.let { videoPresenter.getIndexListA("" + it.vedioId) }
initView()
}
......@@ -109,7 +108,7 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
// 重置状态
isPlayNext = false
playIndex = super_short_video_view.currentPosition
mVedioBean?.let { videoPresenter.getIndexList("" + it.vedioId) }
mVedioBean?.let { videoPresenter.getIndexListA("" + it.vedioId) }
}
}
......@@ -145,7 +144,7 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
super_short_video_view.setOnPageChangeListener {
if (super_short_video_view.isAdPosition(it) || super_short_video_view.isLuckPosition(it)) {
showLockDialog()
fm_bottom.visibility = View.GONE
// fm_bottom.visibility = View.GONE
super_short_video_view.pause()
return@setOnPageChangeListener
}
......@@ -240,9 +239,17 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
}
override fun unlockSuc(indexList: IndexList) {
videos.addAll(indexList.list)
mVedioBean!!.unlockIndex = videos.size
super_short_video_view.loadMoreData(getAdapterData())
// videos.addAll(indexList.list)
// mVedioBean!!.unlockIndex = videos.size
// super_short_video_view.loadMoreData(getAdapterData())
val lockSet = if (mVedioBean!!.adGiveVedioNum == 0) 1 else mVedioBean!!.adGiveVedioNum
mVedioBean!!.unlockIndex += lockSet
super_short_video_view.loadData(
mVedioBean,
getAdapterData(),
mVedioBean!!.unlockIndex - lockSet
)
}
override fun unlockFail() {
......@@ -269,11 +276,11 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
override fun onEpisodeClick(position: Int) {
dialog?.dismiss()
val data = super_short_video_view.data
if (position >= mVedioBean!!.unlockIndex) {
super_short_video_view.onItemClick(data.size - 1)
return
}
// val data = super_short_video_view.data
// if (position >= mVedioBean!!.unlockIndex) {
// super_short_video_view.onItemClick(data.size - 1)
// return
// }
val readPosition = getRealPosition(position + 1)
......@@ -283,15 +290,24 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
private fun getAdapterData(): MutableList<VideoMultiItemEntity> {
val data = mutableListOf<VideoMultiItemEntity>()
if (videos.size > 0) {
for (video in videos) {
val item = VideoMultiItemEntity(MULTI_ITEM_1, video, VideoModel(video.vedioUrl))
data.add(item)
}
if (mVedioBean!!.unlockIndex < mVedioBean!!.vedioTotal) {
for (i in 0 until videos.size) {
val item =
VideoMultiItemEntity(MULTI_ITEM_2, videos[0], VideoModel(videos[0].vedioUrl))
VideoMultiItemEntity(MULTI_ITEM_1, videos[i], VideoModel(videos[i].vedioUrl))
if (i >= mVedioBean!!.unlockIndex) {
item.itemType = MULTI_ITEM_2
}
data.add(item)
}
// for (video in videos) {
// val item = VideoMultiItemEntity(MULTI_ITEM_1, video, VideoModel(video.vedioUrl))
// data.add(item)
// }
// if (mVedioBean!!.unlockIndex < mVedioBean!!.vedioTotal) {
// val item =
// VideoMultiItemEntity(MULTI_ITEM_2, videos[0], VideoModel(videos[0].vedioUrl))
// data.add(item)
// }
}
return data
}
......@@ -305,7 +321,7 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
finish()
}
R.id.unlock -> {
R.id.unlock, R.id.block_view -> {
// 看广告解锁
// val carrierType = Constant.CARRIERTYPE_TX_VEDIO
// showAd(carrierType)
......@@ -346,7 +362,7 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
var readIndex = position
val data = super_short_video_view.data
if (data != null && data.size > 0) {
if (data[position].itemType == MULTI_ITEM_1) {
if (data[position].itemType == MULTI_ITEM_1 || data[position].itemType == MULTI_ITEM_2) {
readIndex = data[position].video!!.vedioIndex
}
}
......@@ -359,7 +375,7 @@ class NewTxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
val data = super_short_video_view.data
if (data != null && data.size > 0) {
for (i in 0 until data.size) {
if (data[i].itemType == MULTI_ITEM_1) {
if (data[i].itemType == MULTI_ITEM_1 || data[i].itemType == MULTI_ITEM_2) {
if (data[i].video!!.vedioIndex == position) {
readPosition = i
break
......
......@@ -10,10 +10,8 @@ import android.os.Handler
import android.os.Looper
import android.view.View
import android.view.animation.LinearInterpolator
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.RelativeLayout
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
......@@ -22,7 +20,6 @@ import com.duben.supertheater.R
import com.duben.supertheater.ad.AdManager
import com.duben.supertheater.ad.AdStatusListener
import com.duben.supertheater.ad.NoPreAdManager
import com.duben.supertheater.ad.draw.DrawExpressManager
import com.duben.supertheater.ad.express.ExpressManager
import com.duben.supertheater.common.Constant
import com.duben.supertheater.manager.LocalVedioManager
......@@ -42,13 +39,6 @@ import com.duben.supertheater.ui.widgets.countdowntimer.CountDownTimerSupport
import com.duben.supertheater.ui.widgets.countdowntimer.OnCountDownTimerListener
import com.duben.supertheater.utils.*
import kotlinx.android.synthetic.main.activity_tx_video.*
import kotlinx.android.synthetic.main.activity_tx_video.cl_reward
import kotlinx.android.synthetic.main.activity_tx_video.episode_tv
import kotlinx.android.synthetic.main.activity_tx_video.fm_bottom
import kotlinx.android.synthetic.main.activity_tx_video.iv_cash_reward
import kotlinx.android.synthetic.main.activity_tx_video.iv_gold_reward
import kotlinx.android.synthetic.main.activity_tx_video.tv_cash_reward
import kotlinx.android.synthetic.main.activity_tx_video.tv_gold_reward
import kotlinx.android.synthetic.main.layout_draw_header.*
import kotlinx.android.synthetic.main.layout_red_box.*
......@@ -88,7 +78,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
HalfScreenManager.getInstance().preLoadAd(this)
videoPresenter.attachView(this)
mVedioBean?.let { videoPresenter.getIndexList("" + it.vedioId) }
mVedioBean?.let { videoPresenter.getIndexListA("" + it.vedioId) }
initView()
}
......@@ -115,7 +105,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
// 重置状态
isPlayNext = false
playIndex = super_short_video_view.currentPosition
mVedioBean?.let { videoPresenter.getIndexList("" + it.vedioId) }
mVedioBean?.let { videoPresenter.getIndexListA("" + it.vedioId) }
}
}
......@@ -149,12 +139,11 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
if (mVedioBean?.completeStatus == 0) "已完结" else "更新中"
)
super_short_video_view.setOnCustomChildClickListener(this)
super_short_video_view.setOnCustomChildClickListener(this)
super_short_video_view.setOnPageChangeListener {
if (super_short_video_view.isAdPosition(it) || super_short_video_view.isLuckPosition(it)) {
showLockDialog()
fm_bottom.visibility = View.GONE
// fm_bottom.visibility = View.GONE
super_short_video_view.pause()
return@setOnPageChangeListener
}
......@@ -239,9 +228,16 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
}
override fun unlockSuc(indexList: IndexList) {
videos.addAll(indexList.list)
mVedioBean!!.unlockIndex = videos.size
super_short_video_view.loadMoreData(getAdapterData())
// videos.addAll(indexList.list)
// mVedioBean!!.unlockIndex = videos.size
// super_short_video_view.loadMoreData(getAdapterData())
val lockSet = if (mVedioBean!!.adGiveVedioNum == 0) 1 else mVedioBean!!.adGiveVedioNum
mVedioBean!!.unlockIndex += lockSet
super_short_video_view.loadData(
mVedioBean,
getAdapterData(),
mVedioBean!!.unlockIndex - lockSet
)
}
override fun unlockFail() {
......@@ -297,11 +293,11 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
override fun onEpisodeClick(position: Int) {
dialog?.dismiss()
val data = super_short_video_view.data
if (position >= mVedioBean!!.unlockIndex) {
super_short_video_view.onItemClick(data.size - 1)
return
}
// val data = super_short_video_view.data
// if (position >= mVedioBean!!.unlockIndex) {
// super_short_video_view.onItemClick(data.size - 1)
// return
// }
val readPosition = getRealPosition(position + 1)
......@@ -311,15 +307,24 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
private fun getAdapterData(): MutableList<VideoMultiItemEntity> {
val data = mutableListOf<VideoMultiItemEntity>()
if (videos.size > 0) {
for (video in videos) {
val item = VideoMultiItemEntity(MULTI_ITEM_1, video, VideoModel(video.vedioUrl))
data.add(item)
}
if (mVedioBean!!.unlockIndex < mVedioBean!!.vedioTotal) {
for (i in 0 until videos.size) {
val item =
VideoMultiItemEntity(MULTI_ITEM_2, videos[0], VideoModel(videos[0].vedioUrl))
VideoMultiItemEntity(MULTI_ITEM_1, videos[i], VideoModel(videos[i].vedioUrl))
if (i >= mVedioBean!!.unlockIndex) {
item.itemType = MULTI_ITEM_2
}
data.add(item)
}
// for (video in videos) {
// val item = VideoMultiItemEntity(MULTI_ITEM_1, video, VideoModel(video.vedioUrl))
// data.add(item)
// }
// if (mVedioBean!!.unlockIndex < mVedioBean!!.vedioTotal) {
// val item =
// VideoMultiItemEntity(MULTI_ITEM_2, videos[0], VideoModel(videos[0].vedioUrl))
// data.add(item)
// }
}
return data
}
......@@ -332,8 +337,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
// 返回
finish()
}
R.id.unlock -> {
R.id.unlock, R.id.block_view -> {
// 看广告解锁
// val carrierType = Constant.CARRIERTYPE_TX_VEDIO
// showAd(carrierType)
......@@ -374,7 +378,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
var readIndex = position
val data = super_short_video_view.data
if (data != null && data.size > 0) {
if (data[position].itemType == MULTI_ITEM_1) {
if (data[position].itemType == MULTI_ITEM_1 || data[position].itemType == MULTI_ITEM_2) {
readIndex = data[position].video!!.vedioIndex
}
}
......@@ -387,7 +391,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
val data = super_short_video_view.data
if (data != null && data.size > 0) {
for (i in 0 until data.size) {
if (data[i].itemType == MULTI_ITEM_1) {
if (data[i].itemType == MULTI_ITEM_1 || data[i].itemType == MULTI_ITEM_2) {
if (data[i].video!!.vedioIndex == position) {
readPosition = i
break
......
......@@ -68,64 +68,68 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
}
private fun initLockHolder(holder: BaseViewHolder) {
Glide.with(context).load(vedioBean?.coverImage)
.into(holder.getView(R.id.iv_bg))
val vipBtn = holder.getView<View>(R.id.vip)
if (UserManager.getInstance().newFlag) {
// 匹配
vipBtn.visibility = View.VISIBLE
vipBtn.setOnClickListener {
mOnCustomChildClickListener?.onCustomChildClick(it, holder.adapterPosition)
}
} else {
// 未匹配
vipBtn.visibility = View.GONE
holder.itemView.setOnClickListener {
mOnCustomChildClickListener?.onCustomChildClick(it, holder.adapterPosition)
}
val adBtn = holder.getView<View>(R.id.unlock)
vedioBean?.let {
if (it.isRecommendVedio) { // 推荐剧集逻辑
if (holder.adapterPosition < it.unlockIndex) { // 观看激励视频解锁
vipBtn.visibility = View.GONE
adBtn.visibility = View.VISIBLE
holder.getView<TextView>(R.id.tv_title).text = String.format(
"解锁%s·第%d集",
it.title,
holder.adapterPosition + 1
)
holder.getView<TextView>(R.id.tv_info).text = String.format(
"看激励视频解锁1集剧情\n请按照顺序解锁"
)
} else { // 开通会员解锁
adBtn.visibility = View.GONE
vipBtn.visibility = View.VISIBLE
holder.getView<TextView>(R.id.tv_info).visibility = View.GONE
vipBtn.setBackgroundResource(R.mipmap.bg_detail_bottom_vip)
holder.getView<TextView>(R.id.tv_title).text =
String.format("解锁%s·全集", it.title)
}
} else {
adBtn.visibility = View.VISIBLE
holder.getView<TextView>(R.id.tv_title).text = String.format(
"解锁%s·第%d-%d集",
it.title,
it.unlockIndex + 1,
it.unlockIndex + it.adGiveVedioNum
)
holder.getView<TextView>(R.id.tv_info).text = String.format(
"看激励视频解锁%d集剧情\n请按照顺序解锁",
it.adGiveVedioNum
)
}
holder.getView<TextView>(R.id.unlock).text = String.format("查看激励视频")
holder.getView<View>(R.id.unlock).setOnClickListener { it2 ->
mOnCustomChildClickListener?.onCustomChildClick(it2, holder.adapterPosition)
}
}
Glide.with(context).load(vedioBean?.coverImage)
.into(holder.getView(R.id.iv_bg))
// val vipBtn = holder.getView<View>(R.id.vip)
// if (UserManager.getInstance().newFlag) {
// // 匹配
// vipBtn.visibility = View.VISIBLE
// vipBtn.setOnClickListener {
// mOnCustomChildClickListener?.onCustomChildClick(it, holder.adapterPosition)
// }
// } else {
// // 未匹配
// vipBtn.visibility = View.GONE
// }
//
// val adBtn = holder.getView<View>(R.id.unlock)
// vedioBean?.let {
// if (it.isRecommendVedio) { // 推荐剧集逻辑
// if (holder.adapterPosition < it.unlockIndex) { // 观看激励视频解锁
//
// vipBtn.visibility = View.GONE
// adBtn.visibility = View.VISIBLE
// holder.getView<TextView>(R.id.tv_title).text = String.format(
// "解锁%s·第%d集",
// it.title,
// holder.adapterPosition + 1
// )
// holder.getView<TextView>(R.id.tv_info).text = String.format(
// "看激励视频解锁1集剧情\n请按照顺序解锁"
// )
// } else { // 开通会员解锁
// adBtn.visibility = View.GONE
// vipBtn.visibility = View.VISIBLE
//
// holder.getView<TextView>(R.id.tv_info).visibility = View.GONE
// vipBtn.setBackgroundResource(R.mipmap.bg_detail_bottom_vip)
// holder.getView<TextView>(R.id.tv_title).text =
// String.format("解锁%s·全集", it.title)
// }
//
// } else {
// adBtn.visibility = View.VISIBLE
//
// holder.getView<TextView>(R.id.tv_title).text = String.format(
// "解锁%s·第%d-%d集",
// it.title,
// it.unlockIndex + 1,
// it.unlockIndex + it.adGiveVedioNum
// )
// holder.getView<TextView>(R.id.tv_info).text = String.format(
// "看激励视频解锁%d集剧情\n请按照顺序解锁",
// it.adGiveVedioNum
// )
// }
// holder.getView<TextView>(R.id.unlock).text = String.format("查看激励视频")
// holder.getView<View>(R.id.unlock).setOnClickListener { it2 ->
// mOnCustomChildClickListener?.onCustomChildClick(it2, holder.adapterPosition)
// }
// }
// ExpressManager.instance.getAdView(
// object : ExpressAdCallback {
......
......@@ -11,11 +11,19 @@
android:layout_height="match_parent"
android:scaleType="center" />
<ImageView
android:id="@+id/iv_play"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:src="@mipmap/player_pause" />
<com.duben.supertheater.ui.widgets.RoundRectLayout
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#99000000">
android:background="#99000000"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
......
......@@ -16,8 +16,8 @@
<Tumblr Enable="false" />
<Email Enable="false" />
<ShortMessage Enable="false" />
<Wechat AppId="wx8d69898f9fb291e6" AppSecret="ad6245d18872ed53a33c0f71418f6cde" userName="gh_afb25ac019c9" path="pages/index/index.html?id=1" WithShareTicket="true" MiniprogramType="0" />
<WechatMoments AppId="wx8d69898f9fb291e6" AppSecret="ad6245d18872ed53a33c0f71418f6cde" />
<Wechat AppId="wx31bf385f4de047cf" AppSecret="31869e2d8815b0ba28cf4d74e2155191" userName="gh_afb25ac019c9" path="pages/index/index.html?id=1" WithShareTicket="true" MiniprogramType="0" />
<WechatMoments AppId="wx31bf385f4de047cf" AppSecret="31869e2d8815b0ba28cf4d74e2155191" />
<QQ Enable="false" />
<Instapaper Enable="false" />
<Pocket Enable="false" />
......
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