From 15a1d52c3a2c3c0bb313bf7006b77b97fc96b81e Mon Sep 17 00:00:00 2001 From: Denis Lyazgin Date: Fri, 8 Dec 2023 12:48:46 +0700 Subject: [PATCH] Fix pool staking welcome title --- build.gradle | 2 +- .../common/compose/component/Text.kt | 20 ++++++++++++++++++ .../setup/pool/StartStakingPoolScreen.kt | 21 +++++++++++-------- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index b5e0de2e59..73b09e8b85 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { ext { // App version versionName = '3.1.1' - versionCode = 135 + versionCode = 136 // SDK and tools compileSdkVersion = 34 diff --git a/common/src/main/java/jp/co/soramitsu/common/compose/component/Text.kt b/common/src/main/java/jp/co/soramitsu/common/compose/component/Text.kt index 9f33bd6e25..bf8ee3fc83 100644 --- a/common/src/main/java/jp/co/soramitsu/common/compose/component/Text.kt +++ b/common/src/main/java/jp/co/soramitsu/common/compose/component/Text.kt @@ -174,6 +174,26 @@ fun H2( ) } +@Composable +fun H2( + modifier: Modifier = Modifier, + text: AnnotatedString, + textAlign: TextAlign? = null, + color: Color = Color.Unspecified, + overflow: TextOverflow = TextOverflow.Clip, + maxLines: Int = Int.MAX_VALUE +) { + Text( + textAlign = textAlign, + text = text, + style = MaterialTheme.customTypography.header2, + modifier = modifier, + color = color, + overflow = overflow, + maxLines = maxLines + ) +} + @Composable fun H3( modifier: Modifier = Modifier, diff --git a/feature-staking-impl/src/main/java/jp/co/soramitsu/staking/impl/presentation/setup/pool/StartStakingPoolScreen.kt b/feature-staking-impl/src/main/java/jp/co/soramitsu/staking/impl/presentation/setup/pool/StartStakingPoolScreen.kt index 96502ce1f8..ea07ed6081 100644 --- a/feature-staking-impl/src/main/java/jp/co/soramitsu/staking/impl/presentation/setup/pool/StartStakingPoolScreen.kt +++ b/feature-staking-impl/src/main/java/jp/co/soramitsu/staking/impl/presentation/setup/pool/StartStakingPoolScreen.kt @@ -15,7 +15,6 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState -import androidx.compose.ui.Alignment.Companion.CenterHorizontally import androidx.compose.ui.Alignment.Companion.CenterVertically import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource @@ -26,12 +25,12 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.withStyle import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp import jp.co.soramitsu.common.compose.component.AccentButton import jp.co.soramitsu.common.compose.component.BackgroundCornered import jp.co.soramitsu.common.compose.component.BottomSheetScreen import jp.co.soramitsu.common.compose.component.ColoredTextButton import jp.co.soramitsu.common.compose.component.GrayButton -import jp.co.soramitsu.common.compose.component.H1 import jp.co.soramitsu.common.compose.component.H2 import jp.co.soramitsu.common.compose.component.H4 import jp.co.soramitsu.common.compose.component.H6 @@ -90,17 +89,21 @@ fun StartStakingPoolScreen( MarginVertical(margin = 16.dp) WhatIsStakingCard(instructionsClick) MarginVertical(margin = 16.dp) + + val formattedTitle = stringResource(id = R.string.staking_pool_start_earn_reward_title, state.assetName.uppercase()) + val startValueIndex = formattedTitle.indexOf(state.assetName.uppercase()) + val endValueIndex = startValueIndex + state.assetName.uppercase().length + H2( - text = stringResource(id = R.string.staking_pool_start_earn_reward_title), + text = buildAnnotatedString { + withStyle(style = SpanStyle(color = black2)) { + append(formattedTitle) + } + addStyle(SpanStyle(color = colorAccentDark, fontSize = 30.sp), startValueIndex, endValueIndex) + }, textAlign = TextAlign.Center, color = black2 ) - MarginVertical(margin = 8.dp) - H1( - text = state.assetName.uppercase(), - modifier = Modifier.align(CenterHorizontally), - color = colorAccentDark - ) MarginVertical(margin = 24.dp) SingleValueInfoCard(R.drawable.ic_chart, R.string.staking_pool_rewards_delay_text, state.rewardsPayoutDelay) MarginVertical(margin = 8.dp)