Commit 643ac9ac authored by mengcuiguang2's avatar mengcuiguang2

代码优化

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