Updated on 2026-08-14

This commit is contained in:
Tangem 2021-04-08 14:33:59 +03:00
parent 40ed67b0c2
commit bbd8ca801b
3 changed files with 4 additions and 12 deletions

View file

@ -5,7 +5,6 @@ import com.tangem.blockchain.blockchains.bitcoin.BitcoinAddressType
import com.tangem.blockchain.blockchains.cardano.CardanoAddressType
import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchain.common.address.AddressType
import com.tangem.tap.common.redux.global.CryptoCurrencyName
import com.tangem.wallet.R
class MultipleAddressUiHelper {
@ -20,13 +19,6 @@ class MultipleAddressUiHelper {
}
}
fun idToType(id: Int, currencyName: CryptoCurrencyName?): AddressType? {
val blockchain = currencyName?.let { currency ->
Blockchain.fromCurrency(currency)
}
return idToType(id, blockchain)
}
fun idToType(id: Int, blockchain: Blockchain?): AddressType? {
return when (id) {
R.id.chip_default -> {

View file

@ -157,7 +157,7 @@ class WalletDetailsFragment : Fragment(R.layout.fragment_wallet_details), StoreS
private fun setupAddressCard(state: WalletData) {
if (state.walletAddresses != null) {
if (state.shouldShowMultipleAddress()) {
if (state.shouldShowMultipleAddress() && state.blockchain != null) {
(card_balance as? ViewGroup)?.beginDelayedTransition()
chip_group_address_type.show()
chip_group_address_type.fitChipsByGroupWidth()
@ -167,7 +167,7 @@ class WalletDetailsFragment : Fragment(R.layout.fragment_wallet_details), StoreS
chip_group_address_type.setOnCheckedChangeListener { group, checkedId ->
if (checkedId == -1) return@setOnCheckedChangeListener
val type = MultipleAddressUiHelper.idToType(checkedId, state.currencyData.currencySymbol)
val type = MultipleAddressUiHelper.idToType(checkedId, state.blockchain)
type?.let { store.dispatch(WalletAction.ChangeSelectedAddress(type)) }
}
} else {

View file

@ -187,7 +187,7 @@ class SingleWalletView : WalletView {
private fun setupAddressCard(state: WalletData) {
val fragment = fragment ?: return
if (state.walletAddresses != null) {
if (state.walletAddresses != null && state.blockchain != null) {
fragment.l_address?.show()
if (state.shouldShowMultipleAddress()) {
(fragment.l_address as? ViewGroup)?.beginDelayedTransition()
@ -199,7 +199,7 @@ class SingleWalletView : WalletView {
fragment.chip_group_address_type.setOnCheckedChangeListener { group, checkedId ->
if (checkedId == -1) return@setOnCheckedChangeListener
val type = MultipleAddressUiHelper.idToType(checkedId, state.currencyData.currencySymbol)
val type = MultipleAddressUiHelper.idToType(checkedId, state.blockchain)
type?.let { store.dispatch(WalletAction.ChangeSelectedAddress(type)) }
}
} else {