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 59c9b5143d..4bf1b72d84 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 @@ -3,6 +3,7 @@ package com.tangem.core.ui.components.fields import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.Text import androidx.compose.runtime.* @@ -54,6 +55,7 @@ fun AmountTextField( keyboardOptions: KeyboardOptions = KeyboardOptions( keyboardType = KeyboardType.Number, ), + keyboardActions: KeyboardActions = KeyboardActions.Default, ) { val decimalFormat = rememberDecimalFormat() @@ -75,6 +77,7 @@ fun AmountTextField( textStyle = textStyle, color = color, keyboardOptions = keyboardOptions, + keyboardActions = keyboardActions, singleLine = true, visualTransformation = AmountVisualTransformation(decimals, symbol, decimalFormat), decorationBox = { innerTextField -> diff --git a/core/ui/src/main/java/com/tangem/core/ui/components/fields/SimpleTextField.kt b/core/ui/src/main/java/com/tangem/core/ui/components/fields/SimpleTextField.kt index db725acbc8..a85e0eaafc 100644 --- a/core/ui/src/main/java/com/tangem/core/ui/components/fields/SimpleTextField.kt +++ b/core/ui/src/main/java/com/tangem/core/ui/components/fields/SimpleTextField.kt @@ -3,6 +3,7 @@ package com.tangem.core.ui.components.fields import androidx.compose.animation.AnimatedContent import androidx.compose.foundation.layout.Box import androidx.compose.foundation.text.BasicTextField +import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.text.selection.LocalTextSelectionColors import androidx.compose.foundation.text.selection.TextSelectionColors @@ -34,6 +35,7 @@ fun SimpleTextField( singleLine: Boolean = false, visualTransformation: VisualTransformation = VisualTransformation.None, keyboardOptions: KeyboardOptions = KeyboardOptions.Default, + keyboardActions: KeyboardActions = KeyboardActions.Default, color: Color = TangemTheme.colors.text.primary1, textStyle: TextStyle = TangemTheme.typography.body2.copy(color = color), readOnly: Boolean = false, @@ -87,6 +89,7 @@ fun SimpleTextField( readOnly = readOnly, visualTransformation = visualTransformation, keyboardOptions = keyboardOptions, + keyboardActions = keyboardActions, decorationBox = decorationBox ?: { textValue -> Box { if (value.isBlank() && placeholder != null) { 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 d25b9e7bc4..dd7c375e77 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 @@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.ripple.rememberRipple import androidx.compose.material3.Icon @@ -51,6 +52,7 @@ fun InputRowEnterAmount( titleColor: Color = TangemTheme.colors.text.secondary, textColor: Color = TangemTheme.colors.text.primary1, keyboardOptions: KeyboardOptions = KeyboardOptions.Default, + keyboardActions: KeyboardActions = KeyboardActions.Default, iconRes: Int? = null, iconTint: Color = TangemTheme.colors.icon.informative, onIconClick: (() -> Unit)? = null, @@ -79,6 +81,7 @@ fun InputRowEnterAmount( color = textColor, textStyle = TangemTheme.typography.body2, keyboardOptions = keyboardOptions, + keyboardActions = keyboardActions, modifier = Modifier .padding(top = TangemTheme.dimens.spacing8), ) 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 273e0ab9ab..40276abe7a 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 @@ -4,6 +4,7 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -49,6 +50,7 @@ fun InputRowEnterInfoAmount( textColor: Color = TangemTheme.colors.text.primary1, infoColor: Color = TangemTheme.colors.text.tertiary, keyboardOptions: KeyboardOptions = KeyboardOptions.Default, + keyboardActions: KeyboardActions = KeyboardActions.Default, showDivider: Boolean = false, ) { DividerContainer( @@ -74,6 +76,7 @@ fun InputRowEnterInfoAmount( color = textColor, textStyle = TangemTheme.typography.body2, keyboardOptions = keyboardOptions, + keyboardActions = keyboardActions, modifier = Modifier .padding(top = TangemTheme.dimens.spacing8) .weight(1f), diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fee/custom/EthereumCustomFeeConverter.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fee/custom/EthereumCustomFeeConverter.kt index 4997139e4e..4be7b3acfb 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fee/custom/EthereumCustomFeeConverter.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fee/custom/EthereumCustomFeeConverter.kt @@ -1,5 +1,6 @@ package com.tangem.features.send.impl.presentation.state.fee.custom +import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType @@ -43,6 +44,7 @@ internal class EthereumCustomFeeConverter( title = resourceReference(R.string.send_max_fee), footer = resourceReference(R.string.send_max_fee_footer), label = getFeeFormatted(value.amount.value), + keyboardActions = KeyboardActions(), ), SendTextField.CustomFee( value = value.gasPrice.toString(), @@ -55,6 +57,7 @@ internal class EthereumCustomFeeConverter( imeAction = ImeAction.Next, keyboardType = KeyboardType.Number, ), + keyboardActions = KeyboardActions(), ), SendTextField.CustomFee( value = value.gasLimit.toString(), @@ -67,6 +70,7 @@ internal class EthereumCustomFeeConverter( imeAction = ImeAction.Done, keyboardType = KeyboardType.Number, ), + keyboardActions = KeyboardActions(onDone = { clickIntents.onNextClick() }), ), ) } diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fields/SendAmountFieldConverter.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fields/SendAmountFieldConverter.kt index 2fd6c7906b..83701146e2 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fields/SendAmountFieldConverter.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fields/SendAmountFieldConverter.kt @@ -1,5 +1,6 @@ package com.tangem.features.send.impl.presentation.state.fields +import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType @@ -40,9 +41,10 @@ internal class SendAmountFieldConverter( fiatValue = fiatValue, onValueChange = clickIntents::onAmountValueChange, keyboardOptions = KeyboardOptions( - imeAction = ImeAction.Next, + imeAction = ImeAction.Done, keyboardType = KeyboardType.Number, ), + keyboardActions = KeyboardActions(onDone = { clickIntents.onNextClick() }), isFiatValue = false, cryptoAmount = cryptoAmount, fiatAmount = getAppCurrencyAmount(appCurrencyProvider()), diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fields/SendTextField.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fields/SendTextField.kt index d89b75c9b1..97682a9e21 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fields/SendTextField.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/fields/SendTextField.kt @@ -1,5 +1,6 @@ package com.tangem.features.send.impl.presentation.state.fields +import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.runtime.Immutable import com.tangem.core.ui.extensions.TextReference @@ -21,6 +22,7 @@ internal sealed class SendTextField { override val value: String, override val onValueChange: (String) -> Unit, override val keyboardOptions: KeyboardOptions, + val keyboardActions: KeyboardActions, val cryptoAmount: Amount, val fiatAmount: Amount, val isFiatValue: Boolean, @@ -55,6 +57,7 @@ internal sealed class SendTextField { override val value: String, override val onValueChange: (String) -> Unit, override val keyboardOptions: KeyboardOptions, + val keyboardActions: KeyboardActions, val symbol: String?, val decimals: Int, val title: TextReference, diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/SendNavigationButtons.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/SendNavigationButtons.kt index 5ff3dbf5d6..064ec52822 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/SendNavigationButtons.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/SendNavigationButtons.kt @@ -24,6 +24,7 @@ import androidx.compose.ui.res.stringResource import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.tangem.core.ui.R import com.tangem.core.ui.components.* +import com.tangem.core.ui.extensions.rememberHapticFeedback import com.tangem.core.ui.extensions.shareText import com.tangem.core.ui.res.TangemTheme import com.tangem.features.send.impl.presentation.state.SendUiState @@ -95,11 +96,12 @@ private fun SendPrimaryNavigationButton(uiState: SendUiState, modifier: Modifier ) { textId -> when { currentState.value == SendUiStateType.Send && !isSuccess -> { + val hapticFeedback = rememberHapticFeedback(state = currentState, onAction = buttonClick) PrimaryButtonIconEnd( text = stringResource(textId), iconResId = R.drawable.ic_tangem_24, enabled = isButtonEnabled, - onClick = buttonClick, + onClick = hapticFeedback, showProgress = isSending, ) } diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/AmountField.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/AmountField.kt index c2ca7a26d8..b18159fd89 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/AmountField.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/amount/AmountField.kt @@ -40,6 +40,7 @@ internal fun AmountField(sendField: SendTextField.AmountField, isFiat: Boolean) symbol = primaryAmount.currencySymbol, onValueChange = sendField.onValueChange, keyboardOptions = sendField.keyboardOptions, + keyboardActions = sendField.keyboardActions, textStyle = TangemTheme.typography.h2.copy( color = TangemTheme.colors.text.primary1, textAlign = TextAlign.Center, diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/fee/SendCustomFeeEthereum.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/fee/SendCustomFeeEthereum.kt index a5eba38a01..8dbb522573 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/fee/SendCustomFeeEthereum.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/fee/SendCustomFeeEthereum.kt @@ -38,6 +38,7 @@ internal fun SendCustomFeeEthereum( title = value.title, info = value.label, keyboardOptions = value.keyboardOptions, + keyboardActions = value.keyboardActions, onValueChange = value.onValueChange, showDivider = false, modifier = Modifier @@ -54,6 +55,7 @@ internal fun SendCustomFeeEthereum( symbol = value.symbol, onValueChange = value.onValueChange, keyboardOptions = value.keyboardOptions, + keyboardActions = value.keyboardActions, showDivider = false, modifier = Modifier .background(