Commit bfb86a41 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent a6ebd3d5
......@@ -26,6 +26,7 @@ public class AppConfig {
public static boolean enterAlipay = false;
public static boolean showVipVedio = false;
public static boolean showVipAdDialog = false;
public static String detailDialogUnlockText = "";
public static long splashTime = 0L;
public static double firstVipPrice = 0.0;
......
......@@ -2,28 +2,27 @@ package com.duben.xixiplaylet.ui.widgets
import android.app.Dialog
import android.content.Context
import android.os.Handler
import android.location.GnssAntennaInfo.Listener
import android.view.Gravity
import android.view.KeyEvent
import android.view.View
import android.view.WindowManager
import android.widget.ImageView
import android.widget.TextView
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.duben.xixiplaylet.R
import com.duben.xixiplaylet.ui.widgets.countdowntimer.CountDownTimerSupport
import com.duben.xixiplaylet.ui.widgets.countdowntimer.OnCountDownTimerListener
import com.duben.xixiplaylet.common.AppConfig
import com.duben.xixiplaylet.mvp.model.VedioBean
import com.duben.xixiplaylet.utils.SpanUtils
import com.duben.xixiplaylet.utils.TimeRender
import java.util.*
class DetailAdDialog(private val context: Context, private val listener: DialogListener) :
class DetailAdDialog(private val context: Context, private val listener: DialogListener?) :
Dialog(
context, R.style.dialog
) {
private val lp: WindowManager.LayoutParams
private val iv_detail_ad_next: ImageView
private val tv_detail_ad_unlocktext: TextView
init {
setContentView(R.layout.dialog_detail_ad)
......@@ -45,7 +44,9 @@ class DetailAdDialog(private val context: Context, private val listener: DialogL
// 查找View
iv_detail_ad_next = findViewById<View>(R.id.iv_detail_ad_next) as ImageView
tv_detail_ad_unlocktext = findViewById<View>(R.id.tv_detail_ad_unlocktext) as TextView
tv_detail_ad_unlocktext.text = AppConfig.detailDialogUnlockText
iv_detail_ad_next.setOnClickListener(listener)
}
}
\ No newline at end of file
......@@ -49,7 +49,6 @@ import kotlinx.android.synthetic.main.drama_activity_api_detail.*
import kotlinx.android.synthetic.main.drama_activity_api_detail.iv_lucky_gif
import kotlinx.android.synthetic.main.drama_activity_api_detail.ll_lucky
import kotlinx.android.synthetic.main.drama_activity_api_detail.tv_lucky_status
import kotlinx.android.synthetic.main.fragment_main.*
/**
* @author Assen
......@@ -442,13 +441,14 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
if (!UserManager.getInstance().newFlag) {
tv_title.text = String.format(
val unlockText = String.format(
"解锁%s·第%d-%d集",
drama.title,
mInitUnlockIndex + 1,
mInitUnlockIndex + lockSet
)
AppConfig.detailDialogUnlockText = unlockText
tv_title.text = unlockText
} else {
tv_title.text =
......
......@@ -4,7 +4,6 @@ import android.app.Dialog
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.text.TextUtils
import android.view.View
import com.google.gson.Gson
import com.duben.xixiplaylet.R
......@@ -31,7 +30,6 @@ import com.duben.library.utils.GlideUtils
import com.duben.library.utils.nodoubleclick.AntiShake
import com.duben.xixiplaylet.common.AppConfig
import com.duben.xixiplaylet.ui.widgets.*
import kotlinx.android.synthetic.main.activity_new_vip.*
import kotlinx.android.synthetic.main.activity_tx_video.*
class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
......
......@@ -92,6 +92,14 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
adBtn.visibility = View.VISIBLE
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
......
......@@ -62,18 +62,29 @@ class NewTxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity4, BaseV
VEDIO3DOS_AD -> { // 观看激励视频解锁
vipBtn.visibility = View.GONE
adBtn.visibility = View.VISIBLE
holder.getView<TextView>(R.id.tv_title).text = if (AppConfig.firstVipPrice == 0.0) "解锁后续剧集" else "${AppConfig.firstVipPrice}元解锁后续剧集"
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
vipBtn.visibility = View.VISIBLE
holder.getView<TextView>(R.id.tv_title).text =if (AppConfig.firstVipPrice == 0.0) "解锁后续剧集" else "${AppConfig.firstVipPrice}元解锁后续剧集"
holder.getView<TextView>(R.id.tv_title).text =
if (AppConfig.firstVipPrice == 0.0) "解锁后续剧集" else "${AppConfig.firstVipPrice}元解锁后续剧集"
}
else -> {
adBtn.visibility = View.GONE
vipBtn.visibility = View.VISIBLE
holder.getView<TextView>(R.id.tv_title).text = if (AppConfig.firstVipPrice == 0.0) "解锁后续剧集" else "${AppConfig.firstVipPrice}元解锁后续剧集"
holder.getView<TextView>(R.id.tv_title).text =
if (AppConfig.firstVipPrice == 0.0) "解锁后续剧集" else "${AppConfig.firstVipPrice}元解锁后续剧集"
}
}
......
......@@ -15,6 +15,7 @@
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_detail_ad_unlocktext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
......@@ -35,146 +36,6 @@
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginTop="8dp"
android:background="#E1E1E1" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="4dp"
android:layout_marginTop="10dp"
android:layout_marginRight="4dp"
android:background="@drawable/shape_bg_agreement"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_rule_date1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="试用订阅规则说明"
android:textColor="@color/black"
android:textSize="14sp"></TextView>
</FrameLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@mipmap/ic_arrow_bottom"></ImageView>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="4dp"
android:layout_marginTop="4dp"
android:layout_marginRight="4dp"
android:background="@drawable/shape_bg_agreement"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="续费提醒"
android:textColor="@color/black"
android:textSize="14sp"></TextView>
</FrameLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@mipmap/ic_arrow_bottom"></ImageView>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="4dp"
android:layout_marginTop="4dp"
android:layout_marginRight="4dp"
android:background="@drawable/shape_bg_agreement"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="试用到期后进行自动续费扣款"
android:textColor="@color/black"
android:textSize="14sp"></TextView>
</FrameLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@mipmap/ic_arrow_bottom"></ImageView>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="4dp"
android:layout_marginTop="4dp"
android:layout_marginRight="4dp"
android:background="@drawable/shape_bg_agreement"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_rule_date2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="@color/black"
android:textSize="14sp"></TextView>
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="4dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:text="支付方式"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold"></TextView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="right"
android:layout_marginRight="20dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@mipmap/ic_alipay"
android:drawablePadding="6dp"
android:gravity="center_vertical"
android:text="支付宝"
android:textColor="@color/black"
android:textSize="14sp"
android:textStyle="bold" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:scaleType="center"
android:src="@mipmap/ic_vip_enable_blue" />
</LinearLayout>
</FrameLayout>
<TextView
android:id="@+id/tv_detail_ad_next"
android:layout_width="match_parent"
......
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