From a531f558f82b0bba0ba6338ce95b9ca0a9f8602d Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 24 Jun 2022 16:27:38 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../features/home/compose/content/Content.kt | 90 +++++++------------ app/src/main/res/values-de/strings_final.xml | 4 +- app/src/main/res/values-fr/strings_final.xml | 4 +- app/src/main/res/values-it/strings_final.xml | 4 +- app/src/main/res/values-ru/strings_final.xml | 4 +- app/src/main/res/values/strings_final.xml | 4 +- 6 files changed, 49 insertions(+), 61 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/home/compose/content/Content.kt b/app/src/main/java/com/tangem/tap/features/home/compose/content/Content.kt index 597f913ef4..97e523358b 100644 --- a/app/src/main/java/com/tangem/tap/features/home/compose/content/Content.kt +++ b/app/src/main/java/com/tangem/tap/features/home/compose/content/Content.kt @@ -1,11 +1,5 @@ package com.tangem.tap.features.home.compose.content -import android.content.Context -import android.graphics.Typeface -import android.util.TypedValue -import android.view.View -import android.view.ViewGroup -import android.widget.TextView import androidx.annotation.DrawableRes import androidx.compose.foundation.Image import androidx.compose.foundation.layout.* @@ -17,15 +11,16 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.AnnotatedString +import androidx.compose.ui.text.SpanStyle +import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.text.withStyle import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import androidx.compose.ui.viewinterop.AndroidView -import com.tangem.tangem_sdk_new.extensions.dpToPx import com.tangem.tap.common.compose.SpacerH16 import com.tangem.tap.common.compose.SpacerH32 -import com.tangem.tap.common.compose.extensions.toAndroidGraphicsColor import com.tangem.tap.features.home.compose.StoriesBottomImageAnimation import com.tangem.tap.features.home.compose.StoriesTextAnimation import com.tangem.wallet.R @@ -36,7 +31,7 @@ fun StoriesRevolutionaryWallet(stepDuration: Int) { topContent = { TopContent( titleText = stringResource(id = R.string.story_awe_title), - subtitleText = stringResource(id = R.string.story_awe_description), + subtitleText = stringResource(id = R.string.story_awe_description).annotated(), isDarkBackground = true, ) }, @@ -57,11 +52,20 @@ fun StoriesRevolutionaryWallet(stepDuration: Int) { @Composable fun StoriesUltraSecureBackup(isPaused: Boolean, stepDuration: Int) { + val subtitleText = buildAnnotatedString { + append(stringResource(id = R.string.story_backup_description_1)) + append(" ") + withStyle(style = SpanStyle(fontWeight = FontWeight.Bold)) { + append(stringResource(id = R.string.story_backup_description_2_bold)) + } + append(" ") + append(stringResource(id = R.string.story_backup_description_3)) + } SplitContent( topContent = { TopContent( titleText = stringResource(id = R.string.story_backup_title), - subtitleText = stringResource(id = R.string.story_backup_description), + subtitleText = subtitleText, isDarkBackground = false, ) }, @@ -77,7 +81,7 @@ fun StoriesCurrencies(isPaused: Boolean, stepDuration: Int) { topContent = { TopContent( titleText = stringResource(id = R.string.story_currencies_title), - subtitleText = stringResource(id = R.string.story_currencies_description), + subtitleText = stringResource(id = R.string.story_currencies_description).annotated(), isDarkBackground = false, ) }, @@ -93,7 +97,7 @@ fun StoriesWeb3(isPaused: Boolean, stepDuration: Int) { topContent = { TopContent( titleText = stringResource(id = R.string.story_web3_title), - subtitleText = stringResource(id = R.string.story_web3_description), + subtitleText = stringResource(id = R.string.story_web3_description).annotated(), isDarkBackground = false, ) }, @@ -109,7 +113,7 @@ fun StoriesWalletForEveryone(stepDuration: Int) { topContent = { TopContent( titleText = stringResource(id = R.string.story_finish_title), - subtitleText = stringResource(id = R.string.story_finish_description), + subtitleText = stringResource(id = R.string.story_finish_description).annotated(), isDarkBackground = true, ) }, @@ -147,9 +151,8 @@ private fun SplitContent( @Composable private fun TopContent( titleText: String, - subtitleText: String, + subtitleText: AnnotatedString, isDarkBackground: Boolean, - subtitleTextId: Int? = null, ) { SpacerH32() StoriesTitleText( @@ -159,7 +162,6 @@ private fun TopContent( SpacerH16() StoriesSubtitleText( subtitleText = subtitleText, - subtitleTextId = subtitleTextId, ) SpacerH32() } @@ -187,8 +189,7 @@ private fun StoriesTitleText( @Composable private fun StoriesSubtitleText( - subtitleText: String, - subtitleTextId: Int?, + subtitleText: AnnotatedString, ) { val color = Color(0xFFA6AAAD) @@ -196,46 +197,18 @@ private fun StoriesSubtitleText( slideInDuration = 500, slideInDelay = 400, ) { modifier -> - val internalModifier = modifier - .padding(start = 40.dp, end = 40.dp) - - if (subtitleTextId == null) { - Text( - text = subtitleText, - fontSize = 20.sp, - fontWeight = FontWeight.Normal, - modifier = internalModifier, - color = color, - textAlign = TextAlign.Center - ) - } else { - HtmlText( - modifier = internalModifier, - stringResId = subtitleTextId, - ) { context -> - val padding = context.dpToPx(40f).toInt() - TextView(context).apply { - layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) - setPadding(padding, 0, padding, 0) - textAlignment = View.TEXT_ALIGNMENT_CENTER - typeface = Typeface.DEFAULT - setTextSize(TypedValue.COMPLEX_UNIT_SP, 20f) - setTextColor(color.toAndroidGraphicsColor()) - } - } - } + Text( + modifier = modifier + .padding(start = 40.dp, end = 40.dp), + fontWeight = FontWeight.Normal, + text = subtitleText, + fontSize = 20.sp, + color = color, + textAlign = TextAlign.Center + ) } } -@Composable -private fun HtmlText( - stringResId: Int, - modifier: Modifier = Modifier, - factory: (Context) -> TextView -) { - AndroidView(factory, modifier) { it.text = it.context.getText(stringResId) } -} - @Composable private fun StoriesImage( modifier: Modifier = Modifier, @@ -248,4 +221,9 @@ private fun StoriesImage( contentScale = if (isDarkBackground) ContentScale.Inside else ContentScale.FillWidth, modifier = modifier.fillMaxWidth() ) +} + +private fun String.annotated(): AnnotatedString { + val source = this + return buildAnnotatedString { append(source) } } \ No newline at end of file diff --git a/app/src/main/res/values-de/strings_final.xml b/app/src/main/res/values-de/strings_final.xml index de09eb54fd..3c887d74f0 100644 --- a/app/src/main/res/values-de/strings_final.xml +++ b/app/src/main/res/values-de/strings_final.xml @@ -23,7 +23,9 @@ Revolutionary Hardware Wallet Store your crypto assets secure while keeping private keys contained in your card Ultra Secure Backup - Up to 3 physical cards to one wallet + Up to + 3 physical cards + to one wallet Thousands of Currencies A hardware wallet for your Bitcoin, Ethereum and many more currencies simultaneously – all in one card DeFi Compatible diff --git a/app/src/main/res/values-fr/strings_final.xml b/app/src/main/res/values-fr/strings_final.xml index de09eb54fd..3c887d74f0 100644 --- a/app/src/main/res/values-fr/strings_final.xml +++ b/app/src/main/res/values-fr/strings_final.xml @@ -23,7 +23,9 @@ Revolutionary Hardware Wallet Store your crypto assets secure while keeping private keys contained in your card Ultra Secure Backup - Up to 3 physical cards to one wallet + Up to + 3 physical cards + to one wallet Thousands of Currencies A hardware wallet for your Bitcoin, Ethereum and many more currencies simultaneously – all in one card DeFi Compatible diff --git a/app/src/main/res/values-it/strings_final.xml b/app/src/main/res/values-it/strings_final.xml index de09eb54fd..3c887d74f0 100644 --- a/app/src/main/res/values-it/strings_final.xml +++ b/app/src/main/res/values-it/strings_final.xml @@ -23,7 +23,9 @@ Revolutionary Hardware Wallet Store your crypto assets secure while keeping private keys contained in your card Ultra Secure Backup - Up to 3 physical cards to one wallet + Up to + 3 physical cards + to one wallet Thousands of Currencies A hardware wallet for your Bitcoin, Ethereum and many more currencies simultaneously – all in one card DeFi Compatible diff --git a/app/src/main/res/values-ru/strings_final.xml b/app/src/main/res/values-ru/strings_final.xml index 201a1684ae..2147b19938 100644 --- a/app/src/main/res/values-ru/strings_final.xml +++ b/app/src/main/res/values-ru/strings_final.xml @@ -23,7 +23,9 @@ Революционный аппаратный кошелек Держите свои криптосбережения в безопасности. Приватные ключи надежно хранятся на карте. Все ключи в безопасности - До трех карт с одним кошельком + До + трех карт + с одним кошельком Тысячи криптовалют Аппаратный кошелек для ваших биткоинов, эфира и многих других валют одновременно — все в одной карте Поддержка DeFi diff --git a/app/src/main/res/values/strings_final.xml b/app/src/main/res/values/strings_final.xml index d59d31ff0e..9190d7c980 100644 --- a/app/src/main/res/values/strings_final.xml +++ b/app/src/main/res/values/strings_final.xml @@ -23,7 +23,9 @@ Revolutionary Hardware Wallet Store your crypto assets secure while keeping private keys contained in your card Ultra Secure Backup - Up to 3 physical cards to one wallet + Up to + 3 physical cards + to one wallet Thousands of Currencies A hardware wallet for your Bitcoin, Ethereum and many more currencies simultaneously – all in one card DeFi Compatible