跳转处理
This commit is contained in:
parent
b9afc0fa14
commit
6cd007e6d4
|
|
@ -36,7 +36,6 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
|
|
||||||
private val viewModel: WithdrawViewModel by viewModels()
|
private val viewModel: WithdrawViewModel by viewModels()
|
||||||
private val mItemViewList: MutableList<WithDrawItemView> = mutableListOf()
|
private val mItemViewList: MutableList<WithDrawItemView> = mutableListOf()
|
||||||
private var mCurSelectedIndex: Int = 0
|
|
||||||
private val mRecordList: MutableList<WithdrawRecord> by lazy {
|
private val mRecordList: MutableList<WithdrawRecord> by lazy {
|
||||||
SpUtil.instance().getList<WithdrawRecord>(SpUtil.KEY_WITHDRAW_HISTORY_LIST).toMutableList()
|
SpUtil.instance().getList<WithdrawRecord>(SpUtil.KEY_WITHDRAW_HISTORY_LIST).toMutableList()
|
||||||
}
|
}
|
||||||
|
|
@ -60,41 +59,39 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
|
|
||||||
withdraw01.setNumAndAction(0, 0.1F,
|
withdraw01.setNumAndAction(0, 0.1F,
|
||||||
{ itemIndex->
|
{ itemIndex->
|
||||||
updateUIItemSelectStates(itemIndex)
|
handleGotoWithdraw(itemIndex)
|
||||||
})
|
})
|
||||||
|
|
||||||
withdraw10.setNumAndAction(1, 10F,
|
withdraw10.setNumAndAction(1, 10F,
|
||||||
{ itemIndex->
|
{ itemIndex->
|
||||||
updateUIItemSelectStates(itemIndex)
|
handleGotoWithdraw(itemIndex)
|
||||||
})
|
})
|
||||||
|
|
||||||
withdraw20.setNumAndAction(2, 20F,
|
withdraw20.setNumAndAction(2, 20F,
|
||||||
{ itemIndex->
|
{ itemIndex->
|
||||||
updateUIItemSelectStates(itemIndex)
|
handleGotoWithdraw(itemIndex)
|
||||||
})
|
})
|
||||||
|
|
||||||
withdraw50.setNumAndAction(3, 50F,
|
withdraw50.setNumAndAction(3, 50F,
|
||||||
{ itemIndex->
|
{ itemIndex->
|
||||||
updateUIItemSelectStates(itemIndex)
|
handleGotoWithdraw(itemIndex)
|
||||||
})
|
})
|
||||||
|
|
||||||
withdraw100.setNumAndAction(4, 100F,
|
withdraw100.setNumAndAction(4, 100F,
|
||||||
{ itemIndex->
|
{ itemIndex->
|
||||||
updateUIItemSelectStates(itemIndex)
|
handleGotoWithdraw(itemIndex)
|
||||||
})
|
})
|
||||||
|
|
||||||
withdraw300.setNumAndAction(5, 300F,
|
withdraw300.setNumAndAction(5, 300F,
|
||||||
{ itemIndex->
|
{ itemIndex->
|
||||||
updateUIItemSelectStates(itemIndex)
|
handleGotoWithdraw(itemIndex)
|
||||||
})
|
})
|
||||||
|
|
||||||
withdrawPix2.setIconAndText(R.mipmap.pix2_big, R.string.pix2, {
|
withdrawPix2.setIconAndText(R.mipmap.pix2_big, R.string.pix2, {
|
||||||
|
WithdrawBindBankDialog(this@WithDrawActivity).setWithDrawCashNum(0F).show()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
withdrawPix2.setSelectedState(true)
|
||||||
//withdrawPix2.setSelectedState(true)
|
|
||||||
updateUIItemSelectStates(0)
|
|
||||||
|
|
||||||
setOnClickBatch(withdrawRecord) {
|
setOnClickBatch(withdrawRecord) {
|
||||||
when(this) {
|
when(this) {
|
||||||
|
|
@ -107,19 +104,13 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
||||||
updateUICashTotal()
|
updateUICashTotal()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateUIItemSelectStates(itemIndex: Int) {
|
|
||||||
mCurSelectedIndex = itemIndex
|
|
||||||
mItemViewList.forEachIndexed { index, view ->
|
|
||||||
//view.setSelectedState(index == mCurSelectedIndex)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun handleGotoWithdraw() {
|
private fun handleGotoWithdraw(itemIndex: Int) {
|
||||||
if (mItemViewList.get(mCurSelectedIndex).getCashNum() > 1F) {
|
if (mItemViewList.get(itemIndex).getCashNum() > 1F) {
|
||||||
gotoWithdrawSubActivity(mCurSelectedIndex)
|
gotoWithdrawSubActivity(itemIndex)
|
||||||
} else {
|
} else {
|
||||||
val hasBindBank = AccountManager.hasValidBankInfo()
|
val hasBindBank = AccountManager.hasValidBankInfo()
|
||||||
val cashNum = mItemViewList.get(mCurSelectedIndex).getCashNum()
|
val cashNum = mItemViewList.get(itemIndex).getCashNum()
|
||||||
if (!hasBindBank) {
|
if (!hasBindBank) {
|
||||||
WithdrawBindBankDialog(this@WithDrawActivity).setWithDrawCashNum(cashNum).show()
|
WithdrawBindBankDialog(this@WithDrawActivity).setWithDrawCashNum(cashNum).show()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import android.app.Activity
|
||||||
import android.text.Editable
|
import android.text.Editable
|
||||||
import android.text.TextWatcher
|
import android.text.TextWatcher
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
|
import com.ama.core.architecture.util.ResUtil
|
||||||
import com.ama.core.architecture.util.setOnClickBatch
|
import com.ama.core.architecture.util.setOnClickBatch
|
||||||
import com.ama.core.architecture.widget.BindingDialog
|
import com.ama.core.architecture.widget.BindingDialog
|
||||||
import com.vididin.real.money.game.R
|
import com.vididin.real.money.game.R
|
||||||
|
|
@ -38,7 +39,10 @@ class WithdrawBindBankDialog(activity: Activity) : BindingDialog<ViewBinding>(ac
|
||||||
|
|
||||||
tvConfirm -> {
|
tvConfirm -> {
|
||||||
saveBankAccount(mBinding.tvCpfEdit.text.toString().trim())
|
saveBankAccount(mBinding.tvCpfEdit.text.toString().trim())
|
||||||
WithdrawInfoConfirmDialog(mActivity).setWithDrawCashNum(mWithdrawCashNum).show()
|
if (mWithdrawCashNum > 0F) {
|
||||||
|
WithdrawInfoConfirmDialog(mActivity).setWithDrawCashNum(mWithdrawCashNum).show()
|
||||||
|
}
|
||||||
|
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -102,6 +106,10 @@ class WithdrawBindBankDialog(activity: Activity) : BindingDialog<ViewBinding>(ac
|
||||||
|
|
||||||
fun setWithDrawCashNum(withdrawNum: Float): WithdrawBindBankDialog {
|
fun setWithDrawCashNum(withdrawNum: Float): WithdrawBindBankDialog {
|
||||||
mWithdrawCashNum = withdrawNum
|
mWithdrawCashNum = withdrawNum
|
||||||
|
|
||||||
|
if (mWithdrawCashNum == 0F) {
|
||||||
|
mBinding.tvConfirm.text = ResUtil.getString(R.string.confirm)
|
||||||
|
}
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class WithDrawItemBankView @JvmOverloads constructor(
|
||||||
/**
|
/**
|
||||||
* For withdraw number in top area
|
* For withdraw number in top area
|
||||||
*/
|
*/
|
||||||
fun setNumAndAction(itemIndex: Int, clickAction: (Int)->Unit) {
|
fun setAction(itemIndex: Int, clickAction: (Int)->Unit) {
|
||||||
mItemIndex = itemIndex
|
mItemIndex = itemIndex
|
||||||
mBinding.root.setOnClickListener {
|
mBinding.root.setOnClickListener {
|
||||||
clickAction.invoke(mItemIndex)
|
clickAction.invoke(mItemIndex)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import com.ama.core.architecture.util.ResUtil
|
|
||||||
import com.vididin.real.money.game.databinding.WithdrawItemViewBinding as ViewBinding
|
import com.vididin.real.money.game.databinding.WithdrawItemViewBinding as ViewBinding
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -30,24 +29,12 @@ class WithDrawItemView @JvmOverloads constructor(
|
||||||
mItemIndex = itemIndex
|
mItemIndex = itemIndex
|
||||||
mCashNum = cashNum
|
mCashNum = cashNum
|
||||||
mBinding.tvWithdrawNum.text = cashNum.toString()
|
mBinding.tvWithdrawNum.text = cashNum.toString()
|
||||||
mBinding.root.setOnClickListener {
|
mBinding.tvSacar.setOnClickListener {
|
||||||
clickAction.invoke(mItemIndex)
|
clickAction.invoke(mItemIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For bank item in bottom area
|
|
||||||
*/
|
|
||||||
fun setIconAndText(iconRes: Int, textRes: Int, clickAction: ()->Unit) {
|
|
||||||
mBinding.tvWithdrawNum.text = ResUtil.getString(textRes)
|
|
||||||
mBinding.ivItemIcon.setImageResource(iconRes)
|
|
||||||
mBinding.root.setOnClickListener {
|
|
||||||
clickAction.invoke()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fun getCashNum(): Float {
|
fun getCashNum(): Float {
|
||||||
return mCashNum
|
return mCashNum
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="15dp"
|
android:layout_marginHorizontal="15dp"
|
||||||
android:layout_marginBottom="15dp"
|
android:layout_marginBottom="15dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.gamedog.vididin.features.withdraw.widget.WithDrawItemView
|
<com.gamedog.vididin.features.withdraw.widget.WithDrawItemView
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue