Updated on 2026-08-14

This commit is contained in:
Tangem 2023-10-10 12:07:39 +05:00
parent 519f5332f1
commit 8962f8d333
27 changed files with 87 additions and 76 deletions

View file

@ -94,7 +94,7 @@ private fun TextField(model: AddCustomTokenInputField, isError: Boolean) {
label = {
Text(
text = model.label.resolveReference(),
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
color = TangemTextFieldsDefault.defaultTextFieldColors.labelColor(
enabled = isEnabled,
error = isError,
@ -178,7 +178,7 @@ private fun SelectorField(model: AddCustomTokenSelectorField) {
text = subtitle,
color = TangemTheme.colors.text.secondary,
maxLines = 1,
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
)
}
}

View file

@ -229,7 +229,7 @@ private fun TangemAppVersion(appNameRes: Int, version: String, modifier: Modifie
Text(
modifier = modifier.padding(horizontal = TangemTheme.dimens.spacing16),
text = "${stringResource(id = appNameRes)} $version",
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
color = TangemTheme.colors.text.tertiary,
)
}

View file

@ -144,7 +144,7 @@ private fun Footer(showProgress: Boolean, onSaveWalletClick: () -> Unit) {
Text(
modifier = Modifier.fillMaxWidth(fraction = .7f),
text = stringResource(R.string.save_user_wallet_agreement_notice),
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
color = TangemTheme.colors.text.tertiary,
textAlign = TextAlign.Center,
)

View file

@ -134,7 +134,7 @@ private fun TotalBalanceCardContent(state: TotalBalanceCardState, modifier: Modi
Text(
modifier = Modifier.fillMaxWidth(),
text = stringResource(id = R.string.main_processing_full_amount),
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
color = TangemTheme.colors.text.attention,
)
}

View file

@ -151,7 +151,7 @@ private fun RowScope.WalletInfo(wallet: UserWalletItem, isSelected: Boolean) {
},
color = TangemTheme.colors.text.tertiary,
maxLines = 1,
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
)
}
}
@ -255,7 +255,7 @@ private fun LoadedTokensInfo(
count = tokensCount,
tokensCount,
),
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
color = TangemTheme.colors.text.tertiary,
textAlign = TextAlign.End,
)

View file

@ -25,7 +25,6 @@ import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.tangem.core.ui.R
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemTypography
/**
* [Show in Figma](https://www.figma.com/file/14ISV23YB1yVW1uNVwqrKv/Android?node-id=213%3A218&t=TmfD6UBHPg9uYfev-4)
@ -103,7 +102,7 @@ private fun TangemTextField(
if (!label.isNullOrEmpty()) {
Text(
text = label,
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
color = colors.labelColor(
enabled = enabled,
error = isError,
@ -161,7 +160,7 @@ private fun TangemTextField(
.fillMaxWidth()
.padding(horizontal = 16.dp),
text = caption,
style = TangemTypography.body1,
style = TangemTheme.typography.body1,
color = colors.captionColor(enabled = enabled, isError = isError).value,
)
}

View file

@ -169,7 +169,7 @@ private fun SubtitleView(subtitle: String, icon: Painter?) {
text = subtitle,
color = TangemTheme.colors.text.secondary,
maxLines = 1,
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
)
}
}

View file

@ -63,7 +63,7 @@ private fun TokenReceiveBottomSheetContent(content: TokenReceiveBottomSheetConfi
text = stringResource(R.string.receive_bottom_sheet_warning_message_full, content.name),
color = TangemTheme.colors.text.secondary,
textAlign = TextAlign.Center,
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
)
Row(
horizontalArrangement = Arrangement.spacedBy(TangemTheme.dimens.spacing16),

View file

@ -157,7 +157,7 @@ private fun TextsBlock(title: TextReference, subtitle: TextReference) {
Text(
text = subtitle.resolveReference(),
color = TangemTheme.colors.text.tertiary,
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
)
}
}

View file

@ -251,7 +251,7 @@ private fun Subtitle(state: TransactionState, modifier: Modifier = Modifier) {
modifier = modifier,
textAlign = TextAlign.Start,
color = TangemTheme.colors.text.tertiary,
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
)
}
is TransactionState.Loading -> {
@ -304,7 +304,7 @@ private fun Timestamp(state: TransactionState, modifier: Modifier = Modifier) {
modifier = modifier,
textAlign = TextAlign.End,
color = TangemTheme.colors.text.tertiary,
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
)
}
is TransactionState.Loading -> {

View file

@ -3,7 +3,6 @@ package com.tangem.core.ui.res
import androidx.compose.material.Colors
import androidx.compose.material.MaterialTheme
import androidx.compose.material.ProvideTextStyle
import androidx.compose.material.Typography
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.ReadOnlyComposable
@ -17,7 +16,7 @@ internal const val IS_SYSTEM_IN_DARK_THEME: Boolean = false
@Composable
fun TangemTheme(
isDark: Boolean = false,
typography: Typography = TangemTheme.typography,
typography: TangemTypography = TangemTheme.typography,
dimens: TangemDimens = TangemTheme.dimens,
content: @Composable () -> Unit,
) {
@ -26,10 +25,8 @@ fun TangemTheme(
.also { it.update(themeColors) }
val shapes = remember { TangemShapes(dimens) }
MaterialTheme(
colors = materialThemeColors(colors = themeColors, isDark = isDark),
typography = typography,
) {
CompositionLocalProvider(
LocalTangemColors provides rememberedColors,
@ -52,7 +49,7 @@ object TangemTheme {
@ReadOnlyComposable
get() = LocalTangemColors.current
val typography: Typography
val typography: TangemTypography
@Composable
@ReadOnlyComposable
get() = LocalTangemTypography.current
@ -197,7 +194,7 @@ private val LocalTangemColors = staticCompositionLocalOf<TangemColors> {
}
private val LocalTangemTypography = staticCompositionLocalOf {
TangemTypography
TangemTypography()
}
private val LocalTangemDimens = staticCompositionLocalOf {

View file

@ -1,6 +1,6 @@
package com.tangem.core.ui.res
import androidx.compose.material.Typography
import androidx.compose.runtime.Immutable
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
@ -15,63 +15,87 @@ private val RobotoFamily = FontFamily(
Font(R.font.roboto_medium, FontWeight.Medium),
)
val TangemTypography = Typography(
defaultFontFamily = RobotoFamily,
h1 = TextStyle(
@Immutable
data class TangemTypography internal constructor(
val head: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontSize = 34.sp,
fontWeight = FontWeight.SemiBold,
letterSpacing = TextUnit(value = 0f, type = TextUnitType.Sp),
lineHeight = TextUnit(value = 44f, type = TextUnitType.Sp),
),
val h1: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontSize = 34.sp,
fontWeight = FontWeight.Normal,
letterSpacing = TextUnit(value = 0f, type = TextUnitType.Sp),
lineHeight = TextUnit(value = 44f, type = TextUnitType.Sp),
),
h2 = TextStyle(
val h2: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontSize = 24.sp,
fontWeight = FontWeight.Medium,
letterSpacing = TextUnit(value = 0.18f, type = TextUnitType.Sp),
lineHeight = TextUnit(value = 32f, type = TextUnitType.Sp),
),
h3 = TextStyle(
val h3: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontSize = 20.sp,
fontWeight = FontWeight.Medium,
letterSpacing = TextUnit(value = 0.15f, type = TextUnitType.Sp),
lineHeight = TextUnit(value = 24f, type = TextUnitType.Sp),
),
subtitle1 = TextStyle(
val subtitle1: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontSize = 16.sp,
fontWeight = FontWeight.Medium,
letterSpacing = TextUnit(value = 0.15f, type = TextUnitType.Sp),
lineHeight = TextUnit(value = 24f, type = TextUnitType.Sp),
),
subtitle2 = TextStyle(
val subtitle2: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontSize = 14.sp,
fontWeight = FontWeight.Medium,
letterSpacing = TextUnit(value = 0.5f, type = TextUnitType.Sp),
lineHeight = TextUnit(value = 24f, type = TextUnitType.Sp),
),
body1 = TextStyle(
val body1: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontSize = 16.sp,
fontWeight = FontWeight.Normal,
letterSpacing = TextUnit(value = 0.5f, type = TextUnitType.Sp),
lineHeight = TextUnit(value = 24f, type = TextUnitType.Sp),
),
body2 = TextStyle(
val body2: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontSize = 14.sp,
fontWeight = FontWeight.Normal,
letterSpacing = TextUnit(value = 0.25f, type = TextUnitType.Sp),
lineHeight = TextUnit(value = 20f, type = TextUnitType.Sp),
),
button = TextStyle(
val button: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontSize = 14.sp,
fontWeight = FontWeight.Medium,
letterSpacing = TextUnit(value = 0.1f, type = TextUnitType.Sp),
lineHeight = TextUnit(value = 16f, type = TextUnitType.Sp),
),
caption = TextStyle(
val caption1: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontSize = 12.sp,
fontWeight = FontWeight.Medium,
letterSpacing = TextUnit(value = 0.4f, type = TextUnitType.Sp),
lineHeight = TextUnit(value = 16f, type = TextUnitType.Sp),
),
val caption2: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontSize = 12.sp,
fontWeight = FontWeight.Normal,
letterSpacing = TextUnit(value = 0.4f, type = TextUnitType.Sp),
lineHeight = TextUnit(value = 16f, type = TextUnitType.Sp),
),
overline = TextStyle(
val overline: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontSize = 10.sp,
fontWeight = FontWeight.Medium,
letterSpacing = TextUnit(value = 1.5f, type = TextUnitType.Sp),

View file

@ -22,7 +22,6 @@ import com.tangem.core.ui.components.SpacerH4
import com.tangem.core.ui.extensions.resolveReference
import com.tangem.core.ui.res.TangemColorPalette
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemTypography
import com.tangem.feature.learn2earn.impl.R
import com.tangem.feature.learn2earn.presentation.ui.component.GradientCircle
import com.tangem.feature.learn2earn.presentation.ui.state.MainScreenState
@ -70,13 +69,13 @@ internal fun GetBonusView(state: MainScreenState, modifier: Modifier = Modifier)
) {
Text(
text = state.description.title.resolveReference(),
style = TangemTypography.body1,
style = TangemTheme.typography.body1,
color = TangemTheme.colors.text.primary2,
)
SpacerH4()
Text(
text = state.description.subtitle.resolveReference(),
style = TangemTypography.caption,
style = TangemTheme.typography.caption2,
color = TangemTheme.colors.text.tertiary,
)
}

View file

@ -17,7 +17,6 @@ import com.tangem.core.ui.components.SecondaryButton
import com.tangem.core.ui.components.SpacerH16
import com.tangem.core.ui.components.SpacerH32
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemTypography
import com.tangem.feature.learn2earn.impl.R
import com.tangem.feature.learn2earn.presentation.ui.component.GradientCircle
@ -106,7 +105,7 @@ private fun StoryDescription(headerText: String, bodyText: String, modifier: Mod
Text(
text = bodyText,
textAlign = TextAlign.Center,
style = TangemTypography.subtitle1,
style = TangemTheme.typography.subtitle1,
color = TangemTheme.colors.text.tertiary,
)
}

View file

@ -112,7 +112,7 @@ private fun PhraseBlock(state: ImportSeedPhraseState, modifier: Modifier = Modif
Text(
modifier = Modifier.fillMaxSize(),
text = message,
style = TangemTheme.typography.caption.copy(
style = TangemTheme.typography.caption2.copy(
color = TangemTheme.colors.text.warning,
),
)

View file

@ -26,7 +26,7 @@ internal fun AgreementText(@StringRes firstPartResId: Int, onClick: () -> Unit)
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = TangemTheme.dimens.spacing54),
style = TangemTheme.typography.caption.copy(textAlign = TextAlign.Center),
style = TangemTheme.typography.caption2.copy(textAlign = TextAlign.Center),
maxLines = 2,
onClick = {
val clickableSpanStyle = requireNotNull(agreementText.spanStyles.getOrNull(1))

View file

@ -150,7 +150,7 @@ private fun TokenItem(token: TokenToSelect, network: Network, onTokenClick: () -
SpacerW2()
Text(
text = token.symbol,
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
color = TangemTheme.colors.text.tertiary,
)
}
@ -160,7 +160,7 @@ private fun TokenItem(token: TokenToSelect, network: Network, onTokenClick: () -
if (!token.available) {
Text(
text = stringResource(id = R.string.swapping_token_not_available),
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
color = TangemTheme.colors.text.tertiary,
)
} else if (token.addedTokenBalanceData != null) {
@ -177,7 +177,7 @@ private fun TokenItem(token: TokenToSelect, network: Network, onTokenClick: () -
SpacerW2()
Text(
text = token.addedTokenBalanceData.amount.orEmpty(),
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
color = TangemTheme.colors.text.tertiary,
)
}

View file

@ -59,24 +59,22 @@ internal class TokenDetailsLoadedBalanceConverter(
return when (status.value) {
is CryptoCurrencyStatus.NoQuote,
is CryptoCurrencyStatus.Loaded,
-> {
TokenDetailsBalanceBlockState.Content(
actionButtons = currentState.actionButtons,
fiatBalance = formatFiatAmount(status.value, appCurrencyProvider()),
cryptoBalance = formatCryptoAmount(status),
)
}
is CryptoCurrencyStatus.Loading -> {
TokenDetailsBalanceBlockState.Loading(currentState.actionButtons)
}
-> TokenDetailsBalanceBlockState.Content(
actionButtons = currentState.actionButtons,
fiatBalance = formatFiatAmount(status.value, appCurrencyProvider()),
cryptoBalance = formatCryptoAmount(status),
)
is CryptoCurrencyStatus.NoAccount -> TokenDetailsBalanceBlockState.Content(
actionButtons = currentState.actionButtons,
fiatBalance = formatFiatAmount(status.value, appCurrencyProvider()),
cryptoBalance = formatCryptoAmount(status),
)
is CryptoCurrencyStatus.Loading -> TokenDetailsBalanceBlockState.Loading(currentState.actionButtons)
is CryptoCurrencyStatus.MissedDerivation,
is CryptoCurrencyStatus.NoAccount,
is CryptoCurrencyStatus.Custom,
is CryptoCurrencyStatus.NoAmount,
is CryptoCurrencyStatus.Unreachable,
-> {
TokenDetailsBalanceBlockState.Error(currentState.actionButtons)
}
-> TokenDetailsBalanceBlockState.Error(currentState.actionButtons)
}
}

View file

@ -112,13 +112,13 @@ private fun CryptoBalance(
is TokenDetailsBalanceBlockState.Content -> Text(
modifier = modifier,
text = if (isBalanceHidden) STARS else state.cryptoBalance,
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
color = TangemTheme.colors.text.tertiary,
)
is TokenDetailsBalanceBlockState.Error -> Text(
modifier = modifier,
text = BigDecimalFormatter.EMPTY_BALANCE_SIGN,
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
color = TangemTheme.colors.text.tertiary,
)
}

View file

@ -34,7 +34,7 @@ internal fun TokenInfoBlock(state: TokenInfoBlockState, modifier: Modifier = Mod
) {
Text(
text = state.name,
style = TangemTheme.typography.h1,
style = TangemTheme.typography.head,
color = TangemTheme.colors.text.primary1,
)
NetworkInfoText(state.currency)
@ -63,7 +63,7 @@ private fun NetworkInfoText(currency: TokenInfoBlockState.Currency) {
Text(
text = stringResource(id = R.string.common_main_network),
color = TangemTheme.colors.text.tertiary,
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
)
}
is TokenInfoBlockState.Currency.Token -> {
@ -74,7 +74,7 @@ private fun NetworkInfoText(currency: TokenInfoBlockState.Currency) {
val state = extractNetwork(tokenCurrency = currency)
Text(
text = state.normalText,
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
color = TangemTheme.colors.text.tertiary,
)
Icon(
@ -85,7 +85,7 @@ private fun NetworkInfoText(currency: TokenInfoBlockState.Currency) {
)
Text(
text = state.boldText,
style = TangemTheme.typography.caption.copy(fontWeight = FontWeight.Medium),
style = TangemTheme.typography.caption2.copy(fontWeight = FontWeight.Medium),
color = TangemTheme.colors.text.primary1,
)
}

View file

@ -14,7 +14,6 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemTypography
import com.tangem.feature.wallet.impl.R
import com.tangem.feature.wallet.presentation.common.state.TokenItemState
import org.burnoutcrew.reorderable.ReorderableLazyListState
@ -73,6 +72,6 @@ private fun NonFiatContentText(@StringRes text: Int) {
color = TangemTheme.colors.text.tertiary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = TangemTypography.body2,
style = TangemTheme.typography.body2,
)
}

View file

@ -11,7 +11,6 @@ import androidx.compose.ui.text.style.TextOverflow
import com.tangem.common.Strings
import com.tangem.core.ui.components.RectangleShimmer
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemTypography
import com.tangem.feature.wallet.impl.R
import com.tangem.feature.wallet.presentation.common.state.TokenItemState.CryptoAmountState as TokenCryptoAmountState
@ -49,7 +48,7 @@ private fun CryptoAmountText(amount: String, modifier: Modifier = Modifier) {
color = TangemTheme.colors.text.tertiary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = TangemTypography.body2,
style = TangemTheme.typography.body2,
)
}

View file

@ -10,7 +10,6 @@ import androidx.compose.ui.text.style.TextOverflow
import com.tangem.common.Strings
import com.tangem.core.ui.components.RectangleShimmer
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemTypography
import com.tangem.feature.wallet.presentation.common.state.TokenItemState.FiatAmountState as TokenFiatAmountState
@Composable
@ -40,7 +39,7 @@ private fun FiatAmountText(text: String, modifier: Modifier = Modifier) {
color = TangemTheme.colors.text.primary1,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = TangemTypography.body2,
style = TangemTheme.typography.body2,
)
}

View file

@ -15,7 +15,6 @@ import com.tangem.core.ui.components.RectangleShimmer
import com.tangem.core.ui.components.SpacerW4
import com.tangem.core.ui.components.marketprice.PriceChangeType
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemTypography
import com.tangem.feature.wallet.impl.R
import com.tangem.feature.wallet.presentation.common.state.TokenItemState
import com.tangem.feature.wallet.presentation.common.state.TokenItemState.PriceChangeState as TokenPriceChangeState
@ -87,7 +86,7 @@ private fun PriceChangeText(type: PriceChangeType?, text: String?) {
},
overflow = TextOverflow.Ellipsis,
maxLines = 1,
style = TangemTypography.body2,
style = TangemTheme.typography.body2,
)
}
}

View file

@ -15,7 +15,6 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextOverflow
import com.tangem.core.ui.components.RectangleShimmer
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemTypography
import com.tangem.feature.wallet.impl.R
import com.tangem.feature.wallet.presentation.common.state.TokenItemState.TitleState as TokenTitleState
@ -63,7 +62,7 @@ private fun CurrencyNameText(name: String, modifier: Modifier = Modifier) {
color = TangemTheme.colors.text.primary1,
overflow = TextOverflow.Ellipsis,
maxLines = 1,
style = TangemTypography.subtitle2,
style = TangemTheme.typography.subtitle2,
)
}

View file

@ -361,7 +361,7 @@ private fun AdditionalInfoText(text: TextReference) {
color = TangemTheme.colors.text.tertiary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
)
}

View file

@ -82,7 +82,7 @@ private fun LazyListScope.nonContentItem(modifier: Modifier = Modifier) {
modifier = Modifier.padding(horizontal = TangemTheme.dimens.spacing48),
color = TangemTheme.colors.text.tertiary,
textAlign = TextAlign.Center,
style = TangemTheme.typography.caption,
style = TangemTheme.typography.caption2,
)
}
}