From 85858df71a8517b67799642c40f83bf484e18121 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 12 Jun 2026 11:18:11 +0200 Subject: [PATCH] Updated on 2026-08-14 --- .../ui/amountScreen/ui/AmountFieldV2.kt | 5 ++- .../ui/components/fields/AmountTextField.kt | 28 +++++++++++---- .../inputrow/InputRowEnterAmount.kt | 3 +- .../inputrow/InputRowEnterInfoAmount.kt | 9 +++-- .../onramp/main/ui/OnrampAmountContent.kt | 7 ++-- .../setup/TangemPayCardLimitSetupScreen.kt | 7 ++-- .../setup/TangemPayCardLimitSetupScreenV2.kt | 35 ++++++++++--------- .../tangempay/ui/TangemPayDailyLimitBlock.kt | 2 +- 8 files changed, 64 insertions(+), 32 deletions(-) diff --git a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/ui/AmountFieldV2.kt b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/ui/AmountFieldV2.kt index 9fdb77d943..f908599c03 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/amountScreen/ui/AmountFieldV2.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/amountScreen/ui/AmountFieldV2.kt @@ -40,6 +40,7 @@ import com.tangem.core.ui.components.TextShimmer import com.tangem.core.ui.components.currency.fiaticon.FiatIcon import com.tangem.core.ui.components.currency.icon.CurrencyIcon import com.tangem.core.ui.components.fields.AmountTextField +import com.tangem.core.ui.components.fields.TangemAmountTextFieldColors import com.tangem.core.ui.components.fields.visualtransformations.AmountVisualTransformation import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.resolveReference @@ -89,6 +90,7 @@ fun AmountFieldV2( } else { amountUM.amountTextField.cryptoAmount to amountUM.amountTextField.value } + val colors = TangemAmountTextFieldColors AmountTextField( value = primaryValue, decimals = primaryAmount.decimals, @@ -97,9 +99,10 @@ fun AmountFieldV2( symbol = primaryAmount.currencySymbol, currencyCode = currencyCode, decimalFormat = decimalFormat, - symbolColor = TangemTheme.colors.text.disabled, + symbolColor = colors.disabledTextColor, ), onValueChange = onValueChange, + colors = colors, keyboardOptions = amountUM.amountTextField.keyboardOptions, keyboardActions = amountUM.amountTextField.keyboardActions, textStyle = TangemTheme.typography.head.copy( diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/fields/AmountTextField.kt b/core/ui/src/main/java/com/tangem/core/ui/components/fields/AmountTextField.kt index 0fd7e5f505..d23890385d 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/fields/AmountTextField.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/fields/AmountTextField.kt @@ -39,7 +39,7 @@ import java.text.DecimalFormat * @param onValueChange callback * @param textStyle text and placeholder styles * @param modifier modifier - * @param color text color + * @param colors text and background colors * @param visualTransformation text visual transformation * @param keyboardOptions keyboard options * @param keyboardActions keyboard actions @@ -55,11 +55,10 @@ fun AmountTextField( onValueChange: (String) -> Unit, textStyle: TextStyle, modifier: Modifier = Modifier, - color: Color = TangemTheme.colors.text.primary1, - backgroundColor: Color = TangemTheme.colors.background.action, + colors: AmountTextFieldColors = TangemAmountTextFieldColors, visualTransformation: VisualTransformation = AmountVisualTransformation( decimals = decimals, - symbolColor = if (value.isBlank()) TangemTheme.colors.text.disabled else color, + symbolColor = if (value.isBlank()) colors.disabledTextColor else colors.textColor, ), keyboardOptions: KeyboardOptions = KeyboardOptions( keyboardType = KeyboardType.Number, @@ -84,7 +83,7 @@ fun AmountTextField( } else { textStyle.fontSize } - val textColor = if (value.isBlank()) TangemTheme.colors.text.disabled else color + val textColor = if (value.isBlank()) colors.disabledTextColor else colors.textColor SimpleTextField( value = value, onValueChange = { newText -> @@ -110,12 +109,28 @@ fun AmountTextField( readOnly = !isEnabled, visualTransformation = visualTransformation, modifier = Modifier - .background(backgroundColor) + .background(colors.backgroundColor) .testTag(SendScreenTestTags.INPUT_TEXT_FIELD), ) } } +val TangemAmountTextFieldColors: AmountTextFieldColors + @Composable + @ReadOnlyComposable + get() = AmountTextFieldColors( + textColor = TangemTheme.colors.text.primary1, + disabledTextColor = TangemTheme.colors.text.disabled, + backgroundColor = TangemTheme.colors.background.action, + ) + +@Immutable +data class AmountTextFieldColors( + val textColor: Color, + val disabledTextColor: Color, + val backgroundColor: Color, +) + private fun prepareEnter(oldValue: String, newValue: String, decimalFormat: DecimalFormat, decimals: Int): String { val decimalSymbol = decimalFormat.decimalFormatSymbols.decimalSeparator return if (decimalFormat.isValidSymbols(newValue)) { @@ -179,6 +194,7 @@ private fun AmountTextFieldPreview( value = text, decimals = amount.decimals, onValueChange = { text = it }, + colors = TangemAmountTextFieldColors, textStyle = TangemTheme.typography.h2.copy( color = TangemTheme.colors.text.primary1, textAlign = TextAlign.Center, diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterAmount.kt b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterAmount.kt index 885e3531b0..06bb40b816 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterAmount.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterAmount.kt @@ -17,6 +17,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource import com.tangem.core.ui.components.fields.AmountTextField +import com.tangem.core.ui.components.fields.TangemAmountTextFieldColors import com.tangem.core.ui.components.fields.visualtransformations.AmountVisualTransformation import com.tangem.core.ui.components.inputrow.inner.DividerContainer import com.tangem.core.ui.extensions.TextReference @@ -85,7 +86,7 @@ fun InputRowEnterAmount( symbolColor = textColor, ), onValueChange = onValueChange, - color = textColor, + colors = TangemAmountTextFieldColors.copy(textColor = textColor), textStyle = TangemTheme.typography.body2, keyboardOptions = keyboardOptions, keyboardActions = keyboardActions, diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterInfoAmount.kt b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterInfoAmount.kt index 5095dea8bf..4c53e77e73 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterInfoAmount.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/inputrow/InputRowEnterInfoAmount.kt @@ -16,6 +16,7 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp import com.tangem.core.ui.R import com.tangem.core.ui.components.fields.AmountTextField +import com.tangem.core.ui.components.fields.TangemAmountTextFieldColors import com.tangem.core.ui.components.fields.visualtransformations.AmountVisualTransformation import com.tangem.core.ui.components.inputrow.inner.DividerContainer import com.tangem.core.ui.components.tooltip.TangemTooltip @@ -90,7 +91,7 @@ fun InputRowEnterInfoAmount( symbolColor = textColor, ), onValueChange = onValueChange, - color = textColor, + colors = TangemAmountTextFieldColors.copy(textColor = textColor), isEnabled = !isReadOnly, textStyle = TangemTheme.typography.body2, keyboardOptions = keyboardOptions, @@ -181,12 +182,14 @@ fun InputRowEnterInfoAmountV2( symbolColor = symbolColor, ), onValueChange = onValueChange, - color = textColor, + colors = TangemAmountTextFieldColors.copy( + textColor = textColor, + backgroundColor = Color.Transparent, + ), isEnabled = !isReadOnly, textStyle = TangemTheme.typography.body2, keyboardOptions = keyboardOptions, keyboardActions = keyboardActions, - backgroundColor = Color.Transparent, modifier = Modifier .padding(top = TangemTheme.dimens.spacing8) .weight(1f) diff --git a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/ui/OnrampAmountContent.kt b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/ui/OnrampAmountContent.kt index c2293646bd..e0cedd00a0 100644 --- a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/ui/OnrampAmountContent.kt +++ b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/main/ui/OnrampAmountContent.kt @@ -26,6 +26,7 @@ import coil.compose.AsyncImage import com.tangem.common.ui.amountScreen.models.AmountFieldModel import com.tangem.core.ui.components.SpacerH import com.tangem.core.ui.components.fields.AmountTextField +import com.tangem.core.ui.components.fields.TangemAmountTextFieldColors import com.tangem.core.ui.components.fields.visualtransformations.AmountVisualTransformation import com.tangem.core.ui.extensions.resolveReference import com.tangem.core.ui.extensions.stringResourceSafe @@ -84,18 +85,20 @@ private fun OnrampHeaderTitle() { private fun OnrampAmountField(amountField: AmountFieldModel, currencyCode: String) { val decimalFormat = rememberDecimalFormat() val requester = remember { FocusRequester() } + val colors = TangemAmountTextFieldColors AmountTextField( value = amountField.fiatValue, decimals = amountField.fiatAmount.decimals, + colors = colors, visualTransformation = AmountVisualTransformation( decimals = amountField.fiatAmount.decimals, symbol = currencyCode, currencyCode = currencyCode, decimalFormat = decimalFormat, symbolColor = if (amountField.fiatValue.isBlank()) { - TangemTheme.colors.text.disabled + colors.disabledTextColor } else { - TangemTheme.colors.text.primary1 + colors.textColor }, ), onValueChange = amountField.onValueChange, diff --git a/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/limit/setup/TangemPayCardLimitSetupScreen.kt b/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/limit/setup/TangemPayCardLimitSetupScreen.kt index 3ac9114bd2..c152e6c947 100644 --- a/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/limit/setup/TangemPayCardLimitSetupScreen.kt +++ b/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/limit/setup/TangemPayCardLimitSetupScreen.kt @@ -22,6 +22,7 @@ import com.tangem.core.ui.components.TextShimmer import com.tangem.core.ui.components.appbar.TangemTopAppBar import com.tangem.core.ui.components.appbar.models.TopAppBarButtonUM import com.tangem.core.ui.components.fields.AmountTextField +import com.tangem.core.ui.components.fields.TangemAmountTextFieldColors import com.tangem.core.ui.components.fields.visualtransformations.AmountVisualTransformation import com.tangem.core.ui.extensions.resolveReference import com.tangem.core.ui.extensions.stringResourceSafe @@ -99,20 +100,22 @@ private fun AmountBlock(state: TangemPayCardLimitSetupUM, modifier: Modifier = M text = "$5000", ) } else { + val colors = TangemAmountTextFieldColors AmountTextField( value = state.amountFieldModel.value, decimals = state.amountFieldModel.decimals, onValueChange = state.amountFieldModel.onValueChange, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), + colors = colors, visualTransformation = AmountVisualTransformation( decimals = state.amountFieldModel.decimals, symbol = state.currencyCode, currencyCode = state.currencyCode, decimalFormat = rememberDecimalFormat(), symbolColor = if (state.amountFieldModel.value.isBlank()) { - TangemTheme.colors.text.disabled + colors.disabledTextColor } else { - TangemTheme.colors.text.primary1 + colors.textColor }, ), textStyle = TangemTheme.typography.head.copy( diff --git a/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/limit/setup/TangemPayCardLimitSetupScreenV2.kt b/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/limit/setup/TangemPayCardLimitSetupScreenV2.kt index 66b6c26bc8..4a14ae9223 100644 --- a/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/limit/setup/TangemPayCardLimitSetupScreenV2.kt +++ b/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/limit/setup/TangemPayCardLimitSetupScreenV2.kt @@ -4,6 +4,9 @@ import android.content.res.Configuration import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.* +import androidx.compose.foundation.lazy.LazyRow +import androidx.compose.foundation.lazy.items +import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.Scaffold @@ -17,6 +20,7 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.tangem.core.ui.components.fields.AmountTextField +import com.tangem.core.ui.components.fields.TangemAmountTextFieldColors import com.tangem.core.ui.components.fields.visualtransformations.AmountVisualTransformation import com.tangem.core.ui.ds.image.TangemIconUM import com.tangem.core.ui.ds.topbar.TangemTopBar @@ -107,27 +111,32 @@ private fun AmountBlock(state: TangemPayCardLimitSetupUM, modifier: Modifier = M radius = TangemTheme.dimens2.x25, ) } else { + val colors = TangemAmountTextFieldColors.copy( + textColor = TangemTheme.colors3.text.primary, + disabledTextColor = TangemTheme.colors3.text.tertiary, + backgroundColor = TangemTheme.colors3.bg.secondary, + ) AmountTextField( value = state.amountFieldModel.value, decimals = state.amountFieldModel.decimals, onValueChange = state.amountFieldModel.onValueChange, keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), + colors = colors, visualTransformation = AmountVisualTransformation( decimals = state.amountFieldModel.decimals, symbol = state.currencyCode, currencyCode = state.currencyCode, decimalFormat = rememberDecimalFormat(), symbolColor = if (state.amountFieldModel.value.isBlank()) { - TangemTheme.colors3.text.tertiary + colors.disabledTextColor } else { - TangemTheme.colors3.text.primary + colors.textColor }, ), textStyle = TangemTheme.typography3.display.medium.copy( textAlign = TextAlign.Center, ), isAutoResize = true, - backgroundColor = TangemTheme.colors3.bg.secondary, ) } } @@ -136,17 +145,13 @@ private fun AmountBlock(state: TangemPayCardLimitSetupUM, modifier: Modifier = M @Composable private fun PresetsRow(presets: ImmutableList) { if (presets.isEmpty()) return - Row( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = TangemTheme.dimens2.x3, vertical = 6.dp), - horizontalArrangement = Arrangement.spacedBy(TangemTheme.dimens2.x2), + LazyRow( + state = rememberLazyListState(), + contentPadding = PaddingValues(horizontal = 12.dp, vertical = 6.dp), + horizontalArrangement = Arrangement.spacedBy(8.dp), ) { - presets.forEach { preset -> - PresetChip( - preset = preset, - modifier = Modifier.weight(1f), - ) + items(presets) { preset -> + PresetChip(preset = preset) } } } @@ -164,9 +169,7 @@ private fun PresetChip(preset: TangemPayCardLimitSetupUM.LimitPresetUM, modifier verticalAlignment = Alignment.CenterVertically, ) { Text( - modifier = Modifier - .padding(vertical = 1.dp) - .fillMaxWidth(), + modifier = Modifier.padding(vertical = 1.dp), text = preset.label, style = TangemTheme.typography3.subheading.medium, color = TangemTheme.colors3.text.primary, diff --git a/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/ui/TangemPayDailyLimitBlock.kt b/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/ui/TangemPayDailyLimitBlock.kt index 141a870b0c..bd5831b29d 100644 --- a/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/ui/TangemPayDailyLimitBlock.kt +++ b/features/tangempay/details/impl/src/main/kotlin/com/tangem/features/tangempay/ui/TangemPayDailyLimitBlock.kt @@ -159,7 +159,7 @@ private fun CurrentLimitBlockV2(state: TangemPayDailyLimitBlockState, modifier: .padding(start = TangemTheme.dimens2.x3) .layoutId(TangemRowLayoutId.TAIL), variant = TangemButton.Variant.Secondary, - text = resourceReference(R.string.common_edit), + text = resourceReference(R.string.tangempay_card_page_daily_limit_change), onClick = state.onChangeClick, size = TangemButton.Size.X10, )