颜色复制

This commit is contained in:
renhaoting 2025-12-25 11:40:51 +08:00
parent 727321ad70
commit adfa6bca79
4 changed files with 12 additions and 6 deletions

View File

@ -25,6 +25,7 @@ class RecordCashShow: RecordCash() {
var title: Int = 0 var title: Int = 0
var description: Int = 0 var description: Int = 0
var iconRes: Int = 0 var iconRes: Int = 0
var textColor: Int = R.color.green_39
} }
@ -41,30 +42,35 @@ fun RecordCash.toShowBean(): RecordCashShow {
title = R.string.record_cash_title_convert_from_gold title = R.string.record_cash_title_convert_from_gold
description = R.string.record_cash_descr_convert_from_gold description = R.string.record_cash_descr_convert_from_gold
iconRes = R.mipmap.task_gold iconRes = R.mipmap.task_gold
textColor = R.color.green_39
} }
RECORD_CASH_PLUS_BOX_TASK -> { RECORD_CASH_PLUS_BOX_TASK -> {
title = R.string.record_cash_title_box title = R.string.record_cash_title_box
description = R.string.record_cash_descr_box description = R.string.record_cash_descr_box
iconRes = R.mipmap.icon_gift iconRes = R.mipmap.icon_gift
textColor = R.color.green_39
} }
RECORD_CASH_PLUS_WITHDRAW_ONGOING -> { RECORD_CASH_PLUS_WITHDRAW_ONGOING -> {
title = R.string.record_cash_title_withdraw_ongoing title = R.string.record_cash_title_withdraw_ongoing
description = R.string.record_cash_descr_withdraw_onging description = R.string.record_cash_descr_withdraw_onging
iconRes = R.mipmap.icon_fail iconRes = R.mipmap.icon_convert_cash
textColor = R.color.red_28
} }
RECORD_CASH_PLUS_WITHDRAW_FAIL -> { RECORD_CASH_PLUS_WITHDRAW_FAIL -> {
title = R.string.record_cash_title_withdraw_failed title = R.string.record_cash_title_withdraw_failed
description = R.string.record_cash_descr_withdraw_failed_3 description = R.string.record_cash_descr_withdraw_failed_3
iconRes = R.mipmap.icon_ad iconRes = R.mipmap.icon_fail
textColor = R.color.gray3
} }
RECORD_CASH_MINUS_WITHDRAW_SUCCESS -> { RECORD_CASH_MINUS_WITHDRAW_SUCCESS -> {
title = R.string.record_cash_title_withdraw_success title = R.string.record_cash_title_withdraw_success
description = R.string.record_cash_descr_withdraw_success description = R.string.record_cash_descr_withdraw_success
iconRes = R.mipmap.icon_check iconRes = R.mipmap.icon_check
textColor = R.color.green_39
} }
} }

View File

@ -28,9 +28,10 @@ class RecordCashRvAdapter : ListAdapter<RecordCashShow, RecordCashRvAdapter.View
binding.tvDate.text = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(data.dateMs) binding.tvDate.text = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(data.dateMs)
binding.tvTitle.text = ResUtil.getString(data.title) binding.tvTitle.text = ResUtil.getString(data.title)
binding.tvDescription.text = ResUtil.getString(data.description) binding.tvDescription.text = ResUtil.getString(data.description)
binding.tvAmount.text = (if (data.amountNum < 0) "-" else "") + ResUtil.getString(R.string.cash) + " " + String.format("%.2f", Math.abs(data.amountNum))
binding.ivType.setImageResource(data.iconRes) binding.ivType.setImageResource(data.iconRes)
binding.tvAmount.setTextColor(ResUtil.getColor(if (data.isSuccess) R.color.md_theme_error else R.color.green_39))
binding.tvAmount.text = (if (data.amountNum < 0) "-" else "") + ResUtil.getString(R.string.cash) + " " + String.format("%.2f", Math.abs(data.amountNum))
binding.tvAmount.setTextColor(ResUtil.getColor(data.textColor))
} }
} }

View File

@ -7,7 +7,6 @@ import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.ama.core.architecture.util.ResUtil import com.ama.core.architecture.util.ResUtil
import com.gamedog.vididin.beans.RecordGoldShow import com.gamedog.vididin.beans.RecordGoldShow
import com.vididin.real.money.game.R
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import com.vididin.real.money.game.databinding.FragmentWithdrawRecordGoldItemBinding as ViewBinding import com.vididin.real.money.game.databinding.FragmentWithdrawRecordGoldItemBinding as ViewBinding
@ -29,7 +28,6 @@ class RecordGoldRvAdapter : ListAdapter<RecordGoldShow, RecordGoldRvAdapter.View
binding.tvDescription.text = ResUtil.getString(data.description) binding.tvDescription.text = ResUtil.getString(data.description)
binding.tvAmount.text = data.amountNum.toString() binding.tvAmount.text = data.amountNum.toString()
binding.ivType.setImageResource(data.iconRes) binding.ivType.setImageResource(data.iconRes)
binding.tvAmount.setTextColor(ResUtil.getColor(if (data.isSuccess) R.color.md_theme_error else R.color.green_39))
} }
} }

View File

@ -54,6 +54,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:drawableStart="@mipmap/task_gold"
android:text="-R$ 0,1" android:text="-R$ 0,1"
android:textSize="15sp" android:textSize="15sp"
android:textStyle="bold" android:textStyle="bold"