Commit 3353f548 authored by mengcuiguang2's avatar mengcuiguang2

代码优化

parent b9a81a16
......@@ -29,9 +29,9 @@ class DetailAdDialog(private val context: Context, private val listener: DialogL
setContentView(R.layout.dialog_detail_ad)
// 设置window属性
lp = window!!.attributes
lp.gravity = Gravity.BOTTOM
lp.gravity = Gravity.CENTER
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.windowAnimations = R.style.DialogAnimBottom
lp.windowAnimations = R.style.DialogAnimFade
window!!.attributes = lp
// 设置外部不可关闭
......@@ -44,7 +44,7 @@ class DetailAdDialog(private val context: Context, private val listener: DialogL
}
// 查找View
iv_detail_ad_next = findViewById<View>(R.id.tv_detail_ad_next) as Button
iv_detail_ad_next = findViewById<View>(R.id.iv_detail_ad_next) as Button
findViewById<View>(R.id.iv_detail_quit).setOnClickListener {
dismiss()
}
......
......@@ -438,16 +438,16 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
unlockCallback = callback
currentDramaIndex = dpWidget?.currentDramaIndex!!
// 展示广告
if (!UserManager.getInstance().newFlag) {
val unlockText = String.format(
val unlockText = String.format(
"解锁%s·第%d-%d集",
drama.title,
mInitUnlockIndex + 1,
mInitUnlockIndex + lockSet
)
AppConfig.detailDialogUnlockText = unlockText
)
AppConfig.detailDialogUnlockText = unlockText
if (!UserManager.getInstance().newFlag) {
tv_title.text = unlockText
} else {
......
......@@ -83,8 +83,22 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
vipBtn.visibility = View.GONE
}
val adBtn = holder.getView<View>(R.id.unlock)
vedioBean?.let {
try {
val unlockText = String.format(
"解锁%s·第%d-%d集",
it.title,
it.unlockIndex + 1,
it.unlockIndex + it.adGiveVedioNum
)
AppConfig.detailDialogUnlockText = unlockText
}catch (e:Exception){
}
if (it.isRecommendVedio) { // 推荐剧集逻辑
if (holder.adapterPosition < it.unlockIndex) {
// 观看激励视频解锁
......@@ -93,13 +107,7 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
holder.getView<TextView>(R.id.tv_title).text =
if (AppConfig.firstVipPrice == 0.0) "解锁后续剧集" else "${AppConfig.firstVipPrice}元解锁后续剧集"
val unlockText = String.format(
"解锁%s·第%d-%d集",
it.title,
it.unlockIndex + 1,
it.unlockIndex + it.adGiveVedioNum
)
AppConfig.detailDialogUnlockText = unlockText
} else { // 开通会员解锁
adBtn.visibility = View.GONE
vipBtn.visibility = View.VISIBLE
......
......@@ -58,6 +58,17 @@ class NewTxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity4, BaseV
val adBtn = holder.getView<View>(R.id.unlock)
vedioBean?.let {
try {
val unlockText = String.format(
"解锁%s·第%d-%d集",
it.title,
it.unlockIndex + 1,
it.unlockIndex + it.adGiveVedioNum
)
AppConfig.detailDialogUnlockText = unlockText
}catch (e:Exception){
}
when (type) {
VEDIO3DOS_AD -> { // 观看激励视频解锁
vipBtn.visibility = View.GONE
......@@ -65,13 +76,6 @@ class NewTxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity4, BaseV
holder.getView<TextView>(R.id.tv_title).text =
if (AppConfig.firstVipPrice == 0.0) "解锁后续剧集" else "${AppConfig.firstVipPrice}元解锁后续剧集"
val unlockText = String.format(
"解锁%s·第%d-%d集",
it.title,
it.unlockIndex + 1,
it.unlockIndex + it.adGiveVedioNum
)
AppConfig.detailDialogUnlockText = unlockText
}
VEDIO3DOS_PAY -> { // 开通会员解锁
adBtn.visibility = View.GONE
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="@color/black"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:gravity="center"
android:orientation="vertical">
......@@ -39,7 +38,7 @@
<Button
android:id="@+id/tv_detail_ad_next"
android:id="@+id/iv_detail_ad_next"
android:layout_width="280dp"
android:layout_height="46dp"
android:layout_marginTop="20dp"
......@@ -52,7 +51,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:src="@mipmap/ic_activity_quit"></ImageView>
android:src="@mipmap/ic_quit_yuan"></ImageView>
</LinearLayout>
</RelativeLayout>
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