diff --git a/app/src/main/java/com/tangem/tap/features/wallet/ui/WalletDetailsFragment.kt b/app/src/main/java/com/tangem/tap/features/wallet/ui/WalletDetailsFragment.kt index ab07dd33d5..db9173e486 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/ui/WalletDetailsFragment.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/ui/WalletDetailsFragment.kt @@ -41,6 +41,7 @@ import com.tangem.tap.features.wallet.redux.WalletState import com.tangem.tap.features.wallet.redux.WalletState.Companion.UNKNOWN_AMOUNT_SIGN import com.tangem.tap.features.wallet.ui.adapters.PendingTransactionsAdapter import com.tangem.tap.features.wallet.ui.adapters.WalletDetailWarningMessagesAdapter +import com.tangem.tap.features.wallet.ui.images.load import com.tangem.tap.features.wallet.ui.test.TestWalletDetails import com.tangem.tap.store import com.tangem.wallet.R diff --git a/app/src/main/java/com/tangem/tap/features/wallet/ui/adapters/WalletAdapter.kt b/app/src/main/java/com/tangem/tap/features/wallet/ui/adapters/WalletAdapter.kt index 4be9104bb1..af061d48f1 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/ui/adapters/WalletAdapter.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/ui/adapters/WalletAdapter.kt @@ -15,6 +15,7 @@ import com.tangem.tap.common.extensions.show import com.tangem.tap.features.wallet.redux.WalletAction import com.tangem.tap.features.wallet.redux.WalletData import com.tangem.tap.features.wallet.ui.BalanceStatus +import com.tangem.tap.features.wallet.ui.images.load import com.tangem.tap.store import com.tangem.wallet.R import com.tangem.wallet.databinding.ItemCurrencyWalletBinding diff --git a/app/src/main/java/com/tangem/tap/features/wallet/ui/images/CurrencyIconView.kt b/app/src/main/java/com/tangem/tap/features/wallet/ui/images/CurrencyIconView.kt index 96d03cdd22..4f5fd38bf9 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/ui/images/CurrencyIconView.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/ui/images/CurrencyIconView.kt @@ -22,14 +22,16 @@ class CurrencyIconView @JvmOverloads constructor( LayoutInflater.from(context), this, ) - private val currencyImageView: ImageFilterView + val currencyImageView: ImageFilterView get() = binding.ivCurrency - private val currencyTextView: TextView + val currencyTextView: TextView get() = binding.tvTokenLetter - private var isBlockchainBadgeVisible: Boolean + val blockchainBadge: ImageFilterView + get() = binding.ivBlockchainBadge + var isBlockchainBadgeVisible: Boolean get() = binding.ivBlockchainBadge.isVisible set(value) = binding.ivBlockchainBadge::isVisible.set(value) - private var isCustomCurrencyBadgeVisible: Boolean + var isCustomCurrencyBadgeVisible: Boolean get() = binding.customBadge.isVisible set(value) = binding.customBadge::isVisible.set(value) @@ -37,30 +39,30 @@ class CurrencyIconView @JvmOverloads constructor( minWidth = dpToPx(48f).roundToInt() minHeight = dpToPx(48f).roundToInt() } +} - fun load( - currency: Currency, - derivationStyle: DerivationStyle?, - ) { - isCustomCurrencyBadgeVisible = currency.isCustomCurrency(derivationStyle) +fun CurrencyIconView.load( + currency: Currency, + derivationStyle: DerivationStyle?, +) { + isCustomCurrencyBadgeVisible = currency.isCustomCurrency(derivationStyle) + + CurrencyIconRequest( + currencyImageView = currencyImageView, + currencyTextView = currencyTextView, + token = (currency as? Currency.Token)?.token, + blockchain = currency.blockchain, + ).load() + + if (currency.isToken()) { + // load a blockchain icon into the blockchain badge + isBlockchainBadgeVisible = true CurrencyIconRequest( - currencyImageView = currencyImageView, - currencyTextView = currencyTextView, - token = (currency as? Currency.Token)?.token, + currencyImageView = blockchainBadge, + currencyTextView = null, + token = null, blockchain = currency.blockchain, ).load() - - if (currency.isToken()) { - // load a blockchain icon into the blockchain badge - isBlockchainBadgeVisible = true - - CurrencyIconRequest( - currencyImageView = binding.ivBlockchainBadge, - currencyTextView = null, - token = null, - blockchain = currency.blockchain, - ).load() - } } } \ No newline at end of file