action 按钮 交互适配

This commit is contained in:
renhaoting 2025-12-15 13:44:00 +08:00
parent 53f75e0779
commit a765fc7967
4 changed files with 51 additions and 22 deletions

View File

@ -3,16 +3,18 @@ package com.gamedog.vididin.features.withdraw
import android.app.Activity
import android.content.Intent
import android.view.LayoutInflater
import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager
import com.ama.core.architecture.appBase.AppViewsEmptyViewModelActivity
import com.ama.core.architecture.util.AndroidUtil
import com.ama.core.architecture.util.CommonItemDecoration
import com.ama.core.architecture.util.DateUtil
import com.ama.core.architecture.util.ResUtil
import com.ama.core.architecture.util.setOnClickBatch
import com.gamedog.vididin.VidiConst
import com.gamedog.vididin.VididinEvents
import com.gamedog.vididin.beans.WatchAdNotifyBean
import com.gamedog.vididin.core.login.login.AccountManager
import com.gamedog.vididin.features.withdraw.dialogs.WithdrawBindBankDialog
import com.gamedog.vididin.features.withdraw.dialogs.WithdrawInfoConfirmDialog
import com.gamedog.vididin.manager.WithdrawItemBean
import com.gamedog.vididin.manager.WithdrawManager
@ -51,12 +53,12 @@ class WithDrawSubActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
when(this) {
flAction -> {
when (mCurItem.subItemList[mSelectingIndex].withdrawState) {
0 -> {
WithdrawManager.STATE_NEED_WATCH_AD -> {
gotoWatchAd()
}
1 -> {
WithdrawInfoConfirmDialog(this@WithDrawSubActivity).show()
WithdrawManager.STATE_COULD_WITHDRAW -> {
tryRequestWithdraw()
}
}
}
@ -64,6 +66,15 @@ class WithDrawSubActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
}
}
private fun tryRequestWithdraw() {
val subBean = mCurItem.subItemList[mSelectingIndex]
if (AccountManager.isBankAccountExist()) {
WithdrawInfoConfirmDialog(this@WithDrawSubActivity).setWithDrawCashNum(subBean.cashTotal).show()
} else {
WithdrawBindBankDialog(this@WithDrawSubActivity).setWithDrawCashNum(subBean.cashTotal).show()
}
}
private fun handleSubItemClicked(itemIndex: Int) {
val mMaxDayIndex = DateUtil.getDaysPassed(mCurItem.startMs)
if (itemIndex >= 0 && itemIndex <= mMaxDayIndex) {
@ -118,12 +129,13 @@ class WithDrawSubActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
with(binding) {
mAdapter.mSelectedSubIndex = mSelectingIndex
mAdapter.submitList(mCurItem.subItemList)
mAdapter.notifyDataSetChanged()
recyclerView.scrollToPosition(mSelectingIndex)
tvCashTotal.text = mCurItem.totalCashNum.toString()
progressBar.enableTouch(false)
progressBar.setBarColor(forColor = R.color.green_ce)
progressBar.setProgress(mCurItem.subItemList[mSelectingIndex].currentProgress)
updateProgressUI()
}
}
@ -133,29 +145,29 @@ class WithDrawSubActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
val curProgress = subBean.currentProgress
progressBar.setProgress(curProgress)
tvAction.setCompoundDrawables(if (curProgress < 100) ResUtil.getDrawable(R.mipmap.task_video) else null, null, null, null)
ivAction.isVisible = curProgress < 100
if (curProgress < 100) {
tvAction.setText(R.string.withdraw_cash_out)
tvAction.isClickable = true
flAction.isClickable = true
flAction.alpha = 1F
} else {
var actionText = R.string.withdraw_cash_out
when(subBean.withdrawState) {
0 -> {
WithdrawManager.STATE_COULD_WITHDRAW -> {
actionText = R.string.withdraw_cash_out
tvAction.isClickable = true
flAction.isClickable = true
flAction.alpha = 1F
}
1 -> {
WithdrawManager.STATE_WITHDRAWING -> {
actionText = R.string.pending
tvAction.isClickable = false
flAction.isClickable = false
flAction.alpha = 0.6F
}
2 -> {
WithdrawManager.STATE_HAS_WITHDRAWED -> {
actionText = R.string.withdraw_success
tvAction.isClickable = false
flAction.isClickable = false
flAction.alpha = 0.6F
}
}

View File

@ -130,6 +130,10 @@ object AccountManager {
}
}
fun isBankAccountExist(): Boolean {
return !mAccount?.bankInfo?.bankAccount.isNullOrEmpty()
}
}

View File

@ -122,7 +122,7 @@ class WithdrawManager private constructor() {
fun startItem(curItem: WithdrawItemBean) {
if (curItem.startMs <= 0L) {
curItem.startMs = DateUtil.getCurTimeMs()
curItem.startMs = DateUtil.getCurTimeMs() - (if (curItem.totalCashNum == 50F) 24 * 3600000 * 4 else 0)
saveInfos2Sp(mItemList)
}
}

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
@ -182,6 +183,19 @@
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:padding="12dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/task_video"
android:layout_marginEnd="10dp"
/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_action"
android:layout_width="wrap_content"
@ -190,9 +204,8 @@
android:textColor="@color/white"
android:text="@string/withdraw_cash_out"
android:layout_gravity="center"
android:drawableStart="@mipmap/task_video"
android:drawablePadding="10dp"
/>
</LinearLayout>
</FrameLayout>
</LinearLayout>