Commit d9f50969 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent ccc34aaf
...@@ -10,6 +10,7 @@ public class DrawcashBean implements Serializable { ...@@ -10,6 +10,7 @@ public class DrawcashBean implements Serializable {
private String drawcashRule; private String drawcashRule;
private String drawcashHint; private String drawcashHint;
private int coin; private int coin;
private double maxCashout;
private int vedioComplete; private int vedioComplete;
private String remark; private String remark;
private List<CashOutMoneyArrBean> cashOutMoneyArr; private List<CashOutMoneyArrBean> cashOutMoneyArr;
...@@ -35,6 +36,10 @@ public class DrawcashBean implements Serializable { ...@@ -35,6 +36,10 @@ public class DrawcashBean implements Serializable {
return drawcashHint; return drawcashHint;
} }
public double getMaxCashout() {
return maxCashout;
}
public int getCoin() { public int getCoin() {
return coin; return coin;
} }
......
...@@ -205,15 +205,11 @@ public class DrawcashPresenter extends BasePresenter<DrawcashView> { ...@@ -205,15 +205,11 @@ public class DrawcashPresenter extends BasePresenter<DrawcashView> {
if (isLinkView()) return; if (isLinkView()) return;
int code = baseResponse.getStatus(); int code = baseResponse.getStatus();
String message = baseResponse.getMessage(); view.showToast(baseResponse.getMessage());
switch (code) { switch (code) {
case 200://成功 case 200://成功
view.showToast("提现成功");
getUserTaskMsg(); getUserTaskMsg();
break; break;
default:
view.showToast(message);
break;
} }
} }
}); });
......
...@@ -45,19 +45,19 @@ class DrawcashActivity : BaseActivity(), ...@@ -45,19 +45,19 @@ class DrawcashActivity : BaseActivity(),
private val TAG = DrawcashActivity::class.java.simpleName private val TAG = DrawcashActivity::class.java.simpleName
private var drawcashVideoDialog: DrawcashVideoDialog? = null
private lateinit var vedioAdingManager: VedioAdingManager
private val drawcashPresenter by lazy { DrawcashPresenter() } private val drawcashPresenter by lazy { DrawcashPresenter() }
private lateinit var drawcashAdapter: DrawcashAdapter
private val userManager by lazy { UserManager.getInstance() } private val userManager by lazy { UserManager.getInstance() }
private val loginApi by lazy { LoginApi() } private val loginApi by lazy { LoginApi() }
private lateinit var drawcashAdapter: DrawcashAdapter
private var priceList: MutableList<DrawcashBean.CashOutMoneyArrBean>? = null private var priceList: MutableList<DrawcashBean.CashOutMoneyArrBean>? = null
private var wxInfo: WXInfo? = null private var wxInfo: WXInfo? = null
private var userConfig: DrawcashBean? = null private var userConfig: DrawcashBean? = null
private var drawcashVideoDialog: DrawcashVideoDialog? = null
private var isLoadRvItem: Boolean = true //是否首次加载rv item private var isLoadRvItem: Boolean = true //是否首次加载rv item
private lateinit var vedioAdingManager: VedioAdingManager
override fun getContentViewLayoutID() = R.layout.activity_drawcash override fun getContentViewLayoutID() = R.layout.activity_drawcash
...@@ -86,6 +86,8 @@ class DrawcashActivity : BaseActivity(), ...@@ -86,6 +86,8 @@ class DrawcashActivity : BaseActivity(),
super.onDestroy() super.onDestroy()
loginApi.setOnLoginListener(null) loginApi.setOnLoginListener(null)
drawcashVideoDialog?.setOnClickListener(null)
drawcashVideoDialog?.onDestory()
drawcashPresenter.detachView() drawcashPresenter.detachView()
} }
...@@ -150,10 +152,16 @@ class DrawcashActivity : BaseActivity(), ...@@ -150,10 +152,16 @@ class DrawcashActivity : BaseActivity(),
return return
} }
// 可提金额
if (priceList!![drawcashAdapter.getPosition()].money > userConfig?.maxCashout!!) {
showToast("请先提现${userConfig?.maxCashout}元")
return
}
val curCount = userConfig?.vedioComplete!! val curCount = userConfig?.vedioComplete!!
val sumCount = priceList!![drawcashAdapter.getPosition()].vedio val sumCount = priceList!![drawcashAdapter.getPosition()].vedio
if (curCount >= sumCount) { if (curCount >= sumCount) {
drawcashPresenter.saveTerminalInfo(priceList!![drawcashAdapter?.getPosition()].money) drawcashPresenter.saveTerminalInfo(priceList!![drawcashAdapter.getPosition()].money)
} else { } else {
drawcashVideoDialog(curCount, sumCount) drawcashVideoDialog(curCount, sumCount)
} }
...@@ -175,25 +183,27 @@ class DrawcashActivity : BaseActivity(), ...@@ -175,25 +183,27 @@ class DrawcashActivity : BaseActivity(),
tvDrawcashName.setText(data.nickName) tvDrawcashName.setText(data.nickName)
} }
if (isLoadRvItem) { // 提现更改权重
priceList = data.cashOutMoneyArr
initRvView()
}
val allcoinBig = BigDecimal(data.coin.toString())
val rateBig = BigDecimal("10000")
val cashStr: String = allcoinBig.divide(rateBig).setScale(2, BigDecimal.ROUND_DOWN).toString()
tvDrawcashGoldabout.setText("约" + cashStr + "元")
initAdWeight(data.vedioRules) initAdWeight(data.vedioRules)
// 修改提现弹窗内容
if (drawcashVideoDialog != null && drawcashVideoDialog!!.isShowing) { if (drawcashVideoDialog != null && drawcashVideoDialog!!.isShowing) {
drawcashVideoDialog?.setContent("观看视频并下载后立即提现(${data.vedioComplete}/${data.cashOutMoneyArr[drawcashAdapter.getPosition()].vedio})") drawcashVideoDialog?.setContent("观看视频并点击下载后立即提现(${data.vedioComplete}/${data.cashOutMoneyArr[drawcashAdapter.getPosition()].vedio})")
if (data.vedioComplete >= data.cashOutMoneyArr[drawcashAdapter.getPosition()].vedio) { if (data.vedioComplete >= data.cashOutMoneyArr[drawcashAdapter.getPosition()].vedio) {
drawcashVideoDialog?.setBtnText("去提现") drawcashVideoDialog?.setBtnText("去提现")
} else { } else {
drawcashVideoDialog?.setBtnText("去观看") drawcashVideoDialog?.setBtnText("去观看")
} }
} }
if (isLoadRvItem) {
priceList = data.cashOutMoneyArr
initRvView()
}
val allcoinBig = BigDecimal(data.coin.toString())
val rateBig = BigDecimal("10000")
val cashStr: String = allcoinBig.divide(rateBig).setScale(2, BigDecimal.ROUND_DOWN).toString()
tvDrawcashGoldabout.setText("约" + cashStr + "元")
} }
override fun editUserMsgSuc() { override fun editUserMsgSuc() {
...@@ -233,27 +243,6 @@ class DrawcashActivity : BaseActivity(), ...@@ -233,27 +243,6 @@ class DrawcashActivity : BaseActivity(),
return false return false
} }
private fun initText() {
tvDrawcashExplain.setText(
SpanUtils()
.append("提现说明:")
.append("\n")
.append("1、所有提现金额【无门槛】直接提现!新用户提现秒到账!")
.append("\n")
.append("2、由于提现需要实名制,非实名用户账号无法支持提现,请务必使用实名认证过的账号提现!")
.append("\n")
.append("3、单笔提现金额最低" + 0.3 + "元,最高" + 1000 + "元。")
.append("\n")
.append("4、提现申请将在3-5个工作日审核到账,请耐心等待。")
.append("\n")
.append("5、每日可申请提现一次,若当日限额已满,请次日申请。")
.create())
tvDrawcashHint.text = "* 如您或好友通过刷机等违规操作获取非法收益,平台将视情况扣除违规所得或冻结账号。" +
"\n* 最终解释权归本公司所有。"
}
private fun initRvView() { private fun initRvView() {
val gridLayoutManager = GridLayoutManager(this, 3) val gridLayoutManager = GridLayoutManager(this, 3)
rvCash.layoutManager = gridLayoutManager rvCash.layoutManager = gridLayoutManager
...@@ -295,19 +284,21 @@ class DrawcashActivity : BaseActivity(), ...@@ -295,19 +284,21 @@ class DrawcashActivity : BaseActivity(),
if (drawcashVideoDialog == null) { if (drawcashVideoDialog == null) {
drawcashVideoDialog = DrawcashVideoDialog(this) drawcashVideoDialog = DrawcashVideoDialog(this)
} }
if (sumCount == 1) { drawcashVideoDialog?.let {
drawcashVideoDialog?.setContent("观看视频并下载后可立即提现") if (sumCount == 1) {
} else { it.setContent("观看视频并点击下载后可立即提现")
drawcashVideoDialog?.setContent("观看视频并下载后可立即提现(${curCount}/${sumCount})") } else {
} it.setContent("观看视频并点击下载后可立即提现(${curCount}/${sumCount})")
drawcashVideoDialog?.setOnClickListener(object : DrawcashVideoDialog.OnClickListener {
override fun onClick() {
if (priceList != null && priceList!!.size > 0) {
drawcashPresenter.saveTerminalInfo(priceList!![drawcashAdapter?.getPosition()].money)
}
} }
it.setOnClickListener(object : DrawcashVideoDialog.OnClickListener {
override fun onClick() {
if (priceList != null && priceList!!.size > 0) {
drawcashPresenter.saveTerminalInfo(priceList!![drawcashAdapter.getPosition()].money)
}
}
})
it.show()
}
})
drawcashVideoDialog?.show()
} }
} }
\ No newline at end of file
...@@ -49,9 +49,7 @@ class DrawcashVideoDialog(activity: Activity) : ...@@ -49,9 +49,7 @@ class DrawcashVideoDialog(activity: Activity) :
this.activity = activity this.activity = activity
} }
override fun dismiss() { fun onDestory(){
super.dismiss()
vedioAdingManager?.setVedioAdingListener(null) vedioAdingManager?.setVedioAdingListener(null)
vedioAdingManager?.onDestory() vedioAdingManager?.onDestory()
...@@ -139,7 +137,7 @@ class DrawcashVideoDialog(activity: Activity) : ...@@ -139,7 +137,7 @@ class DrawcashVideoDialog(activity: Activity) :
fun onClick() fun onClick()
} }
fun setOnClickListener(onClickListener: OnClickListener) { fun setOnClickListener(onClickListener: OnClickListener?) {
this.onClickListener = onClickListener this.onClickListener = onClickListener
} }
} }
\ No newline at end of file
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