Updated on 2026-08-14
This commit is contained in:
parent
d465cafc8d
commit
b517fe39dd
32 changed files with 790 additions and 61 deletions
|
|
@ -3,10 +3,10 @@ package com.tangem.core.ui.components
|
|||
import androidx.compose.animation.animateColor
|
||||
import androidx.compose.animation.core.*
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.indication
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.selection.toggleable
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.ripple
|
||||
import androidx.compose.runtime.Composable
|
||||
|
|
@ -20,7 +20,7 @@ import androidx.compose.ui.semantics.Role
|
|||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.test.MarketsTestTags
|
||||
import com.tangem.core.ui.test.SwitchTestTags
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
@Composable
|
||||
|
|
@ -47,7 +47,8 @@ fun TangemSwitch(
|
|||
|
||||
Box(
|
||||
modifier = modifier
|
||||
.clickable(
|
||||
.toggleable(
|
||||
value = checked,
|
||||
interactionSource = interactionSource,
|
||||
indication = ripple(
|
||||
bounded = false,
|
||||
|
|
@ -55,10 +56,9 @@ fun TangemSwitch(
|
|||
),
|
||||
enabled = enabled,
|
||||
role = Role.Switch,
|
||||
onClick = {
|
||||
onCheckedChange(!checked)
|
||||
},
|
||||
).testTag(MarketsTestTags.ADD_TO_PORTFOLIO_SWITCH),
|
||||
onValueChange = onCheckedChange,
|
||||
)
|
||||
.testTag(SwitchTestTags.SWITCH),
|
||||
) {
|
||||
BoxWithConstraints(
|
||||
modifier = Modifier
|
||||
|
|
|
|||
|
|
@ -13,12 +13,14 @@ import androidx.compose.runtime.remember
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.tangem.core.ui.components.CircleShimmer
|
||||
import com.tangem.core.ui.extensions.conditional
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.test.TokenElementsTestTags
|
||||
import com.tangem.core.ui.utils.getGreyScaleColorFilter
|
||||
|
||||
/**
|
||||
|
|
@ -147,7 +149,9 @@ private fun BoxScope.ContentIconContainer(
|
|||
|
||||
if (icon.shouldShowCustomBadge) {
|
||||
CurrencyIconBottomBadge(
|
||||
modifier = Modifier.align(Alignment.BottomEnd),
|
||||
modifier = Modifier
|
||||
.align(Alignment.BottomEnd)
|
||||
.testTag(TokenElementsTestTags.TOKEN_CUSTOM_DERIVATION_ICON),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -5,11 +5,13 @@ import androidx.compose.material3.Text
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import com.tangem.core.ui.extensions.isNullOrEmpty
|
||||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.test.ManageTokensScreenTestTags
|
||||
|
||||
@Composable
|
||||
inline fun RowContentContainer(
|
||||
|
|
@ -27,18 +29,21 @@ inline fun RowContentContainer(
|
|||
Box(
|
||||
contentAlignment = Alignment.Center,
|
||||
content = icon,
|
||||
modifier = Modifier.testTag(ManageTokensScreenTestTags.NETWORK_ICON),
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.heightIn(min = TangemTheme.dimens.size22),
|
||||
.heightIn(min = TangemTheme.dimens.size22)
|
||||
.testTag(ManageTokensScreenTestTags.NETWORK_NAME),
|
||||
contentAlignment = Alignment.CenterStart,
|
||||
content = text,
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.requiredWidthIn(max = TangemTheme.dimens.size80)
|
||||
.heightIn(min = TangemTheme.dimens.size24),
|
||||
.heightIn(min = TangemTheme.dimens.size24)
|
||||
.testTag(ManageTokensScreenTestTags.SWITCH),
|
||||
contentAlignment = Alignment.CenterEnd,
|
||||
content = action,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
package com.tangem.core.ui.test
|
||||
|
||||
object AccountDetailsScreenTestTags {
|
||||
const val MANAGE_TOKENS_BUTTON = "ACCOUNT_DETAILS_SCREEN_MANAGE_TOKENS_BUTTON"
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.tangem.core.ui.test
|
||||
|
||||
object ManageTokensScreenTestTags {
|
||||
const val TOKEN_ITEM = "MANAGE_TOKENS_SCREEN_TOKEN_ITEM"
|
||||
const val NETWORK_ICON = "MANAGE_TOKENS_SCREEN_NETWORK_ICON"
|
||||
const val NETWORK_NAME = "MANAGE_TOKENS_SCREEN_NETWORK_NAME"
|
||||
const val SWITCH = "MANAGE_TOKENS_SCREEN_SWITCH"
|
||||
}
|
||||
|
|
@ -3,6 +3,5 @@ package com.tangem.core.ui.test
|
|||
object MarketsTestTags {
|
||||
const val TOKENS_LIST = "MARKETS_TOKENS_LIST"
|
||||
const val TOKENS_LIST_ITEM = "MARKETS_TOKENS_LIST_ITEM"
|
||||
const val ADD_TO_PORTFOLIO_SWITCH = "MARKETS_ADD_TO_PORTFOLIO_SWITCH"
|
||||
const val LISTED_ON_EXCHANGES_COUNT = "MARKETS_LISTED_ON_EXCHANGES_COUNT"
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package com.tangem.core.ui.test
|
||||
|
||||
object SwitchTestTags {
|
||||
const val SWITCH = "SWITCH"
|
||||
}
|
||||
|
|
@ -9,4 +9,5 @@ object TokenElementsTestTags {
|
|||
const val TOKEN_CRYPTO_AMOUNT = "TOKEN_CRYPTO_AMOUNT"
|
||||
const val TOKEN_NON_FIAT_BLOCK = "TOKEN_NON_FIAT_BLOCK"
|
||||
const val TOKEN_YIELD_PROMO_BANNER = "TOKEN_YIELD_PROMO_BANNER"
|
||||
const val TOKEN_CUSTOM_DERIVATION_ICON = "TOKEN_CUSTOM_DERIVATION_ICON"
|
||||
}
|
||||
|
|
@ -3,4 +3,5 @@ package com.tangem.core.ui.test
|
|||
object WalletSettingsScreenTestTags {
|
||||
const val SCREEN_CONTAINER = "WALLET_SETTINGS_SCREEN_CONTAINER"
|
||||
const val SCREEN_ITEM = "WALLET_SETTINGS_SCREEN_ITEM"
|
||||
const val USER_ACCOUNT_ITEM = "WALLET_SETTINGS_USER_ACCOUNT_ITEM"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue