Updated on 2026-08-14
This commit is contained in:
commit
22c2dcd711
2 changed files with 18 additions and 3 deletions
|
|
@ -9,6 +9,7 @@ import com.tangem.blockchain.common.Blockchain
|
|||
import com.tangem.blockchain.common.IconsUtil
|
||||
import com.tangem.blockchain.common.Token
|
||||
import com.tangem.core.ui.extensions.getActiveIconRes
|
||||
import com.tangem.domain.common.extensions.toCoinId
|
||||
import com.tangem.domain.common.extensions.toNetworkId
|
||||
import com.tangem.tap.common.extensions.getColor
|
||||
import com.tangem.tap.common.extensions.getTextColor
|
||||
|
|
@ -85,7 +86,7 @@ class CurrencyIconRequest(
|
|||
crossinline onError: (Blockchain) -> Unit = {},
|
||||
) {
|
||||
currencyImageView.loadIcon(
|
||||
data = if (getLocalImage) getActiveIconRes(blockchain.id) else getIconUrl(blockchain.toNetworkId()),
|
||||
data = getBlockchainIconData(blockchain),
|
||||
placeholderRes = getActiveIconRes(blockchain.id),
|
||||
onStart = { onStart(blockchain) },
|
||||
onSuccess = { onSuccess(blockchain) },
|
||||
|
|
@ -93,6 +94,20 @@ class CurrencyIconRequest(
|
|||
)
|
||||
}
|
||||
|
||||
private fun getBlockchainIconData(blockchain: Blockchain): Any {
|
||||
return if (getLocalImage) {
|
||||
when (blockchain) {
|
||||
Blockchain.TerraV1, Blockchain.TerraV2 -> getActiveIconRes(blockchain.toCoinId())
|
||||
else -> getActiveIconRes(blockchain.id)
|
||||
}
|
||||
} else {
|
||||
when (blockchain) {
|
||||
Blockchain.TerraV1, Blockchain.TerraV2 -> getIconUrl(blockchain.toCoinId())
|
||||
else -> getIconUrl(blockchain.toNetworkId())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private inline fun loadTokenIconBase(
|
||||
crossinline onStart: (Token) -> Unit = {},
|
||||
crossinline onSuccess: (Token) -> Unit = {},
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ fun getActiveIconRes(blockchainId: String): Int {
|
|||
"KAVA", "KAVA/test" -> R.drawable.img_kava_22
|
||||
"ravencoin", "ravencoin/test" -> R.drawable.img_ravencoin_22
|
||||
"cosmos", "cosmos/test" -> R.drawable.img_cosmos_22
|
||||
"terra" -> R.drawable.img_terra_22
|
||||
"terra-2" -> R.drawable.img_terra2_22
|
||||
"terra", "terra-luna" -> R.drawable.img_terra_22
|
||||
"terra-2", "terra-luna-2" -> R.drawable.img_terra2_22
|
||||
else -> R.drawable.ic_alert_24
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue