diff --git a/app/src/main/java/com/tangem/tap/common/compose/TangemTypography.kt b/app/src/main/java/com/tangem/tap/common/compose/TangemTypography.kt deleted file mode 100644 index 2013295f25..0000000000 --- a/app/src/main/java/com/tangem/tap/common/compose/TangemTypography.kt +++ /dev/null @@ -1,71 +0,0 @@ -package com.tangem.tap.common.compose - -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.text.font.Font -import androidx.compose.ui.text.font.FontFamily -import androidx.compose.ui.unit.sp -import com.tangem.wallet.R - -object TangemTypography { - - val body1 = TextStyle( - fontFamily = FontFamily(Font(R.font.roboto_regular)), - fontSize = 16.0.sp, - letterSpacing = 0.5.sp, - lineHeight = 24.0.sp, - ) - val body2 = TextStyle( - fontFamily = FontFamily(Font(R.font.roboto_regular)), - fontSize = 14.0.sp, - letterSpacing = 0.25.sp, - lineHeight = 20.0.sp, - ) - val button = TextStyle( - fontFamily = FontFamily(Font(R.font.roboto_medium)), - fontSize = 14.0.sp, - letterSpacing = 0.10000000149011612.sp, - lineHeight = 20.0.sp, - ) - val caption = TextStyle( - fontFamily = FontFamily(Font(R.font.roboto_regular)), - fontSize = 12.0.sp, - letterSpacing = 0.4000000059604645.sp, - lineHeight = 16.0.sp, - ) - val headline1 = TextStyle( - fontFamily = FontFamily(Font(R.font.roboto_regular)), - fontSize = 34.0.sp, - letterSpacing = 0.0.sp, - lineHeight = 44.0.sp, - ) - val headline2 = TextStyle( - fontFamily = FontFamily(Font(R.font.roboto_medium)), - fontSize = 24.0.sp, - letterSpacing = 0.18000000715255737.sp, - lineHeight = 32.0.sp, - ) - val headline3 = TextStyle( - fontFamily = FontFamily(Font(R.font.roboto_medium)), - fontSize = 20.0.sp, - letterSpacing = 0.15000000596046448.sp, - lineHeight = 24.0.sp, - ) - val overline = TextStyle( - fontFamily = FontFamily(Font(R.font.roboto_medium)), - fontSize = 10.0.sp, - letterSpacing = 1.5.sp, - lineHeight = 16.0.sp, - ) - val subtitle1 = TextStyle( - fontFamily = FontFamily(Font(R.font.roboto_medium)), - fontSize = 16.0.sp, - letterSpacing = 0.15000000596046448.sp, - lineHeight = 24.0.sp, - ) - val subtitle2 = TextStyle( - fontFamily = FontFamily(Font(R.font.roboto_medium)), - fontSize = 14.0.sp, - letterSpacing = 0.10000000149011612.sp, - lineHeight = 24.0.sp, - ) -} \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/CardSettingsScreen.kt b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/CardSettingsScreen.kt index 44b2a45efe..29906fd0e0 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/CardSettingsScreen.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/cardsettings/CardSettingsScreen.kt @@ -24,7 +24,6 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.tangem.core.ui.res.TangemTheme -import com.tangem.tap.common.compose.TangemTypography import com.tangem.tap.features.details.ui.common.DetailsMainButton import com.tangem.tap.features.details.ui.common.SettingsScreensScaffold import com.tangem.wallet.R @@ -86,13 +85,13 @@ fun CardSettingsReadCard(onScanCardClick: () -> Unit) { Text( text = stringResource(id = R.string.scan_card_settings_title), color = colorResource(id = R.color.text_primary_1), - style = TangemTypography.headline3, + style = TangemTheme.typography.h3, ) Spacer(modifier = Modifier.size(20.dp)) Text( text = stringResource(id = R.string.scan_card_settings_message), color = colorResource(id = R.color.text_secondary), - style = TangemTypography.body1, + style = TangemTheme.typography.body1, modifier = Modifier .verticalScroll(rememberScrollState()) .weight(weight = 1f, fill = false), diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/common/DetailsComposeElements.kt b/app/src/main/java/com/tangem/tap/features/details/ui/common/DetailsComposeElements.kt index c65fe7128b..38fdbe45f6 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/common/DetailsComposeElements.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/common/DetailsComposeElements.kt @@ -27,7 +27,6 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.tangem.core.ui.components.PrimaryButtonIconRight import com.tangem.core.ui.res.TangemTheme -import com.tangem.tap.common.compose.TangemTypography import com.tangem.wallet.R @Composable @@ -145,13 +144,13 @@ fun DetailsRadioButtonElement(title: String, subtitle: String, selected: Boolean Column { Text( text = title, - style = TangemTypography.subtitle1, + style = TangemTheme.typography.subtitle1, color = colorResource(id = R.color.text_primary_1), ) Spacer(modifier = Modifier.size(4.dp)) Text( text = subtitle, - style = TangemTypography.body2, + style = TangemTheme.typography.body2, color = colorResource(id = R.color.text_secondary), ) } diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/details/DetailsScreen.kt b/app/src/main/java/com/tangem/tap/features/details/ui/details/DetailsScreen.kt index f2fd8a3b07..f05682f878 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/details/DetailsScreen.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/details/DetailsScreen.kt @@ -35,7 +35,6 @@ import androidx.compose.ui.unit.dp import com.tangem.core.ui.components.SystemBarsEffect import com.tangem.core.ui.res.TangemColorPalette import com.tangem.core.ui.res.TangemTheme -import com.tangem.tap.common.compose.TangemTypography import com.tangem.tap.features.details.ui.common.ScreenTitle import com.tangem.tap.features.details.ui.common.SettingsScreensScaffold import com.tangem.wallet.R @@ -78,7 +77,7 @@ fun Content(state: DetailsScreenState) { Spacer(modifier = Modifier.size(12.dp)) Text( text = "${stringResource(id = state.appNameRes)} ${state.tangemVersion}", - style = TangemTypography.caption, + style = TangemTheme.typography.caption, color = colorResource(id = R.color.text_tertiary), modifier = Modifier.padding(start = 16.dp, end = 16.dp, bottom = 40.dp), ) @@ -111,13 +110,13 @@ fun WalletConnectDetailsItem(onItemsClick: (SettingsElement) -> Unit) { Text( text = stringResource(id = R.string.wallet_connect_title), modifier = Modifier.padding(end = 20.dp, bottom = 4.dp), - style = TangemTypography.headline3, + style = TangemTheme.typography.h3, color = colorResource(id = R.color.text_primary_1), ) Text( text = stringResource(id = R.string.wallet_connect_subtitle), modifier = Modifier.padding(end = 20.dp, bottom = 4.dp), - style = TangemTypography.body1, + style = TangemTheme.typography.body1, color = colorResource(id = R.color.text_secondary), ) } @@ -144,13 +143,13 @@ fun DetailsItem(item: SettingsElement, appCurrency: String, onItemsClick: () -> Text( text = stringResource(id = item.titleRes), modifier = Modifier, - style = TangemTypography.subtitle1, + style = TangemTheme.typography.subtitle1, color = colorResource(id = R.color.text_primary_1), ) if (item == SettingsElement.AppCurrency) { Text( text = appCurrency, - style = TangemTypography.body2, + style = TangemTheme.typography.body2, color = colorResource(id = R.color.text_secondary), ) } diff --git a/app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/WalletConnectScreen.kt b/app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/WalletConnectScreen.kt index 7b14107334..ba234154d5 100644 --- a/app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/WalletConnectScreen.kt +++ b/app/src/main/java/com/tangem/tap/features/details/ui/walletconnect/WalletConnectScreen.kt @@ -31,8 +31,8 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.tangem.core.analytics.Analytics +import com.tangem.core.ui.res.TangemTheme import com.tangem.tap.common.analytics.events.Settings -import com.tangem.tap.common.compose.TangemTypography import com.tangem.tap.common.extensions.getFromClipboard import com.tangem.tap.features.details.ui.common.SettingsScreensScaffold import com.tangem.wallet.R @@ -105,7 +105,7 @@ private fun EmptyScreen(state: WalletConnectScreenState) { Spacer(modifier = Modifier.size(24.dp)) Text( text = stringResource(id = R.string.wallet_connect_subtitle), - style = TangemTypography.body2, + style = TangemTheme.typography.body2, color = colorResource(id = R.color.text_tertiary), ) } @@ -138,7 +138,7 @@ private fun WalletConnectSessions(state: WalletConnectScreenState) { ) { Text( text = session.description, - style = TangemTypography.subtitle1, + style = TangemTheme.typography.subtitle1, color = colorResource(id = R.color.text_primary_1), modifier = Modifier.weight(1f), ) diff --git a/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokenItem.kt b/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokenItem.kt index b3ee9856f3..46fc3f7554 100644 --- a/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokenItem.kt +++ b/app/src/main/java/com/tangem/tap/features/tokens/impl/presentation/ui/TokenItem.kt @@ -10,12 +10,9 @@ import androidx.compose.animation.scaleIn import androidx.compose.animation.scaleOut import androidx.compose.animation.shrinkVertically import androidx.compose.animation.with -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.foundation.shape.CircleShape import androidx.compose.material.Icon import androidx.compose.material.IconButton import androidx.compose.material.Text @@ -24,18 +21,17 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource -import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.constraintlayout.compose.ConstraintLayout import androidx.constraintlayout.compose.Dimension import coil.compose.SubcomposeAsyncImage import coil.request.ImageRequest +import com.tangem.core.ui.components.CurrencyPlaceholderIcon import com.tangem.core.ui.res.TangemTheme import com.tangem.tap.common.compose.extensions.toPx import com.tangem.tap.features.tokens.impl.presentation.states.TokenItemState @@ -134,28 +130,11 @@ private fun Icon(name: String, iconUrl: String, modifier: Modifier = Modifier) { .crossfade(enable = true) .build(), contentDescription = null, - loading = { PlaceholderIcon(name = name, modifier = iconModifier) }, - error = { PlaceholderIcon(name = name, modifier = iconModifier) }, + loading = { CurrencyPlaceholderIcon(id = name, modifier = iconModifier) }, + error = { CurrencyPlaceholderIcon(id = name, modifier = iconModifier) }, ) } -// TODO(use CurrencyPlaceholderIcon here?) -@Composable -private fun PlaceholderIcon(name: String, modifier: Modifier = Modifier) { - Box( - contentAlignment = Alignment.Center, - modifier = modifier.background(TangemTheme.colors.icon.primary1, shape = CircleShape), - ) { - Text( - text = name.firstOrNull()?.titlecase() ?: "", - color = TangemTheme.colors.icon.primary2, - maxLines = 1, - // FIXME("Incorrect typography. Replace with typography from design system") - style = TangemTheme.typography.h3.copy(fontWeight = FontWeight.Bold), - ) - } -} - @Composable private fun Title(title: String, modifier: Modifier = Modifier) { Text( diff --git a/app/src/main/java/com/tangem/tap/features/walletSelector/ui/components/WalletItem.kt b/app/src/main/java/com/tangem/tap/features/walletSelector/ui/components/WalletItem.kt index 40f87ab080..03d505e048 100644 --- a/app/src/main/java/com/tangem/tap/features/walletSelector/ui/components/WalletItem.kt +++ b/app/src/main/java/com/tangem/tap/features/walletSelector/ui/components/WalletItem.kt @@ -21,7 +21,6 @@ import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.BlendMode @@ -41,7 +40,6 @@ import com.tangem.core.ui.components.SpacerW6 import com.tangem.core.ui.components.SpacerW8 import com.tangem.core.ui.res.TangemTheme import com.tangem.domain.common.util.UserWalletId -import com.tangem.tap.common.compose.TangemTypography import com.tangem.tap.common.extensions.cardImageData import com.tangem.tap.features.walletSelector.ui.model.MultiCurrencyUserWalletItem import com.tangem.tap.features.walletSelector.ui.model.SingleCurrencyUserWalletItem @@ -136,7 +134,6 @@ private fun WalletCardImage(cardImageUrl: String, isChecked: Boolean, isSelected } } -@OptIn(ExperimentalComposeUiApi::class) @Composable private fun RowScope.WalletInfo(wallet: UserWalletItem, isSelected: Boolean) { Column( @@ -149,7 +146,7 @@ private fun RowScope.WalletInfo(wallet: UserWalletItem, isSelected: Boolean) { color = if (isSelected) TangemTheme.colors.text.accent else TangemTheme.colors.text.primary1, overflow = TextOverflow.Ellipsis, maxLines = 1, - style = TangemTypography.subtitle1, + style = TangemTheme.typography.subtitle1, ) SpacerH2() Text( @@ -227,7 +224,6 @@ private fun LoadingTokensInfo(isMultiCurrencyWallet: Boolean) { } } -@OptIn(ExperimentalComposeUiApi::class) @Composable private fun LoadedTokensInfo( balanceAmount: String, diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/CurrencyPlaceholderIcon.kt b/core/ui/src/main/java/com/tangem/core/ui/components/CurrencyPlaceholderIcon.kt index 24434c3c80..8d10e7486c 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/CurrencyPlaceholderIcon.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/CurrencyPlaceholderIcon.kt @@ -8,30 +8,30 @@ import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.sp import com.tangem.core.ui.res.TangemTheme +/** + * Currency placeholder icon + * + * @param id currency id + * @param modifier modifier + */ @Composable fun CurrencyPlaceholderIcon(id: String, modifier: Modifier = Modifier) { - val letterColor: Color = TangemTheme.colors.text.primary2 - val circleColor: Color = TangemTheme.colors.icon.secondary - Box( contentAlignment = Alignment.Center, - modifier = modifier - .background(circleColor, shape = CircleShape), + modifier = modifier.background(color = TangemTheme.colors.icon.secondary, shape = CircleShape), ) { Text( - text = id.firstOrNull()?.titlecase() ?: "", - textAlign = TextAlign.Center, - color = letterColor, + text = id.firstOrNull()?.titlecase().orEmpty(), modifier = Modifier.padding(TangemTheme.dimens.spacing4), - fontSize = 20.sp, - fontWeight = FontWeight.Bold, + color = TangemTheme.colors.text.primary2, + textAlign = TextAlign.Center, + // FIXME("Incorrect typography. Replace with typography from design system") + style = TangemTheme.typography.h3.copy(fontWeight = FontWeight.Bold), ) } } diff --git a/core/ui/src/main/java/com/tangem/core/ui/res/TangemTypography.kt b/core/ui/src/main/java/com/tangem/core/ui/res/TangemTypography.kt index 89ec283924..bdcd413dbd 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/res/TangemTypography.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/res/TangemTypography.kt @@ -5,7 +5,6 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.Font import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.unit.ExperimentalUnitApi import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.TextUnitType import androidx.compose.ui.unit.sp @@ -16,67 +15,66 @@ private val RobotoFamily = FontFamily( Font(R.font.roboto_medium, FontWeight.Medium), ) -@OptIn(ExperimentalUnitApi::class) val TangemTypography = Typography( defaultFontFamily = RobotoFamily, h1 = TextStyle( fontSize = 34.sp, fontWeight = FontWeight.Normal, - letterSpacing = TextUnit(0f, TextUnitType.Sp), - lineHeight = TextUnit(44f, TextUnitType.Sp), + letterSpacing = TextUnit(value = 0f, type = TextUnitType.Sp), + lineHeight = TextUnit(value = 44f, type = TextUnitType.Sp), ), h2 = TextStyle( fontSize = 24.sp, fontWeight = FontWeight.Medium, - letterSpacing = TextUnit(0.18f, TextUnitType.Sp), - lineHeight = TextUnit(32f, TextUnitType.Sp), + letterSpacing = TextUnit(value = 0.18f, type = TextUnitType.Sp), + lineHeight = TextUnit(value = 32f, type = TextUnitType.Sp), ), h3 = TextStyle( fontSize = 20.sp, fontWeight = FontWeight.Medium, - letterSpacing = TextUnit(0.15f, TextUnitType.Sp), - lineHeight = TextUnit(24f, TextUnitType.Sp), + letterSpacing = TextUnit(value = 0.15f, type = TextUnitType.Sp), + lineHeight = TextUnit(value = 24f, type = TextUnitType.Sp), ), subtitle1 = TextStyle( fontSize = 16.sp, fontWeight = FontWeight.Medium, - letterSpacing = TextUnit(0.15f, TextUnitType.Sp), - lineHeight = TextUnit(24f, TextUnitType.Sp), + letterSpacing = TextUnit(value = 0.15f, type = TextUnitType.Sp), + lineHeight = TextUnit(value = 24f, type = TextUnitType.Sp), ), subtitle2 = TextStyle( fontSize = 14.sp, fontWeight = FontWeight.Medium, - letterSpacing = TextUnit(0.5f, TextUnitType.Sp), - lineHeight = TextUnit(24f, TextUnitType.Sp), + letterSpacing = TextUnit(value = 0.5f, type = TextUnitType.Sp), + lineHeight = TextUnit(value = 24f, type = TextUnitType.Sp), ), body1 = TextStyle( fontSize = 16.sp, fontWeight = FontWeight.Normal, - letterSpacing = TextUnit(0.5f, TextUnitType.Sp), - lineHeight = TextUnit(24f, TextUnitType.Sp), + letterSpacing = TextUnit(value = 0.5f, type = TextUnitType.Sp), + lineHeight = TextUnit(value = 24f, type = TextUnitType.Sp), ), body2 = TextStyle( fontSize = 14.sp, fontWeight = FontWeight.Normal, - letterSpacing = TextUnit(0.25f, TextUnitType.Sp), - lineHeight = TextUnit(20f, TextUnitType.Sp), + letterSpacing = TextUnit(value = 0.25f, type = TextUnitType.Sp), + lineHeight = TextUnit(value = 20f, type = TextUnitType.Sp), ), button = TextStyle( fontSize = 14.sp, fontWeight = FontWeight.Medium, - letterSpacing = TextUnit(0.1f, TextUnitType.Sp), - lineHeight = TextUnit(16f, TextUnitType.Sp), + letterSpacing = TextUnit(value = 0.1f, type = TextUnitType.Sp), + lineHeight = TextUnit(value = 16f, type = TextUnitType.Sp), ), caption = TextStyle( fontSize = 12.sp, fontWeight = FontWeight.Normal, - letterSpacing = TextUnit(0.4f, TextUnitType.Sp), - lineHeight = TextUnit(16f, TextUnitType.Sp), + letterSpacing = TextUnit(value = 0.4f, type = TextUnitType.Sp), + lineHeight = TextUnit(value = 16f, type = TextUnitType.Sp), ), overline = TextStyle( fontSize = 10.sp, fontWeight = FontWeight.Medium, - letterSpacing = TextUnit(1.5f, TextUnitType.Sp), - lineHeight = TextUnit(16f, TextUnitType.Sp), + letterSpacing = TextUnit(value = 1.5f, type = TextUnitType.Sp), + lineHeight = TextUnit(value = 16f, type = TextUnitType.Sp), ), ) \ No newline at end of file