Commit 4ae4c218 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent eda5d071
...@@ -17,6 +17,7 @@ public class AppConfig { ...@@ -17,6 +17,7 @@ public class AppConfig {
*/ */
public static int fragmentClickFlag = 0; public static int fragmentClickFlag = 0;
public static int vedioId = 0; public static int vedioId = 0;
public static int alipayCancelCount = 0;
// 退出登录首页刷新 // 退出登录首页刷新
public static boolean exitLoginMainRefresh = false; public static boolean exitLoginMainRefresh = false;
......
...@@ -29,6 +29,7 @@ object Constant { ...@@ -29,6 +29,7 @@ object Constant {
const val MAIN_TWO_RECOMMEND = "MAIN_TWO_RECOMMEND" const val MAIN_TWO_RECOMMEND = "MAIN_TWO_RECOMMEND"
const val VEDIO_AD_COUNT = "VEDIO_AD_COUNT" const val VEDIO_AD_COUNT = "VEDIO_AD_COUNT"
const val VEDIO_MAIN_COUNT = "VEDIO_MAIN_COUNT" const val VEDIO_MAIN_COUNT = "VEDIO_MAIN_COUNT"
const val ALIPAY_COUNT = "ALIPAY_COUNT"
const val CARRIERTYPE_CSJ_VEDIO = "1" const val CARRIERTYPE_CSJ_VEDIO = "1"
......
...@@ -68,6 +68,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -68,6 +68,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
const val THIRD_ID = "THIRD_ID" const val THIRD_ID = "THIRD_ID"
const val VEDIO_ID = "VEDIO_ID" const val VEDIO_ID = "VEDIO_ID"
} }
var timer: CountDownTimerSupport? = null var timer: CountDownTimerSupport? = null
private var breathAnim: YoYo.YoYoString? = null private var breathAnim: YoYo.YoYoString? = null
...@@ -487,13 +488,18 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -487,13 +488,18 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
// 挽留弹窗存在也不弹 // 挽留弹窗存在也不弹
if (payYesDialog != null && payYesDialog!!.isShowing) return@postDelayed if (payYesDialog != null && payYesDialog!!.isShowing) return@postDelayed
if (vipList != null && vipList!!.size > 0) { val alipayCount =
val vipBean = vipList!![vipAdapter.getPosition()] AppPreferencesManager.get().getInt(Constant.ALIPAY_COUNT, 0)
// 0.01 AppPreferencesManager.get().put(Constant.ALIPAY_COUNT, alipayCount + 1)
if (vipBean.trial != 0) {
showPayCancelDialog() showPayCancelDialog()
} // if (vipList != null && vipList!!.size > 0) {
} // val vipBean = vipList!![vipAdapter.getPosition()]
// // 0.01
// if (vipBean.trial != 0) {
// showPayCancelDialog()
// }
// }
}, },
2000 2000
...@@ -535,6 +541,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -535,6 +541,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
* 返回支付弹窗-签约 * 返回支付弹窗-签约
*/ */
private fun backPayYesDialog(vipBean: VipBean.ListBean) { private fun backPayYesDialog(vipBean: VipBean.ListBean) {
// 金额
payYesDialog = PayYesDialog(context, vipBean, object : DialogListener() { payYesDialog = PayYesDialog(context, vipBean, object : DialogListener() {
override fun onClick(v: View) { override fun onClick(v: View) {
if (!isFinishing() && payYesDialog != null && payYesDialog!!.isShowing()) { if (!isFinishing() && payYesDialog != null && payYesDialog!!.isShowing()) {
...@@ -731,13 +738,20 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -731,13 +738,20 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
} }
private fun showPayCancelDialog() { private fun showPayCancelDialog() {
// 金额
val alipayCount =
AppPreferencesManager.get().getInt(Constant.ALIPAY_COUNT, 0)
if (alipayCount == 1) {
} else if (alipayCount == 2) {
}
val vipBean = vipList!![0] val vipBean = vipList!![0]
VipPayCancelDialog(this, vipBean.price, object : DialogListener() { VipPayCancelDialog(this, vipBean.price, object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) { override fun onClick(dialog: Dialog?, v: View?) {
super.onClick(dialog, v) super.onClick(dialog, v)
dialog?.dismiss() dialog?.dismiss()
vipPresenter.getVipPayParams( vipPresenter.getVipPayParams(
"ALIPAY", "ALIPAY",
vipBean.pid, isAliPayInstalled() vipBean.pid, isAliPayInstalled()
...@@ -756,7 +770,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener, ...@@ -756,7 +770,7 @@ class VipActivity : BaseActivity(), VipView, View.OnClickListener,
timer!!.setOnCountDownTimerListener(object : OnCountDownTimerListener { timer!!.setOnCountDownTimerListener(object : OnCountDownTimerListener {
override fun onTick(millisUntilFinished: Long) { override fun onTick(millisUntilFinished: Long) {
if (!isFinishing) { if (!isFinishing) {
if(millisUntilFinished==4000L){ if (millisUntilFinished == 4000L) {
vipPresenter.getMyInfo() vipPresenter.getMyInfo()
} }
} }
......
...@@ -42,6 +42,7 @@ class VipPayCancelDialog( ...@@ -42,6 +42,7 @@ class VipPayCancelDialog(
dismiss() dismiss()
} }
tv_cancel_cash.text="${cash}元" tv_cancel_cash.text="${cash}元"
tv_cancel_coupon.text="赠送${cash}元体验券"
listener.setDialog(this) listener.setDialog(this)
findViewById<View>(R.id.btn).setOnClickListener(listener) findViewById<View>(R.id.btn).setOnClickListener(listener)
......
...@@ -43,6 +43,15 @@ ...@@ -43,6 +43,15 @@
android:layout_marginTop="193dp" android:layout_marginTop="193dp"
android:textColor="@color/tv_message_recente_money" android:textColor="@color/tv_message_recente_money"
android:layout_height="wrap_content"></TextView> android:layout_height="wrap_content"></TextView>
<TextView
android:id="@+id/tv_count_down"
android:layout_width="wrap_content"
android:textSize="18dp"
android:text="-"
android:layout_gravity="center_horizontal"
android:layout_marginTop="272dp"
android:textColor="@color/gray"
android:layout_height="wrap_content"></TextView>
</FrameLayout> </FrameLayout>
...@@ -57,12 +66,14 @@ ...@@ -57,12 +66,14 @@
app:layout_constraintTop_toTopOf="@+id/guideline3" /> app:layout_constraintTop_toTopOf="@+id/guideline3" />
<TextView <TextView
android:id="@+id/tv_count_down" android:id="@+id/tv_cancel_coupon"
android:layout_width="160dp" android:layout_width="160dp"
android:layout_height="36dp" android:layout_height="36dp"
android:background="@drawable/shape_linear_yellow" android:background="@drawable/shape_linear_yellow"
android:gravity="center" android:gravity="center"
android:textColor="@color/color_FD7E0E" android:text="赠送-元体验券"
android:textSize="18sp"
android:textColor="@color/red"
app:layout_constraintBottom_toTopOf="@id/guideline2" app:layout_constraintBottom_toTopOf="@id/guideline2"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
...@@ -80,7 +91,7 @@ ...@@ -80,7 +91,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintGuide_begin="314dp" /> app:layout_constraintGuide_begin="334dp" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
......
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