Updated on 2026-08-14
This commit is contained in:
parent
2d0bc9d9e6
commit
ac9a3d15c3
28 changed files with 1528 additions and 127 deletions
|
|
@ -30,7 +30,7 @@ import com.tangem.core.ui.res.TangemTheme
|
|||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
|
||||
enum class AccountIconSize {
|
||||
Default, Large, Medium, Small, ExtraSmall
|
||||
Default, Large, Medium, Small, ExtraSmall, RedesignedDefault
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -128,6 +128,7 @@ fun AccountCharIcon(char: Char, color: Color, size: AccountIconSize, modifier: M
|
|||
AccountIconSize.Medium -> TangemTheme.typography.subtitle1
|
||||
AccountIconSize.Small -> TangemTheme.typography.subtitle2
|
||||
AccountIconSize.ExtraSmall -> TangemTheme.typography.caption1
|
||||
AccountIconSize.RedesignedDefault -> TangemTheme.typography2.headingSemibold28
|
||||
}
|
||||
|
||||
val textSize by animateFloatAsState(
|
||||
|
|
@ -159,6 +160,7 @@ private fun AccountIconSize.iconSizeInDp(): Dp = when (this) {
|
|||
AccountIconSize.Medium -> 16.dp
|
||||
AccountIconSize.Small -> 12.dp
|
||||
AccountIconSize.ExtraSmall -> 8.dp
|
||||
AccountIconSize.RedesignedDefault -> 20.dp
|
||||
}
|
||||
|
||||
private fun AccountIconSize.boxSizeInDp(): Dp = when (this) {
|
||||
|
|
@ -167,6 +169,7 @@ private fun AccountIconSize.boxSizeInDp(): Dp = when (this) {
|
|||
AccountIconSize.Medium -> 28.dp
|
||||
AccountIconSize.Small -> 20.dp
|
||||
AccountIconSize.ExtraSmall -> 14.dp
|
||||
AccountIconSize.RedesignedDefault -> 40.dp
|
||||
}
|
||||
|
||||
private fun AccountIconSize.boxShapeSizeInDp(): Dp = when (this) {
|
||||
|
|
@ -175,6 +178,7 @@ private fun AccountIconSize.boxShapeSizeInDp(): Dp = when (this) {
|
|||
AccountIconSize.Medium -> 8.dp
|
||||
AccountIconSize.Small -> 6.dp
|
||||
AccountIconSize.ExtraSmall -> 4.dp
|
||||
AccountIconSize.RedesignedDefault -> 12.dp
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
|
|
@ -203,6 +207,7 @@ private fun Sample() {
|
|||
AccountIconSize.Medium -> AccountIconSize.Small
|
||||
AccountIconSize.Small -> AccountIconSize.ExtraSmall
|
||||
AccountIconSize.ExtraSmall -> AccountIconSize.Default
|
||||
AccountIconSize.RedesignedDefault -> AccountIconSize.Large
|
||||
}
|
||||
}) { Text("Change") }
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
package com.tangem.core.ui.components.token.internal
|
||||
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
|
|
@ -13,11 +9,11 @@ import androidx.compose.ui.Alignment
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.composed
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import com.tangem.core.ui.test.TokenElementsTestTags
|
||||
import androidx.compose.ui.graphics.vector.rememberVectorPainter
|
||||
import androidx.compose.ui.res.vectorResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTag
|
||||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.util.fastForEach
|
||||
|
|
@ -25,7 +21,10 @@ import com.tangem.core.ui.components.RectangleShimmer
|
|||
import com.tangem.core.ui.components.icons.IconTint
|
||||
import com.tangem.core.ui.components.text.applyBladeBrush
|
||||
import com.tangem.core.ui.extensions.orMaskWithStars
|
||||
import com.tangem.core.ui.extensions.resolveAnnotatedReference
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.test.TokenElementsTestTags
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import com.tangem.core.ui.components.token.state.TokenItemState.FiatAmountState as TokenFiatAmountState
|
||||
|
||||
@Composable
|
||||
|
|
@ -60,6 +59,11 @@ internal fun TokenFiatAmount(state: TokenFiatAmountState?, isBalanceHidden: Bool
|
|||
// Empty box for proper measurements
|
||||
Box(modifier)
|
||||
}
|
||||
is TokenFiatAmountState.AnnotatedContent -> FiatAmountAnnotatedText(
|
||||
text = state.text.orMaskWithStars(isBalanceHidden).resolveAnnotatedReference(),
|
||||
modifier = modifier,
|
||||
isFlickering = state.isFlickering,
|
||||
)
|
||||
null -> Unit
|
||||
}
|
||||
}
|
||||
|
|
@ -77,7 +81,7 @@ private fun IconAmount(state: TokenFiatAmountState.Icon, modifier: Modifier = Mo
|
|||
@Composable
|
||||
private fun ContentFiatAmount(
|
||||
text: String,
|
||||
icons: List<TokenFiatAmountState.Content.IconUM>,
|
||||
icons: ImmutableList<TokenFiatAmountState.Content.IconUM>,
|
||||
isAmountFlickering: Boolean,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
|
|
@ -135,6 +139,25 @@ private fun FiatAmountText(
|
|||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun FiatAmountAnnotatedText(
|
||||
text: AnnotatedString,
|
||||
modifier: Modifier = Modifier,
|
||||
isAvailable: Boolean = true,
|
||||
isFlickering: Boolean = false,
|
||||
) {
|
||||
Text(
|
||||
modifier = modifier,
|
||||
text = text,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
style = TangemTheme.typography.body2.applyBladeBrush(
|
||||
isEnabled = isFlickering,
|
||||
textColor = if (isAvailable) TangemTheme.colors.text.primary1 else TangemTheme.colors.text.tertiary,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
private fun Modifier.placeholderSize(): Modifier = composed {
|
||||
return@composed this
|
||||
.padding(vertical = 4.dp)
|
||||
|
|
|
|||
|
|
@ -230,6 +230,11 @@ sealed class TokenItemState {
|
|||
val tint: IconTint = IconTint.Inactive,
|
||||
) : FiatAmountState()
|
||||
|
||||
data class AnnotatedContent(
|
||||
val text: TextReference,
|
||||
val isFlickering: Boolean = false,
|
||||
) : FiatAmountState()
|
||||
|
||||
data object Loading : FiatAmountState()
|
||||
|
||||
data object Locked : FiatAmountState()
|
||||
|
|
|
|||
9
core/ui/src/main/res/drawable/ic_credit_card_20.xml
Normal file
9
core/ui/src/main/res/drawable/ic_credit_card_20.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M13.832,3.945C14.803,3.945 15.289,3.946 15.686,4.061C16.648,4.339 17.4,5.091 17.678,6.053C17.792,6.449 17.793,6.935 17.793,7.906V11.354L17.788,12.435C17.773,13.382 17.714,13.959 17.476,14.427L17.362,14.628C17.082,15.085 16.68,15.458 16.2,15.702L16.081,15.758C15.634,15.95 15.077,16.001 14.208,16.015L13.126,16.02H6.873C5.342,16.02 4.529,16.02 3.919,15.758L3.8,15.702C3.32,15.458 2.918,15.085 2.638,14.628L2.525,14.427C2.287,13.959 2.227,13.382 2.212,12.435L2.207,11.354V7.906C2.207,7.057 2.207,6.579 2.283,6.207L2.321,6.053C2.582,5.151 3.26,4.433 4.137,4.118L4.313,4.061C4.71,3.946 5.197,3.945 6.168,3.945H13.832ZM3.457,11.354C3.457,12.19 3.458,12.743 3.492,13.167C3.526,13.575 3.585,13.753 3.639,13.859C3.798,14.173 4.053,14.428 4.366,14.588C4.473,14.642 4.651,14.701 5.06,14.734C5.483,14.769 6.036,14.769 6.873,14.769H13.126C13.963,14.769 14.517,14.769 14.94,14.734C15.349,14.701 15.526,14.642 15.633,14.588C15.946,14.428 16.201,14.173 16.361,13.859C16.416,13.753 16.473,13.575 16.507,13.167C16.541,12.743 16.543,12.19 16.543,11.354V8.531H3.457V11.354ZM10.136,12.227C10.481,12.228 10.761,12.508 10.761,12.852C10.761,13.198 10.481,13.477 10.136,13.477H9.081C8.736,13.477 8.456,13.198 8.456,12.852C8.456,12.507 8.736,12.227 9.081,12.227H10.136ZM14.589,12.227C14.934,12.228 15.214,12.508 15.214,12.852C15.214,13.198 14.934,13.477 14.589,13.477H12.164C11.819,13.477 11.539,13.198 11.539,12.852C11.539,12.508 11.819,12.228 12.164,12.227H14.589ZM6.168,5.196C5.111,5.196 4.845,5.208 4.661,5.261C4.111,5.42 3.68,5.851 3.521,6.4C3.481,6.541 3.465,6.73 3.459,7.281H16.54C16.534,6.729 16.518,6.541 16.478,6.4C16.319,5.851 15.889,5.42 15.339,5.261C15.155,5.208 14.889,5.196 13.832,5.196H6.168Z"
|
||||
android:fillColor="#0099FF"/>
|
||||
</vector>
|
||||
9
core/ui/src/main/res/drawable/ic_select_choice_20.xml
Normal file
9
core/ui/src/main/res/drawable/ic_select_choice_20.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M13.46,11.793C13.85,11.402 14.483,11.402 14.874,11.793C15.264,12.183 15.264,12.816 14.874,13.207L10.708,17.374C10.317,17.764 9.684,17.764 9.294,17.374L5.127,13.207C4.736,12.816 4.736,12.183 5.127,11.793C5.517,11.402 6.15,11.402 6.541,11.793L10,15.252L13.46,11.793ZM9.294,2.626C9.684,2.236 10.317,2.235 10.708,2.626L14.874,6.793C15.264,7.183 15.264,7.816 14.874,8.207C14.483,8.597 13.85,8.597 13.46,8.207L10,4.748L6.541,8.207C6.15,8.597 5.517,8.597 5.127,8.207C4.736,7.816 4.736,7.183 5.127,6.793L9.294,2.626Z"
|
||||
android:fillColor="#B0B0B0"/>
|
||||
</vector>
|
||||
Loading…
Add table
Add a link
Reference in a new issue