Updated on 2026-08-14

This commit is contained in:
Tangem 2022-09-15 15:44:08 +04:00
parent 5ad45b5e22
commit 8612d4bd5c
3 changed files with 28 additions and 24 deletions

View file

@ -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

View file

@ -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

View file

@ -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()
}
}
}