Commit 643ac9ac authored by mengcuiguang2's avatar mengcuiguang2

代码优化

parent 8c4bb2a7
...@@ -27,6 +27,7 @@ class DrawProgressActivity : BaseActivity(), View.OnClickListener { ...@@ -27,6 +27,7 @@ class DrawProgressActivity : BaseActivity(), View.OnClickListener {
private var progress = 0 private var progress = 0
private var max = 0 private var max = 0
private var tempAdProgress = 0 private var tempAdProgress = 0
private var showProgress = 0
private var carrierType = "" private var carrierType = ""
override fun getContentViewLayoutID() = R.layout.activity_draw_progress override fun getContentViewLayoutID() = R.layout.activity_draw_progress
...@@ -49,9 +50,7 @@ class DrawProgressActivity : BaseActivity(), View.OnClickListener { ...@@ -49,9 +50,7 @@ class DrawProgressActivity : BaseActivity(), View.OnClickListener {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
if (tempAdProgress >= max) {
finish()
}
} }
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
...@@ -63,12 +62,27 @@ class DrawProgressActivity : BaseActivity(), View.OnClickListener { ...@@ -63,12 +62,27 @@ class DrawProgressActivity : BaseActivity(), View.OnClickListener {
.setForegroundColor(context.resources.getColor(R.color.color_F44E0D)) .setForegroundColor(context.resources.getColor(R.color.color_F44E0D))
.create() .create()
tv_draw_progress_title.text = SpanUtils() showProgress=progress
.append("还有任务")
.setForegroundColor(context.resources.getColor(R.color.black)) if (showProgress >= max) {
.append("未完成") tv_draw_progress_ad.text="去提现"
.setForegroundColor(context.resources.getColor(R.color.color_F44E0D)) tv_draw_progress_title.text = SpanUtils()
.create() .append("任务")
.setForegroundColor(context.resources.getColor(R.color.black))
.append("已完成")
.setForegroundColor(context.resources.getColor(R.color.color_F44E0D))
.create()
}else{
tv_draw_progress_ad.text="去完成"
tv_draw_progress_title.text = SpanUtils()
.append("还有任务")
.setForegroundColor(context.resources.getColor(R.color.black))
.append("未完成")
.setForegroundColor(context.resources.getColor(R.color.color_F44E0D))
.create()
}
pb_draw_progress.progress = progress pb_draw_progress.progress = progress
pb_draw_progress.max = max pb_draw_progress.max = max
initListener() initListener()
...@@ -104,7 +118,13 @@ class DrawProgressActivity : BaseActivity(), View.OnClickListener { ...@@ -104,7 +118,13 @@ class DrawProgressActivity : BaseActivity(), View.OnClickListener {
finish() finish()
} }
R.id.tv_draw_progress_ad -> { R.id.tv_draw_progress_ad -> {
showAd(carrierType) if (showProgress >= max) {
finish()
}else{
showAd(carrierType)
}
} }
} }
} }
...@@ -157,7 +177,7 @@ class DrawProgressActivity : BaseActivity(), View.OnClickListener { ...@@ -157,7 +177,7 @@ class DrawProgressActivity : BaseActivity(), View.OnClickListener {
Handler(Looper.getMainLooper()).postDelayed({ Handler(Looper.getMainLooper()).postDelayed({
if (isFinishing) return@postDelayed if (isFinishing) return@postDelayed
val showProgress = progress + tempAdProgress showProgress = progress + tempAdProgress
pb_draw_progress.progress = showProgress pb_draw_progress.progress = showProgress
pb_draw_progress.max = max pb_draw_progress.max = max
...@@ -168,6 +188,27 @@ class DrawProgressActivity : BaseActivity(), View.OnClickListener { ...@@ -168,6 +188,27 @@ class DrawProgressActivity : BaseActivity(), View.OnClickListener {
.append("/${max}") .append("/${max}")
.setForegroundColor(context.resources.getColor(R.color.color_F44E0D)) .setForegroundColor(context.resources.getColor(R.color.color_F44E0D))
.create() .create()
if (showProgress >= max) {
tv_draw_progress_ad.text="去提现"
tv_draw_progress_title.text = SpanUtils()
.append("任务")
.setForegroundColor(context.resources.getColor(R.color.black))
.append("已完成")
.setForegroundColor(context.resources.getColor(R.color.color_F44E0D))
.create()
}else{
tv_draw_progress_ad.text="去完成"
tv_draw_progress_title.text = SpanUtils()
.append("还有任务")
.setForegroundColor(context.resources.getColor(R.color.black))
.append("未完成")
.setForegroundColor(context.resources.getColor(R.color.color_F44E0D))
.create()
}
}, 300) }, 300)
} }
} }
\ No newline at end of file
...@@ -220,6 +220,12 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O ...@@ -220,6 +220,12 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O
//发起提现 //发起提现
TrackManager.getInstance().addCashoutReq(currentDrawInfo?.unitId) TrackManager.getInstance().addCashoutReq(currentDrawInfo?.unitId)
showToast("发起提现成功") showToast("发起提现成功")
Handler(Looper.getMainLooper()).postDelayed({
if(!isAdded) return@postDelayed
(requireActivity() as MainActivity).dismissDrawDialog()
}, 800)
} }
} }
11 -> { 11 -> {
...@@ -254,9 +260,13 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O ...@@ -254,9 +260,13 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O
) )
} }
bundle.putInt(DrawProgressActivity.PROGRESS, it.taskNeedComplete) bundle.putInt(DrawProgressActivity.PROGRESS, it.taskNeedComplete)
bundle.putInt(DrawProgressActivity.MAX, it.taskComplete) // bundle.putInt(DrawProgressActivity.MAX, it.taskComplete)
bundle.putInt(DrawProgressActivity.MAX, 4)
readyGo(DrawProgressActivity::class.java, bundle) readyGo(DrawProgressActivity::class.java, bundle)
} }
else -> {
}
} }
} }
...@@ -313,6 +323,10 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O ...@@ -313,6 +323,10 @@ class DrawCashFragment : LazyLoadBaseFragment(), DrawCashView, DrawCashAdapter.O
if(!isAdded) return@postDelayed if(!isAdded) return@postDelayed
showToast("发起提现成功") showToast("发起提现成功")
Handler(Looper.getMainLooper()).postDelayed({
if(!isAdded) return@postDelayed
(requireActivity() as MainActivity).dismissDrawDialog()
}, 800)
}, 1000) }, 1000)
} }
Constant.CARRIERTYPE_REWARD_COIN -> { Constant.CARRIERTYPE_REWARD_COIN -> {
......
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