跳转处理

This commit is contained in:
renhaoting 2025-12-12 16:51:21 +08:00
parent b9afc0fa14
commit 6cd007e6d4
5 changed files with 24 additions and 37 deletions

View File

@ -36,7 +36,6 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
private val viewModel: WithdrawViewModel by viewModels()
private val mItemViewList: MutableList<WithDrawItemView> = mutableListOf()
private var mCurSelectedIndex: Int = 0
private val mRecordList: MutableList<WithdrawRecord> by lazy {
SpUtil.instance().getList<WithdrawRecord>(SpUtil.KEY_WITHDRAW_HISTORY_LIST).toMutableList()
}
@ -60,41 +59,39 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
withdraw01.setNumAndAction(0, 0.1F,
{ itemIndex->
updateUIItemSelectStates(itemIndex)
handleGotoWithdraw(itemIndex)
})
withdraw10.setNumAndAction(1, 10F,
{ itemIndex->
updateUIItemSelectStates(itemIndex)
handleGotoWithdraw(itemIndex)
})
withdraw20.setNumAndAction(2, 20F,
{ itemIndex->
updateUIItemSelectStates(itemIndex)
handleGotoWithdraw(itemIndex)
})
withdraw50.setNumAndAction(3, 50F,
{ itemIndex->
updateUIItemSelectStates(itemIndex)
handleGotoWithdraw(itemIndex)
})
withdraw100.setNumAndAction(4, 100F,
{ itemIndex->
updateUIItemSelectStates(itemIndex)
handleGotoWithdraw(itemIndex)
})
withdraw300.setNumAndAction(5, 300F,
{ itemIndex->
updateUIItemSelectStates(itemIndex)
handleGotoWithdraw(itemIndex)
})
withdrawPix2.setIconAndText(R.mipmap.pix2_big, R.string.pix2, {
WithdrawBindBankDialog(this@WithDrawActivity).setWithDrawCashNum(0F).show()
})
//withdrawPix2.setSelectedState(true)
updateUIItemSelectStates(0)
withdrawPix2.setSelectedState(true)
setOnClickBatch(withdrawRecord) {
when(this) {
@ -107,19 +104,13 @@ class WithDrawActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
updateUICashTotal()
}
private fun updateUIItemSelectStates(itemIndex: Int) {
mCurSelectedIndex = itemIndex
mItemViewList.forEachIndexed { index, view ->
//view.setSelectedState(index == mCurSelectedIndex)
}
}
private fun handleGotoWithdraw() {
if (mItemViewList.get(mCurSelectedIndex).getCashNum() > 1F) {
gotoWithdrawSubActivity(mCurSelectedIndex)
private fun handleGotoWithdraw(itemIndex: Int) {
if (mItemViewList.get(itemIndex).getCashNum() > 1F) {
gotoWithdrawSubActivity(itemIndex)
} else {
val hasBindBank = AccountManager.hasValidBankInfo()
val cashNum = mItemViewList.get(mCurSelectedIndex).getCashNum()
val cashNum = mItemViewList.get(itemIndex).getCashNum()
if (!hasBindBank) {
WithdrawBindBankDialog(this@WithDrawActivity).setWithDrawCashNum(cashNum).show()
} else {

View File

@ -6,6 +6,7 @@ import android.app.Activity
import android.text.Editable
import android.text.TextWatcher
import androidx.core.view.isVisible
import com.ama.core.architecture.util.ResUtil
import com.ama.core.architecture.util.setOnClickBatch
import com.ama.core.architecture.widget.BindingDialog
import com.vididin.real.money.game.R
@ -38,7 +39,10 @@ class WithdrawBindBankDialog(activity: Activity) : BindingDialog<ViewBinding>(ac
tvConfirm -> {
saveBankAccount(mBinding.tvCpfEdit.text.toString().trim())
if (mWithdrawCashNum > 0F) {
WithdrawInfoConfirmDialog(mActivity).setWithDrawCashNum(mWithdrawCashNum).show()
}
dismiss()
}
}
@ -102,6 +106,10 @@ class WithdrawBindBankDialog(activity: Activity) : BindingDialog<ViewBinding>(ac
fun setWithDrawCashNum(withdrawNum: Float): WithdrawBindBankDialog {
mWithdrawCashNum = withdrawNum
if (mWithdrawCashNum == 0F) {
mBinding.tvConfirm.text = ResUtil.getString(R.string.confirm)
}
return this
}

View File

@ -27,7 +27,7 @@ class WithDrawItemBankView @JvmOverloads constructor(
/**
* For withdraw number in top area
*/
fun setNumAndAction(itemIndex: Int, clickAction: (Int)->Unit) {
fun setAction(itemIndex: Int, clickAction: (Int)->Unit) {
mItemIndex = itemIndex
mBinding.root.setOnClickListener {
clickAction.invoke(mItemIndex)

View File

@ -4,7 +4,6 @@ import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
import com.ama.core.architecture.util.ResUtil
import com.vididin.real.money.game.databinding.WithdrawItemViewBinding as ViewBinding
@ -30,24 +29,12 @@ class WithDrawItemView @JvmOverloads constructor(
mItemIndex = itemIndex
mCashNum = cashNum
mBinding.tvWithdrawNum.text = cashNum.toString()
mBinding.root.setOnClickListener {
mBinding.tvSacar.setOnClickListener {
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 {
return mCashNum
}

View File

@ -161,6 +161,7 @@
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"
android:layout_marginBottom="15dp"
android:layout_marginTop="10dp"
android:orientation="vertical">
<com.gamedog.vididin.features.withdraw.widget.WithDrawItemView