记录UI 调整优化
This commit is contained in:
parent
09d74032a9
commit
6dd6502c5a
|
|
@ -1,6 +1,6 @@
|
||||||
package com.gamedog.vididin.beans
|
package com.gamedog.vididin.beans
|
||||||
|
|
||||||
data class Transaction(
|
data class RecordCash(
|
||||||
val id: Long,
|
val id: Long,
|
||||||
val dateTime: String,
|
val dateTime: String,
|
||||||
val status: TransactionStatus,
|
val status: TransactionStatus,
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.gamedog.vididin.beans
|
||||||
|
|
||||||
|
data class RecordGold(
|
||||||
|
val id: Long,
|
||||||
|
val dateTime: String,
|
||||||
|
val status: TransactionStatus,
|
||||||
|
val statusText: String,
|
||||||
|
val description: String,
|
||||||
|
val amount: String,
|
||||||
|
val amountColor: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
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.gamedog.vididin.beans.TransactionStatus
|
||||||
|
import com.gamedog.vididin.databinding.FragmentWithdrawRecordCashItemBinding as ViewBinding
|
||||||
|
|
||||||
|
class RecordCashRvAdapter : ListAdapter<RecordCash, RecordCashRvAdapter.ViewHolder>(DiffCallback()) {
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
|
val binding = ViewBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||||
|
return ViewHolder(binding)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
|
holder.bind(getItem(position))
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class ViewHolder(private val binding: ViewBinding) : RecyclerView.ViewHolder(binding.root) {
|
||||||
|
fun bind(transaction: RecordCash) {
|
||||||
|
binding.tvDate.text = transaction.dateTime
|
||||||
|
binding.tvStatus.text = transaction.statusText
|
||||||
|
binding.tvDescription.text = transaction.description
|
||||||
|
binding.tvAmount.text = transaction.amount
|
||||||
|
binding.tvAmount.setTextColor(ContextCompat.getColor(binding.root.context, transaction.amountColor))
|
||||||
|
|
||||||
|
// 设置状态图标
|
||||||
|
binding.tvStatusIcon.text = when (transaction.status) {
|
||||||
|
TransactionStatus.SUCCESS -> "✔"
|
||||||
|
TransactionStatus.FAILED -> "!"
|
||||||
|
TransactionStatus.PROCESSING -> "⟳"
|
||||||
|
TransactionStatus.REDEEM -> "↗"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DiffCallback : DiffUtil.ItemCallback<RecordCash>() {
|
||||||
|
override fun areItemsTheSame(oldItem: RecordCash, newItem: RecordCash): Boolean {
|
||||||
|
return oldItem.id == newItem.id
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun areContentsTheSame(oldItem: RecordCash, newItem: RecordCash): Boolean {
|
||||||
|
return oldItem == newItem
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.gamedog.vididin.features.withdrawrecord
|
||||||
|
|
||||||
|
|
||||||
|
import com.ama.core.architecture.appBase.vm.AppViewModel
|
||||||
|
import com.gamedog.vididin.beans.RecordCash
|
||||||
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import kotlinx.coroutines.flow.flowOf
|
||||||
|
import javax.inject.Inject
|
||||||
|
import com.gamedog.vididin.features.withdrawrecord.RecordCashUiState as UiState
|
||||||
|
|
||||||
|
|
||||||
|
@HiltViewModel
|
||||||
|
class RecordCashViewModel @Inject constructor() : AppViewModel<UiState>() {
|
||||||
|
override val uiStateInitialValue: UiState = UiState()
|
||||||
|
override val uiStateFlow: Flow<UiState> = flowOf()
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
data class RecordCashUiState(
|
||||||
|
val mRecordList: MutableList<RecordCash> = mutableListOf()
|
||||||
|
)
|
||||||
|
|
@ -6,14 +6,14 @@ import androidx.core.content.ContextCompat
|
||||||
import androidx.recyclerview.widget.DiffUtil
|
import androidx.recyclerview.widget.DiffUtil
|
||||||
import androidx.recyclerview.widget.ListAdapter
|
import androidx.recyclerview.widget.ListAdapter
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.gamedog.vididin.beans.Transaction
|
import com.gamedog.vididin.beans.RecordGold
|
||||||
import com.gamedog.vididin.beans.TransactionStatus
|
import com.gamedog.vididin.beans.TransactionStatus
|
||||||
import com.gamedog.vididin.databinding.FragmentWithdrawRecordGoldItemBinding
|
import com.gamedog.vididin.databinding.FragmentWithdrawRecordGoldItemBinding as ViewBinding
|
||||||
|
|
||||||
class TransactionAdapter : ListAdapter<Transaction, TransactionAdapter.ViewHolder>(DiffCallback()) {
|
class RecordGoldRvAdapter : ListAdapter<RecordGold, RecordGoldRvAdapter.ViewHolder>(DiffCallback()) {
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
val binding = FragmentWithdrawRecordGoldItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
val binding = ViewBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||||
return ViewHolder(binding)
|
return ViewHolder(binding)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -21,8 +21,8 @@ class TransactionAdapter : ListAdapter<Transaction, TransactionAdapter.ViewHolde
|
||||||
holder.bind(getItem(position))
|
holder.bind(getItem(position))
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class ViewHolder(private val binding: FragmentWithdrawRecordGoldItemBinding) : RecyclerView.ViewHolder(binding.root) {
|
inner class ViewHolder(private val binding: ViewBinding) : RecyclerView.ViewHolder(binding.root) {
|
||||||
fun bind(transaction: Transaction) {
|
fun bind(transaction: RecordGold) {
|
||||||
binding.tvDate.text = transaction.dateTime
|
binding.tvDate.text = transaction.dateTime
|
||||||
binding.tvStatus.text = transaction.statusText
|
binding.tvStatus.text = transaction.statusText
|
||||||
binding.tvDescription.text = transaction.description
|
binding.tvDescription.text = transaction.description
|
||||||
|
|
@ -39,12 +39,12 @@ class TransactionAdapter : ListAdapter<Transaction, TransactionAdapter.ViewHolde
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DiffCallback : DiffUtil.ItemCallback<Transaction>() {
|
class DiffCallback : DiffUtil.ItemCallback<RecordGold>() {
|
||||||
override fun areItemsTheSame(oldItem: Transaction, newItem: Transaction): Boolean {
|
override fun areItemsTheSame(oldItem: RecordGold, newItem: RecordGold): Boolean {
|
||||||
return oldItem.id == newItem.id
|
return oldItem.id == newItem.id
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun areContentsTheSame(oldItem: Transaction, newItem: Transaction): Boolean {
|
override fun areContentsTheSame(oldItem: RecordGold, newItem: RecordGold): Boolean {
|
||||||
return oldItem == newItem
|
return oldItem == newItem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.gamedog.vididin.features.withdrawrecord
|
||||||
|
|
||||||
|
|
||||||
|
import com.ama.core.architecture.appBase.vm.AppViewModel
|
||||||
|
import com.gamedog.vididin.beans.RecordGold
|
||||||
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import kotlinx.coroutines.flow.flowOf
|
||||||
|
import javax.inject.Inject
|
||||||
|
import com.gamedog.vididin.features.withdrawrecord.RecordGoldUiState as UiState
|
||||||
|
|
||||||
|
|
||||||
|
@HiltViewModel
|
||||||
|
class RecordGoldViewModel @Inject constructor() : AppViewModel<UiState>() {
|
||||||
|
override val uiStateInitialValue: UiState = UiState()
|
||||||
|
override val uiStateFlow: Flow<UiState> = flowOf()
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
data class RecordGoldUiState(
|
||||||
|
val mRecordList: MutableList<RecordGold> = mutableListOf()
|
||||||
|
)
|
||||||
|
|
@ -3,7 +3,8 @@ package com.gamedog.vididin.features.withdrawrecord
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||||
import com.gamedog.vididin.features.withdrawrecord.fragments.DinheiroFragment
|
import com.gamedog.vididin.features.withdrawrecord.fragments.CashRecordFragment
|
||||||
|
import com.gamedog.vididin.features.withdrawrecord.fragments.GoldRecordFragment
|
||||||
|
|
||||||
class ViewPagerAdapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) {
|
class ViewPagerAdapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) {
|
||||||
|
|
||||||
|
|
@ -11,8 +12,8 @@ class ViewPagerAdapter(fragmentActivity: FragmentActivity) : FragmentStateAdapte
|
||||||
|
|
||||||
override fun createFragment(position: Int): Fragment {
|
override fun createFragment(position: Int): Fragment {
|
||||||
return when (position) {
|
return when (position) {
|
||||||
0 -> DinheiroFragment()
|
0 -> CashRecordFragment()
|
||||||
1 -> DinheiroFragment() // 创建类似的Fragment
|
1 -> GoldRecordFragment()
|
||||||
else -> throw IllegalArgumentException("Invalid position: $position")
|
else -> throw IllegalArgumentException("Invalid position: $position")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,10 @@ import androidx.core.view.ViewCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import androidx.core.view.updatePadding
|
import androidx.core.view.updatePadding
|
||||||
import com.ama.core.architecture.appBase.AppViewsActivity
|
import com.ama.core.architecture.appBase.AppViewsActivity
|
||||||
|
import com.ama.core.architecture.util.ResUtil
|
||||||
import com.gamedog.vididin.R
|
import com.gamedog.vididin.R
|
||||||
import com.gamedog.vididin.main.interfaces.OnTabStyleListener
|
import com.gamedog.vididin.main.interfaces.OnTabStyleListener
|
||||||
|
import com.google.android.material.tabs.TabLayout
|
||||||
import com.google.android.material.tabs.TabLayoutMediator
|
import com.google.android.material.tabs.TabLayoutMediator
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import kotlin.getValue
|
import kotlin.getValue
|
||||||
|
|
@ -62,10 +64,26 @@ class WithdrawRecordActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>
|
||||||
val adapter = ViewPagerAdapter(this)
|
val adapter = ViewPagerAdapter(this)
|
||||||
binding.viewPager.adapter = adapter
|
binding.viewPager.adapter = adapter
|
||||||
|
|
||||||
|
with (binding.tabLayout) {
|
||||||
|
addOnTabSelectedListener(object: TabLayout.OnTabSelectedListener {
|
||||||
|
override fun onTabSelected(tab: TabLayout.Tab?) {
|
||||||
|
setTabTextColors(ResUtil.getColor(R.color.black),
|
||||||
|
ResUtil.getColor(if (selectedTabPosition == 0) R.color.green_39 else R.color.yellow_0b))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onTabUnselected(tab: TabLayout.Tab?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onTabReselected(tab: TabLayout.Tab?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
TabLayoutMediator(binding.tabLayout, binding.viewPager) { tab, position ->
|
TabLayoutMediator(binding.tabLayout, binding.viewPager) { tab, position ->
|
||||||
tab.text = when (position) {
|
tab.text = when (position) {
|
||||||
0 -> "Dinheiro"
|
0 -> ResUtil.getString(R.string.record_cash_title)
|
||||||
1 -> "Moedas"
|
1 -> ResUtil.getString(R.string.record_gold_title)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}.attach()
|
}.attach()
|
||||||
|
|
@ -82,3 +100,5 @@ class WithdrawRecordActivity : AppViewsActivity<ViewBinding, UiState, ViewModel>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,21 +4,20 @@ package com.gamedog.vididin.features.withdrawrecord.fragments
|
||||||
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.view.ViewCompat
|
|
||||||
import androidx.core.view.WindowInsetsCompat
|
|
||||||
import androidx.core.view.updatePadding
|
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.ama.core.architecture.appBase.AppViewsFragment
|
import com.ama.core.architecture.appBase.AppViewsFragment
|
||||||
import com.ama.core.architecture.appBase.OnFragmentBackgroundListener
|
import com.ama.core.architecture.appBase.OnFragmentBackgroundListener
|
||||||
import com.ama.core.architecture.util.setOnClickBatch
|
|
||||||
import com.ama.core.architecture.util.setStatusBarDarkFont
|
import com.ama.core.architecture.util.setStatusBarDarkFont
|
||||||
import com.ama.core.common.util.dp
|
import com.gamedog.vididin.R
|
||||||
import com.gamedog.vididin.router.Router
|
import com.gamedog.vididin.beans.RecordCash
|
||||||
|
import com.gamedog.vididin.beans.TransactionStatus
|
||||||
|
import com.gamedog.vididin.features.withdrawrecord.RecordCashRvAdapter
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import kotlin.getValue
|
import kotlin.getValue
|
||||||
import com.gamedog.vididin.databinding.VididinappFeatureMineFragmentMineBinding as ViewBinding
|
import com.gamedog.vididin.databinding.FragmentWithdrawRecordCashBinding as ViewBinding
|
||||||
import com.gamedog.vididin.main.fragments.mine.MineUiState as UiState
|
import com.gamedog.vididin.features.withdrawrecord.RecordCashUiState as UiState
|
||||||
import com.gamedog.vididin.main.fragments.mine.MineViewModel as ViewModel
|
import com.gamedog.vididin.features.withdrawrecord.RecordCashViewModel as ViewModel
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -26,6 +25,7 @@ import com.gamedog.vididin.main.fragments.mine.MineViewModel as ViewModel
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class CashRecordFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(),
|
class CashRecordFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(),
|
||||||
OnFragmentBackgroundListener {
|
OnFragmentBackgroundListener {
|
||||||
|
private lateinit var mAdapter: RecordCashRvAdapter
|
||||||
override val mViewModel: ViewModel by viewModels()
|
override val mViewModel: ViewModel by viewModels()
|
||||||
override var isBackgroundBright: Boolean = true
|
override var isBackgroundBright: Boolean = true
|
||||||
|
|
||||||
|
|
@ -39,42 +39,22 @@ class CashRecordFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(),
|
||||||
) = ViewBinding.inflate(inflater, container, false)
|
) = ViewBinding.inflate(inflater, container, false)
|
||||||
|
|
||||||
override fun ViewBinding.initWindowInsets() {
|
override fun ViewBinding.initWindowInsets() {
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(topBackground) { v, insets ->
|
binding?.root?.let { setImmerseRootView(it) }
|
||||||
val systemBars =
|
|
||||||
insets.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout())
|
|
||||||
v.updatePadding(top = systemBars.top + 20.dp)
|
|
||||||
insets
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun ViewBinding.initViews() {
|
override fun ViewBinding.initViews() {
|
||||||
setOnClickBatch(rlPrivacy, rlVersion, rlFeedback) {
|
setupRecyclerView()
|
||||||
when (this) {
|
|
||||||
rlPrivacy -> {
|
|
||||||
Router.Privacy.startActivity(requireActivity())
|
|
||||||
}
|
|
||||||
rlVersion -> {
|
|
||||||
Router.Version.startActivity(requireActivity())
|
|
||||||
}
|
|
||||||
rlFeedback -> {
|
|
||||||
Router.Feedback.startActivity(requireActivity())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun ViewBinding.initListeners() {
|
override fun ViewBinding.initListeners() {
|
||||||
nestedScrollView.setOnScrollChangeListener { _, _, scrollY, _, _ ->
|
|
||||||
isStatusBarDarkFont = scrollY > topBackground.height
|
|
||||||
setStatusBarDarkFont(isStatusBarDarkFont)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun ViewBinding.initObservers() {
|
override fun ViewBinding.initObservers() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun ViewBinding.onUiStateCollect(uiState: UiState) {
|
override fun ViewBinding.onUiStateCollect(uiState: UiState) {
|
||||||
//dynamicColorsSwitch.isChecked = uiState.useDynamicColor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
|
@ -82,6 +62,55 @@ class CashRecordFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(),
|
||||||
setStatusBarDarkFont(isDarkFont = isStatusBarDarkFont)
|
setStatusBarDarkFont(isDarkFont = isStatusBarDarkFont)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun setupRecyclerView() {
|
||||||
|
mAdapter = RecordCashRvAdapter()
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
internal fun newInstance() = CashRecordFragment()
|
internal fun newInstance() = CashRecordFragment()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,77 +0,0 @@
|
||||||
package com.gamedog.vididin.features.withdrawrecord.fragments
|
|
||||||
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import com.gamedog.vididin.R
|
|
||||||
import com.gamedog.vididin.beans.Transaction
|
|
||||||
import com.gamedog.vididin.beans.TransactionStatus
|
|
||||||
import com.gamedog.vididin.databinding.FragmentWithdrawRecordCashBinding
|
|
||||||
import com.gamedog.vididin.features.withdrawrecord.TransactionAdapter
|
|
||||||
|
|
||||||
class DinheiroFragment : Fragment() {
|
|
||||||
|
|
||||||
private lateinit var binding: FragmentWithdrawRecordCashBinding
|
|
||||||
private lateinit var adapter: TransactionAdapter
|
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
|
||||||
binding = FragmentWithdrawRecordCashBinding.inflate(inflater, container, false)
|
|
||||||
return binding.root
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
||||||
super.onViewCreated(view, savedInstanceState)
|
|
||||||
setupRecyclerView()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setupRecyclerView() {
|
|
||||||
adapter = TransactionAdapter()
|
|
||||||
binding.recyclerView.adapter = adapter
|
|
||||||
binding.recyclerView.layoutManager = LinearLayoutManager(requireContext())
|
|
||||||
|
|
||||||
// 模拟数据 - 根据您的截图
|
|
||||||
val transactions = listOf(
|
|
||||||
Transaction(
|
|
||||||
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
|
|
||||||
),
|
|
||||||
Transaction(
|
|
||||||
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
|
|
||||||
),
|
|
||||||
Transaction(
|
|
||||||
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
|
|
||||||
),
|
|
||||||
Transaction(
|
|
||||||
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
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
adapter.submitList(transactions)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -4,21 +4,21 @@ package com.gamedog.vididin.features.withdrawrecord.fragments
|
||||||
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.view.ViewCompat
|
|
||||||
import androidx.core.view.WindowInsetsCompat
|
|
||||||
import androidx.core.view.updatePadding
|
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.ama.core.architecture.appBase.AppViewsFragment
|
import com.ama.core.architecture.appBase.AppViewsFragment
|
||||||
import com.ama.core.architecture.appBase.OnFragmentBackgroundListener
|
import com.ama.core.architecture.appBase.OnFragmentBackgroundListener
|
||||||
import com.ama.core.architecture.util.setOnClickBatch
|
|
||||||
import com.ama.core.architecture.util.setStatusBarDarkFont
|
import com.ama.core.architecture.util.setStatusBarDarkFont
|
||||||
import com.ama.core.common.util.dp
|
import com.gamedog.vididin.R
|
||||||
import com.gamedog.vididin.router.Router
|
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 dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import kotlin.getValue
|
import kotlin.getValue
|
||||||
import com.gamedog.vididin.databinding.VididinappFeatureMineFragmentMineBinding as ViewBinding
|
import com.gamedog.vididin.databinding.FragmentWithdrawRecordGoldBinding as ViewBinding
|
||||||
import com.gamedog.vididin.main.fragments.mine.MineUiState as UiState
|
import com.gamedog.vididin.features.withdrawrecord.RecordGoldUiState as UiState
|
||||||
import com.gamedog.vididin.main.fragments.mine.MineViewModel as ViewModel
|
import com.gamedog.vididin.features.withdrawrecord.RecordGoldViewModel as ViewModel
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -26,6 +26,7 @@ import com.gamedog.vididin.main.fragments.mine.MineViewModel as ViewModel
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class GoldRecordFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(),
|
class GoldRecordFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(),
|
||||||
OnFragmentBackgroundListener {
|
OnFragmentBackgroundListener {
|
||||||
|
private lateinit var mAdapter: RecordGoldRvAdapter
|
||||||
override val mViewModel: ViewModel by viewModels()
|
override val mViewModel: ViewModel by viewModels()
|
||||||
override var isBackgroundBright: Boolean = true
|
override var isBackgroundBright: Boolean = true
|
||||||
|
|
||||||
|
|
@ -39,42 +40,22 @@ class GoldRecordFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(),
|
||||||
) = ViewBinding.inflate(inflater, container, false)
|
) = ViewBinding.inflate(inflater, container, false)
|
||||||
|
|
||||||
override fun ViewBinding.initWindowInsets() {
|
override fun ViewBinding.initWindowInsets() {
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(topBackground) { v, insets ->
|
binding?.root?.let { setImmerseRootView(it) }
|
||||||
val systemBars =
|
|
||||||
insets.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout())
|
|
||||||
v.updatePadding(top = systemBars.top + 20.dp)
|
|
||||||
insets
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun ViewBinding.initViews() {
|
override fun ViewBinding.initViews() {
|
||||||
setOnClickBatch(rlPrivacy, rlVersion, rlFeedback) {
|
setupRecyclerView()
|
||||||
when (this) {
|
|
||||||
rlPrivacy -> {
|
|
||||||
Router.Privacy.startActivity(requireActivity())
|
|
||||||
}
|
|
||||||
rlVersion -> {
|
|
||||||
Router.Version.startActivity(requireActivity())
|
|
||||||
}
|
|
||||||
rlFeedback -> {
|
|
||||||
Router.Feedback.startActivity(requireActivity())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun ViewBinding.initListeners() {
|
override fun ViewBinding.initListeners() {
|
||||||
nestedScrollView.setOnScrollChangeListener { _, _, scrollY, _, _ ->
|
|
||||||
isStatusBarDarkFont = scrollY > topBackground.height
|
|
||||||
setStatusBarDarkFont(isStatusBarDarkFont)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun ViewBinding.initObservers() {
|
override fun ViewBinding.initObservers() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun ViewBinding.onUiStateCollect(uiState: UiState) {
|
override fun ViewBinding.onUiStateCollect(uiState: UiState) {
|
||||||
//dynamicColorsSwitch.isChecked = uiState.useDynamicColor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
|
@ -82,7 +63,56 @@ class GoldRecordFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(),
|
||||||
setStatusBarDarkFont(isDarkFont = isStatusBarDarkFont)
|
setStatusBarDarkFont(isDarkFont = isStatusBarDarkFont)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun setupRecyclerView() {
|
||||||
|
mAdapter = RecordGoldRvAdapter()
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
internal fun newInstance() = GoldRecordFragment()
|
internal fun newInstance() = CashRecordFragment()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape android:shape="rectangle"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="@color/green_39" />
|
||||||
|
<corners android:radius="42dp" />
|
||||||
|
</shape>
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape android:shape="rectangle"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#ffff740b" />
|
||||||
|
<corners android:radius="42dp" />
|
||||||
|
</shape>
|
||||||
|
|
||||||
|
|
@ -28,7 +28,6 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_marginStart="20dp"
|
|
||||||
app:tabTextColor="@color/black"
|
app:tabTextColor="@color/black"
|
||||||
app:tabSelectedTextColor="@color/green_39"
|
app:tabSelectedTextColor="@color/green_39"
|
||||||
app:tabIndicatorColor="@color/transparent"
|
app:tabIndicatorColor="@color/transparent"
|
||||||
|
|
@ -37,6 +36,7 @@
|
||||||
app:tabBackground="@color/transparent"
|
app:tabBackground="@color/transparent"
|
||||||
app:tabRippleColor="@null"
|
app:tabRippleColor="@null"
|
||||||
app:tabMode="fixed"
|
app:tabMode="fixed"
|
||||||
|
android:background="@color/transparent"
|
||||||
>
|
>
|
||||||
<com.google.android.material.tabs.TabItem
|
<com.google.android.material.tabs.TabItem
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
||||||
|
|
@ -2,20 +2,49 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical" >
|
||||||
android:padding="16dp">
|
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Total sacado até o momento: R$ 0,1"
|
android:background="@drawable/bg_record_tab_cash"
|
||||||
android:textSize="16sp"
|
android:paddingHorizontal="10dp"
|
||||||
android:textColor="@color/black"
|
android:paddingVertical="15dp"
|
||||||
android:layout_marginBottom="16dp" />
|
android:gravity="center_vertical"
|
||||||
|
android:layout_marginHorizontal="15dp"
|
||||||
|
>
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/record_cash_title_hint"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textColor="@color/white" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@mipmap/icon_cash"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_cash_num"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:text="@string/cash00"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textColor="@color/yellow_00" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recyclerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginHorizontal="15dp"
|
||||||
|
android:layout_marginTop="20dp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
@ -2,20 +2,49 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical" >
|
||||||
android:padding="16dp">
|
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Total sacado até o momento: R$ 0,1"
|
android:background="@drawable/bg_record_tab_gold"
|
||||||
android:textSize="16sp"
|
android:paddingHorizontal="10dp"
|
||||||
android:textColor="@color/black"
|
android:paddingVertical="15dp"
|
||||||
android:layout_marginBottom="16dp" />
|
android:gravity="center_vertical"
|
||||||
|
android:layout_marginHorizontal="15dp"
|
||||||
|
>
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/record_cash_title_hint"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textColor="@color/white" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@mipmap/home_gold"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_gold_num"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:text="0"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textColor="@color/yellow_00" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recyclerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginHorizontal="15dp"
|
||||||
|
android:layout_marginTop="20dp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
@ -95,5 +95,6 @@
|
||||||
<color name="red_1b">#FF92521B</color>
|
<color name="red_1b">#FF92521B</color>
|
||||||
<color name="red_28">#FFFF2828</color>
|
<color name="red_28">#FFFF2828</color>
|
||||||
<color name="red_9c">#FFFF9C7C</color>
|
<color name="red_9c">#FFFF9C7C</color>
|
||||||
|
<color name="yellow_0b">#FFFF740B</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
@ -115,5 +115,8 @@
|
||||||
<string name="participar_member_2">Quase 4 milhões de pessoas na jogada!</string>
|
<string name="participar_member_2">Quase 4 milhões de pessoas na jogada!</string>
|
||||||
<string name="zero_buy_hint_title">Regras para Ganhar:</string>
|
<string name="zero_buy_hint_title">Regras para Ganhar:</string>
|
||||||
<string name="zero_buy_hint_content"><![CDATA[Número Sorteado = Segundos da Conclusão % Número de Participantes + 1%: Computes the remainder after division by team size.\\n· Gaste Moedas de Propaganda para participar.\n·Draw when ful l& Reembolso automático se não completar]]></string>
|
<string name="zero_buy_hint_content"><![CDATA[Número Sorteado = Segundos da Conclusão % Número de Participantes + 1%: Computes the remainder after division by team size.\\n· Gaste Moedas de Propaganda para participar.\n·Draw when ful l& Reembolso automático se não completar]]></string>
|
||||||
|
<string name="record_cash_title">Dinheiro</string>
|
||||||
|
<string name="record_gold_title">Moedas</string>
|
||||||
|
<string name="record_cash_title_hint">Total sacado até o momento:</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
Loading…
Reference in New Issue