Updated on 2026-08-14

This commit is contained in:
Tangem 2023-05-19 09:27:06 +08:00
parent f08b093419
commit 49726e251e
9 changed files with 48 additions and 149 deletions

View file

@ -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,
)
}

View file

@ -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),

View file

@ -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),
)
}

View file

@ -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),
)
}

View file

@ -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),
)

View file

@ -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(

View file

@ -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,