From bd1eea292cfc257c42ccf084067b929d70b7571d Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 20 Apr 2022 11:19:10 +0400 Subject: [PATCH] Updated on 2026-08-14 --- .../ui/compose/CollapsedCurrencyItem.kt | 36 +++++++++++++--- .../features/tokens/ui/compose/NetworkItem.kt | 42 ++++++++++++++----- 2 files changed, 61 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/tokens/ui/compose/CollapsedCurrencyItem.kt b/app/src/main/java/com/tangem/tap/features/tokens/ui/compose/CollapsedCurrencyItem.kt index e4b3810766..19de899ac1 100644 --- a/app/src/main/java/com/tangem/tap/features/tokens/ui/compose/CollapsedCurrencyItem.kt +++ b/app/src/main/java/com/tangem/tap/features/tokens/ui/compose/CollapsedCurrencyItem.kt @@ -1,6 +1,7 @@ package com.tangem.tap.features.tokens.ui.compose import androidx.compose.foundation.Image +import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.* import androidx.compose.foundation.shape.CircleShape @@ -71,6 +72,7 @@ fun CollapsedCurrencyItem( if (contract.address == currency.symbol) { BlockchainNetworkItem( blockchain = Blockchain.fromNetworkId(contract.networkId), + isMainNetwork = true, addedBlockchains = addedBlockchains ) } else { @@ -95,6 +97,7 @@ fun CollapsedCurrencyItem( } else { BlockchainNetworkItem( blockchain = blockchain, + isMainNetwork = false, addedBlockchains = addedBlockchains ) } @@ -114,18 +117,39 @@ fun CollapsedCurrencyItem( @Composable fun BlockchainNetworkItem( blockchain: Blockchain?, + isMainNetwork: Boolean, addedBlockchains: List ) { val added = addedBlockchains.contains(blockchain) val icon = if (added) blockchain?.getRoundIconRes() else blockchain?.getGreyedOutIconRes() if (icon != null) { - Image( - painter = painterResource(id = icon), - contentDescription = null, - Modifier - .size(20.dp) - ) + Box(Modifier + .size(20.dp)) { + Image( + painter = painterResource(id = icon), + contentDescription = null, + Modifier + .size(20.dp) + ) + if (isMainNetwork) { + Box( + modifier = Modifier + .align(Alignment.TopEnd) + .size(7.dp) + .clip(CircleShape) + .background(Color.White) + ) { + Box( + modifier = Modifier + .align(Alignment.Center) + .size(5.dp) + .clip(CircleShape) + .background(Color(0xFF1ACE80)) + ) + } + } + } Spacer(modifier = Modifier.size(5.dp)) } } \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/features/tokens/ui/compose/NetworkItem.kt b/app/src/main/java/com/tangem/tap/features/tokens/ui/compose/NetworkItem.kt index bdb5107ae2..1c6f8e74c3 100644 --- a/app/src/main/java/com/tangem/tap/features/tokens/ui/compose/NetworkItem.kt +++ b/app/src/main/java/com/tangem/tap/features/tokens/ui/compose/NetworkItem.kt @@ -1,6 +1,7 @@ package com.tangem.tap.features.tokens.ui.compose import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.background import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.* @@ -53,17 +54,36 @@ fun NetworkItem( interactionSource = remember { MutableInteractionSource() } ) ) { - SubcomposeAsyncImage( - model = if (added) blockchain.getRoundIconRes() else blockchain.getGreyedOutIconRes(), - contentDescription = blockchain.fullName, - loading = { CurrencyPlaceholderIcon(blockchain.id) }, - error = { CurrencyPlaceholderIcon(blockchain.id) }, - modifier = Modifier - .clip(CircleShape) - .padding(start = 8.dp, top = 16.dp, bottom = 16.dp, end = 6.dp) - .size(20.dp) - .align(Alignment.CenterVertically) - ) + Box(modifier = Modifier + .align(Alignment.CenterVertically) + .padding(start = 8.dp, top = 16.dp, bottom = 16.dp, end = 6.dp) + ) { + SubcomposeAsyncImage( + model = if (added) blockchain.getRoundIconRes() else blockchain.getGreyedOutIconRes(), + contentDescription = blockchain.fullName, + loading = { CurrencyPlaceholderIcon(blockchain.id) }, + error = { CurrencyPlaceholderIcon(blockchain.id) }, + modifier = Modifier + .size(20.dp) + ) + if (isBlockchain) { + Box( + modifier = Modifier + .align(Alignment.TopEnd) + .size(7.dp) + .clip(CircleShape) + .background(Color.White) + ) { + Box( + modifier = Modifier + .align(Alignment.Center) + .size(5.dp) + .clip(CircleShape) + .background(Color(0xFF1ACE80)) + ) + } + } + } Row( modifier = Modifier .fillMaxHeight()