重构record bean对象,应用到 adapater
This commit is contained in:
parent
3a3a7c10bd
commit
05f9af12de
|
|
@ -1,15 +1,68 @@
|
|||
package com.gamedog.vididin.beans
|
||||
|
||||
data class RecordCash(
|
||||
val id: Long,
|
||||
val dateTime: Long,
|
||||
val status: TransactionStatus,
|
||||
val statusText: String,
|
||||
val description: String,
|
||||
val amount: String,
|
||||
)
|
||||
import com.vididin.real.money.game.R
|
||||
|
||||
|
||||
enum class TransactionStatus {
|
||||
SUCCESS, FAILED, PROCESSING, REDEEM
|
||||
// Record 类型
|
||||
const val RECORD_CASH_PLUS_GOLD_CONVERT: Int = 1
|
||||
const val RECORD_CASH_PLUS_NEWBIE_GIFT: Int = 2
|
||||
const val RECORD_CASH_PLUS_BOX_TASK: Int = 3
|
||||
const val RECORD_CASH_MINUS_WITHDRAW_SMALL: Int = 4
|
||||
const val RECORD_CASH_MINUS_WITHDRAW_BIG: Int = 5
|
||||
|
||||
open class RecordCash {
|
||||
var uuid: String = ""
|
||||
var dateMs: Long = 0L
|
||||
var isSuccess: Boolean = false
|
||||
var amountNum: Double = 0.0
|
||||
var recordType: Int = 0
|
||||
}
|
||||
|
||||
class RecordCashShow: RecordCash() {
|
||||
var title: Int = 0
|
||||
var description: Int = 0
|
||||
var iconRes: Int = 0
|
||||
}
|
||||
|
||||
|
||||
fun RecordCash.toShowBean(): RecordCashShow {
|
||||
return RecordCashShow().apply {
|
||||
this@apply.uuid = this@toShowBean.uuid
|
||||
this@apply.dateMs = this@toShowBean.dateMs
|
||||
this@apply.isSuccess = this@toShowBean.isSuccess
|
||||
this@apply.amountNum = this@toShowBean.amountNum
|
||||
this@apply.recordType = this@toShowBean.recordType
|
||||
|
||||
when (this@apply.recordType) {
|
||||
RECORD_CASH_PLUS_GOLD_CONVERT -> {
|
||||
title = R.string.apply
|
||||
description = R.string.apply
|
||||
iconRes = R.mipmap.icon_ad
|
||||
}
|
||||
|
||||
RECORD_CASH_PLUS_NEWBIE_GIFT -> {
|
||||
title = R.string.apply
|
||||
description = R.string.apply
|
||||
iconRes = R.mipmap.icon_ad
|
||||
}
|
||||
|
||||
RECORD_CASH_PLUS_BOX_TASK -> {
|
||||
title = R.string.apply
|
||||
description = R.string.apply
|
||||
iconRes = R.mipmap.icon_ad
|
||||
}
|
||||
|
||||
RECORD_CASH_MINUS_WITHDRAW_SMALL -> {
|
||||
title = R.string.apply
|
||||
description = R.string.apply
|
||||
iconRes = R.mipmap.icon_ad
|
||||
}
|
||||
|
||||
RECORD_CASH_MINUS_WITHDRAW_BIG -> {
|
||||
title = R.string.apply
|
||||
description = R.string.apply
|
||||
iconRes = R.mipmap.icon_ad
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,77 @@
|
|||
package com.gamedog.vididin.beans
|
||||
|
||||
data class RecordGold(
|
||||
val id: Long,
|
||||
val dateTime: Long,
|
||||
val status: TransactionStatus,
|
||||
val statusText: String,
|
||||
val description: String,
|
||||
val amount: String,
|
||||
)
|
||||
|
||||
import com.vididin.real.money.game.R
|
||||
import kotlin.Int
|
||||
|
||||
const val RECORD_GOLD_PLUS_WATCH_VIDEO: Int = 1
|
||||
const val RECORD_GOLD_PLUS_WATCH_REWARD_AD: Int = 2
|
||||
const val RECORD_GOLD_PLUS_TASK_NEWBIE: Int = 3
|
||||
const val RECORD_GOLD_PLUS_TASK_DAILY: Int = 3
|
||||
const val RECORD_GOLD_PLUS_TASK_BOX: Int = 3
|
||||
const val RECORD_GOLD_MINUS_CONVERT_2_CASH: Int = 4
|
||||
|
||||
|
||||
|
||||
open class RecordGold {
|
||||
var uuid: String = ""
|
||||
var dateMs: Long = 0L
|
||||
var isSuccess: Boolean = false
|
||||
var amountNum: Int = 0
|
||||
var recordType: Int = 0
|
||||
}
|
||||
|
||||
class RecordGoldShow: RecordGold() {
|
||||
var title: Int = 0
|
||||
var description: Int = 0
|
||||
var iconRes: Int = 0
|
||||
}
|
||||
|
||||
|
||||
fun RecordGold.toShowBean(): RecordGoldShow {
|
||||
return RecordGoldShow().apply {
|
||||
this@apply.uuid = this@toShowBean.uuid
|
||||
this@apply.dateMs = this@toShowBean.dateMs
|
||||
this@apply.isSuccess = this@toShowBean.isSuccess
|
||||
this@apply.amountNum = this@toShowBean.amountNum
|
||||
this@apply.recordType = this@toShowBean.recordType
|
||||
|
||||
when (this@apply.recordType) {
|
||||
RECORD_GOLD_PLUS_WATCH_VIDEO -> {
|
||||
title = R.string.apply
|
||||
description = R.string.apply
|
||||
iconRes = R.mipmap.icon_ad
|
||||
}
|
||||
|
||||
RECORD_GOLD_PLUS_WATCH_REWARD_AD -> {
|
||||
title = R.string.apply
|
||||
description = R.string.apply
|
||||
iconRes = R.mipmap.icon_ad
|
||||
}
|
||||
|
||||
RECORD_GOLD_PLUS_TASK_NEWBIE -> {
|
||||
title = R.string.apply
|
||||
description = R.string.apply
|
||||
iconRes = R.mipmap.icon_ad
|
||||
}
|
||||
|
||||
RECORD_GOLD_PLUS_TASK_DAILY -> {
|
||||
title = R.string.apply
|
||||
description = R.string.apply
|
||||
iconRes = R.mipmap.icon_ad
|
||||
}
|
||||
|
||||
RECORD_GOLD_PLUS_TASK_BOX -> {
|
||||
title = R.string.apply
|
||||
description = R.string.apply
|
||||
iconRes = R.mipmap.icon_ad
|
||||
}
|
||||
|
||||
RECORD_GOLD_MINUS_CONVERT_2_CASH -> {
|
||||
title = R.string.apply
|
||||
description = R.string.apply
|
||||
iconRes = R.mipmap.icon_ad
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,61 @@
|
|||
package com.gamedog.vididin.beans
|
||||
|
||||
data class RecordZero(
|
||||
val id: Long,
|
||||
val dateTime: Long,
|
||||
val status: TransactionStatus,
|
||||
val statusText: String,
|
||||
val description: String,
|
||||
val amount: String,
|
||||
)
|
||||
import com.vididin.real.money.game.R
|
||||
|
||||
|
||||
open class RecordZero {
|
||||
var uuid: String = ""
|
||||
var dateMs: Long = 0L
|
||||
var isSuccess: Boolean = false
|
||||
var amountNum: Double = 0.0
|
||||
var recordType: Int = 0
|
||||
}
|
||||
|
||||
class RecordZeroShow: RecordZero() {
|
||||
var title: Int = 0
|
||||
var description: Int = 0
|
||||
var iconRes: Int = 0
|
||||
}
|
||||
|
||||
|
||||
fun RecordZero.toShowBean(): RecordZeroShow {
|
||||
return RecordZeroShow().apply {
|
||||
this@apply.uuid = this@toShowBean.uuid
|
||||
this@apply.dateMs = this@toShowBean.dateMs
|
||||
this@apply.isSuccess = this@toShowBean.isSuccess
|
||||
this@apply.amountNum = this@toShowBean.amountNum
|
||||
this@apply.recordType = this@toShowBean.recordType
|
||||
|
||||
when (this@apply.recordType) {
|
||||
RECORD_CASH_PLUS_GOLD_CONVERT -> {
|
||||
title = R.string.apply
|
||||
description = R.string.apply
|
||||
iconRes = R.mipmap.icon_ad
|
||||
}
|
||||
|
||||
RECORD_CASH_PLUS_NEWBIE_GIFT -> {
|
||||
title = R.string.apply
|
||||
description = R.string.apply
|
||||
iconRes = R.mipmap.icon_ad
|
||||
}
|
||||
|
||||
RECORD_CASH_PLUS_BOX_TASK -> {
|
||||
title = R.string.apply
|
||||
description = R.string.apply
|
||||
iconRes = R.mipmap.icon_ad
|
||||
}
|
||||
|
||||
RECORD_CASH_MINUS_WITHDRAW_SMALL -> {
|
||||
title = R.string.apply
|
||||
description = R.string.apply
|
||||
iconRes = R.mipmap.icon_ad
|
||||
}
|
||||
|
||||
RECORD_CASH_MINUS_WITHDRAW_BIG -> {
|
||||
title = R.string.apply
|
||||
description = R.string.apply
|
||||
iconRes = R.mipmap.icon_ad
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,15 +2,16 @@ package com.gamedog.vididin.features.withdrawrecord
|
|||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gamedog.vididin.beans.RecordCash
|
||||
import com.ama.core.architecture.util.ResUtil
|
||||
import com.gamedog.vididin.beans.RecordCashShow
|
||||
import com.vididin.real.money.game.R
|
||||
import java.text.SimpleDateFormat
|
||||
import com.vididin.real.money.game.databinding.FragmentWithdrawRecordCashItemBinding as ViewBinding
|
||||
|
||||
class RecordCashRvAdapter : ListAdapter<RecordCash, RecordCashRvAdapter.ViewHolder>(DiffCallback()) {
|
||||
class RecordCashRvAdapter : ListAdapter<RecordCashShow, RecordCashRvAdapter.ViewHolder>(DiffCallback()) {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val binding = ViewBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
|
|
@ -22,22 +23,23 @@ class RecordCashRvAdapter : ListAdapter<RecordCash, RecordCashRvAdapter.ViewHold
|
|||
}
|
||||
|
||||
inner class ViewHolder(private val binding: ViewBinding) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(transaction: RecordCash) {
|
||||
binding.tvDate.text = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(transaction.dateTime)
|
||||
binding.tvTitle.text = transaction.statusText
|
||||
binding.tvDescription.text = transaction.description
|
||||
binding.tvAmount.text = transaction.amount
|
||||
binding.tvAmount.setTextColor(ContextCompat.getColor(binding.root.context, transaction.amountColor))
|
||||
fun bind(data: RecordCashShow) {
|
||||
binding.tvDate.text = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(data.dateMs)
|
||||
binding.tvTitle.text = ResUtil.getString(data.title)
|
||||
binding.tvDescription.text = ResUtil.getString(data.description)
|
||||
binding.tvAmount.text = data.amountNum.toString()
|
||||
binding.ivType.setImageResource(data.iconRes)
|
||||
binding.tvAmount.setTextColor(ResUtil.getColor(if (data.isSuccess) R.color.md_theme_error else R.color.green_39))
|
||||
}
|
||||
}
|
||||
|
||||
class DiffCallback : DiffUtil.ItemCallback<RecordCash>() {
|
||||
override fun areItemsTheSame(oldItem: RecordCash, newItem: RecordCash): Boolean {
|
||||
return oldItem.id == newItem.id
|
||||
class DiffCallback : DiffUtil.ItemCallback<RecordCashShow>() {
|
||||
override fun areItemsTheSame(oldItem: RecordCashShow, newItem: RecordCashShow): Boolean {
|
||||
return oldItem.uuid == newItem.uuid
|
||||
}
|
||||
|
||||
override fun areContentsTheSame(oldItem: RecordCash, newItem: RecordCash): Boolean {
|
||||
return oldItem == newItem
|
||||
override fun areContentsTheSame(oldItem: RecordCashShow, newItem: RecordCashShow): Boolean {
|
||||
return oldItem.uuid == newItem.uuid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,15 +2,16 @@ package com.gamedog.vididin.features.withdrawrecord
|
|||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gamedog.vididin.beans.RecordGold
|
||||
import com.ama.core.architecture.util.ResUtil
|
||||
import com.gamedog.vididin.beans.RecordGoldShow
|
||||
import com.vididin.real.money.game.R
|
||||
import java.text.SimpleDateFormat
|
||||
import com.vididin.real.money.game.databinding.FragmentWithdrawRecordGoldItemBinding as ViewBinding
|
||||
|
||||
class RecordGoldRvAdapter : ListAdapter<RecordGold, RecordGoldRvAdapter.ViewHolder>(DiffCallback()) {
|
||||
class RecordGoldRvAdapter : ListAdapter<RecordGoldShow, RecordGoldRvAdapter.ViewHolder>(DiffCallback()) {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val binding = ViewBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
|
|
@ -22,22 +23,23 @@ class RecordGoldRvAdapter : ListAdapter<RecordGold, RecordGoldRvAdapter.ViewHold
|
|||
}
|
||||
|
||||
inner class ViewHolder(private val binding: ViewBinding) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(transaction: RecordGold) {
|
||||
binding.tvDate.text = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(transaction.dateTime)
|
||||
binding.tvTitle.text = transaction.statusText
|
||||
binding.tvDescription.text = transaction.description
|
||||
binding.tvAmount.text = transaction.amount
|
||||
binding.tvAmount.setTextColor(ContextCompat.getColor(binding.root.context, transaction.amountColor))
|
||||
fun bind(data: RecordGoldShow) {
|
||||
binding.tvDate.text = SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(data.dateMs)
|
||||
binding.tvTitle.text = ResUtil.getString(data.title)
|
||||
binding.tvDescription.text = ResUtil.getString(data.description)
|
||||
binding.tvAmount.text = data.amountNum.toString()
|
||||
binding.ivType.setImageResource(data.iconRes)
|
||||
binding.tvAmount.setTextColor(ResUtil.getColor(if (data.isSuccess) R.color.md_theme_error else R.color.green_39))
|
||||
}
|
||||
}
|
||||
|
||||
class DiffCallback : DiffUtil.ItemCallback<RecordGold>() {
|
||||
override fun areItemsTheSame(oldItem: RecordGold, newItem: RecordGold): Boolean {
|
||||
return oldItem.id == newItem.id
|
||||
class DiffCallback : DiffUtil.ItemCallback<RecordGoldShow>() {
|
||||
override fun areItemsTheSame(oldItem: RecordGoldShow, newItem: RecordGoldShow): Boolean {
|
||||
return oldItem.uuid == newItem.uuid
|
||||
}
|
||||
|
||||
override fun areContentsTheSame(oldItem: RecordGold, newItem: RecordGold): Boolean {
|
||||
return oldItem == newItem
|
||||
override fun areContentsTheSame(oldItem: RecordGoldShow, newItem: RecordGoldShow): Boolean {
|
||||
return oldItem.uuid == newItem.uuid
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,15 +5,17 @@ package com.gamedog.vididin.features.withdrawrecord.fragments
|
|||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.ama.core.architecture.appBase.AppViewsFragment
|
||||
import com.ama.core.architecture.appBase.OnFragmentBackgroundListener
|
||||
import com.ama.core.architecture.util.setStatusBarDarkFont
|
||||
import com.vididin.real.money.game.R
|
||||
import com.gamedog.vididin.beans.RecordCash
|
||||
import com.gamedog.vididin.beans.TransactionStatus
|
||||
import com.gamedog.vididin.features.withdrawrecord.RecordCashRvAdapter
|
||||
import com.gamedog.vididin.manager.RecordsManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.getValue
|
||||
import com.vididin.real.money.game.databinding.FragmentWithdrawRecordCashBinding as ViewBinding
|
||||
import com.gamedog.vididin.features.withdrawrecord.RecordCashUiState as UiState
|
||||
|
|
@ -69,47 +71,9 @@ class CashRecordFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(),
|
|||
binding?.recyclerView?.adapter = mAdapter
|
||||
binding?.recyclerView?.layoutManager = LinearLayoutManager(requireContext())
|
||||
|
||||
// 模拟数据
|
||||
val transactions = listOf(
|
||||
RecordCash(
|
||||
id = 1,
|
||||
dateTime = "2025/10/31 17:30",
|
||||
status = TransactionStatus.SUCCESS,
|
||||
statusText = "Sucesso",
|
||||
description = "Você solicitou o saque com sucesso!",
|
||||
amount = "-R$ 0,1",
|
||||
amountColor = R.color.red_11
|
||||
),
|
||||
RecordCash(
|
||||
id = 2,
|
||||
dateTime = "2025/10/31 17:30",
|
||||
status = TransactionStatus.FAILED,
|
||||
statusText = "Falhou",
|
||||
description = "Você solicitou o saque com sucesso!",
|
||||
amount = "-R$ 0,0",
|
||||
amountColor = R.color.red_11
|
||||
),
|
||||
RecordCash(
|
||||
id = 3,
|
||||
dateTime = "2025/10/31 17:30",
|
||||
status = TransactionStatus.PROCESSING,
|
||||
statusText = "Em processamento...",
|
||||
description = "Você solicitou o saque com sucesso!",
|
||||
amount = "-R$ 10,0",
|
||||
amountColor = R.color.red_11
|
||||
),
|
||||
RecordCash(
|
||||
id = 4,
|
||||
dateTime = "2025/10/31 17:30",
|
||||
status = TransactionStatus.REDEEM,
|
||||
statusText = "Resgatar",
|
||||
description = "Você resgatou 4980 moedas",
|
||||
amount = "+R$ 10,0",
|
||||
amountColor = R.color.green_39
|
||||
)
|
||||
)
|
||||
|
||||
mAdapter.submitList(transactions)
|
||||
lifecycleScope.launch {
|
||||
mAdapter.submitList(RecordsManager.instance().getCashRecords())
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
|||
|
|
@ -5,16 +5,17 @@ package com.gamedog.vididin.features.withdrawrecord.fragments
|
|||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.ama.core.architecture.appBase.AppViewsFragment
|
||||
import com.ama.core.architecture.appBase.OnFragmentBackgroundListener
|
||||
import com.ama.core.architecture.util.setStatusBarDarkFont
|
||||
import com.vididin.real.money.game.R
|
||||
import com.gamedog.vididin.beans.RecordGold
|
||||
import com.gamedog.vididin.beans.TransactionStatus
|
||||
import com.gamedog.vididin.features.withdrawrecord.RecordCashRvAdapter
|
||||
import com.gamedog.vididin.features.withdrawrecord.RecordGoldRvAdapter
|
||||
import com.gamedog.vididin.manager.RecordsManager
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.getValue
|
||||
import com.vididin.real.money.game.databinding.FragmentWithdrawRecordGoldBinding as ViewBinding
|
||||
import com.gamedog.vididin.features.withdrawrecord.RecordGoldUiState as UiState
|
||||
|
|
@ -70,47 +71,9 @@ class GoldRecordFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(),
|
|||
binding?.recyclerView?.adapter = mAdapter
|
||||
binding?.recyclerView?.layoutManager = LinearLayoutManager(requireContext())
|
||||
|
||||
// 模拟数据
|
||||
val transactions = listOf(
|
||||
RecordGold(
|
||||
id = 1,
|
||||
dateTime = "2025/10/31 17:30",
|
||||
status = TransactionStatus.SUCCESS,
|
||||
statusText = "Sucesso",
|
||||
description = "Você solicitou o saque com sucesso!",
|
||||
amount = "-R$ 0,1",
|
||||
amountColor = R.color.red_11
|
||||
),
|
||||
RecordGold(
|
||||
id = 2,
|
||||
dateTime = "2025/10/31 17:30",
|
||||
status = TransactionStatus.FAILED,
|
||||
statusText = "Falhou",
|
||||
description = "Você solicitou o saque com sucesso!",
|
||||
amount = "-R$ 0,0",
|
||||
amountColor = R.color.red_11
|
||||
),
|
||||
RecordGold(
|
||||
id = 3,
|
||||
dateTime = "2025/10/31 17:30",
|
||||
status = TransactionStatus.PROCESSING,
|
||||
statusText = "Em processamento...",
|
||||
description = "Você solicitou o saque com sucesso!",
|
||||
amount = "-R$ 10,0",
|
||||
amountColor = R.color.red_11
|
||||
),
|
||||
RecordGold(
|
||||
id = 4,
|
||||
dateTime = "2025/10/31 17:30",
|
||||
status = TransactionStatus.REDEEM,
|
||||
statusText = "Resgatar",
|
||||
description = "Você resgatou 4980 moedas",
|
||||
amount = "+R$ 10,0",
|
||||
amountColor = R.color.green_39
|
||||
)
|
||||
)
|
||||
|
||||
mAdapter.submitList(transactions)
|
||||
lifecycleScope.launch {
|
||||
mAdapter.submitList(RecordsManager.instance().getGoldRecords())
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
|||
|
|
@ -2,8 +2,12 @@ package com.gamedog.vididin.manager
|
|||
|
||||
import com.ama.core.architecture.util.SpUtil
|
||||
import com.gamedog.vididin.beans.RecordCash
|
||||
import com.gamedog.vididin.beans.RecordCashShow
|
||||
import com.gamedog.vididin.beans.RecordGold
|
||||
import com.gamedog.vididin.beans.RecordGoldShow
|
||||
import com.gamedog.vididin.beans.RecordZero
|
||||
import com.gamedog.vididin.beans.RecordZeroShow
|
||||
import com.gamedog.vididin.beans.toShowBean
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
|
|
@ -42,16 +46,31 @@ class RecordsManager private constructor() {
|
|||
mZeroHelper.addRecord(newRecord)
|
||||
}
|
||||
|
||||
fun getCashRecords() : List<RecordCash> {
|
||||
return mCashHelper.getRecordList()
|
||||
fun getCashRecords() : List<RecordCashShow> {
|
||||
val resultList = mutableListOf<RecordCashShow>()
|
||||
val dataList = mCashHelper.getRecordList()
|
||||
dataList.forEach {
|
||||
resultList.add(it.toShowBean())
|
||||
}
|
||||
return resultList.toList()
|
||||
}
|
||||
|
||||
fun getGoldRecords() : List<RecordGold> {
|
||||
return mGoldHelper.getRecordList()
|
||||
fun getGoldRecords() : List<RecordGoldShow> {
|
||||
val resultList = mutableListOf<RecordGoldShow>()
|
||||
val dataList = mGoldHelper.getRecordList()
|
||||
dataList.forEach {
|
||||
resultList.add(it.toShowBean())
|
||||
}
|
||||
return resultList.toList()
|
||||
}
|
||||
|
||||
fun getZeroRecords() : List<RecordZero> {
|
||||
return mZeroHelper.getRecordList()
|
||||
fun getZeroRecords() : List<RecordZeroShow> {
|
||||
val resultList = mutableListOf<RecordZeroShow>()
|
||||
val dataList = mZeroHelper.getRecordList()
|
||||
dataList.forEach {
|
||||
resultList.add(it.toShowBean())
|
||||
}
|
||||
return resultList.toList()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -65,15 +84,6 @@ class CashRecordHelper() : BaseRecordHelper<RecordCash>() {
|
|||
override suspend fun loadRecordsFromSp(): List<RecordCash> {
|
||||
return SpUtil.instance().getList<RecordCash>(mSpKey)
|
||||
}
|
||||
|
||||
companion object {
|
||||
// Record 类型
|
||||
const val RECORD_CASH_PLUS_GOLD_CONVERT: Int = 1
|
||||
const val RECORD_CASH_PLUS_NEWBIE_GIFT: Int = 2
|
||||
const val RECORD_CASH_PLUS_BOX_TASK: Int = 3
|
||||
const val RECORD_CASH_MINUS_WITHDRAW_SMALL: Int = 4
|
||||
const val RECORD_CASH_MINUS_WITHDRAW_BIG: Int = 5
|
||||
}
|
||||
}
|
||||
|
||||
class GoldRecordHelper() : BaseRecordHelper<RecordGold>() {
|
||||
|
|
@ -81,16 +91,6 @@ class GoldRecordHelper() : BaseRecordHelper<RecordGold>() {
|
|||
override suspend fun loadRecordsFromSp(): List<RecordGold> {
|
||||
return SpUtil.instance().getList<RecordGold>(mSpKey)
|
||||
}
|
||||
|
||||
companion object {
|
||||
// Record 类型
|
||||
const val RECORD_GOLD_PLUS_WATCH_VIDEO: Int = 1
|
||||
const val RECORD_GOLD_PLUS_WATCH_REWARD_AD: Int = 2
|
||||
const val RECORD_GOLD_PLUS_TASK_NEWBIE: Int = 3
|
||||
const val RECORD_GOLD_PLUS_TASK_DAILY: Int = 3
|
||||
const val RECORD_GOLD_PLUS_TASK_BOX: Int = 3
|
||||
const val RECORD_GOLD_MINUS_CONVERT_2_CASH: Int = 4
|
||||
}
|
||||
}
|
||||
|
||||
class ZeroRecordHelper() : BaseRecordHelper<RecordZero>() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue