From 0bbe6b8a4a72efad1221cc7a0887e2dfb3411868 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 3 May 2024 11:18:10 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../presentation/ui/SendNavigationButtons.kt | 22 +++++++++---------- .../send/impl/presentation/ui/SendScreen.kt | 1 + .../presentation/ui/amount/AmountField.kt | 7 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) 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 b0b37b764d..e858d9b150 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 @@ -1,12 +1,10 @@ package com.tangem.features.send.impl.presentation.ui import androidx.compose.animation.* +import androidx.compose.animation.core.tween import androidx.compose.foundation.background import androidx.compose.foundation.clickable -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.layout.* import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Icon import androidx.compose.material3.Text @@ -21,18 +19,19 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import com.tangem.core.ui.R +import com.tangem.core.ui.components.Keyboard import com.tangem.core.ui.components.SecondaryButtonIconStart import com.tangem.core.ui.components.SpacerW12 import com.tangem.core.ui.components.buttons.common.TangemButton import com.tangem.core.ui.components.buttons.common.TangemButtonIconPosition import com.tangem.core.ui.components.buttons.common.TangemButtonsDefaults +import com.tangem.core.ui.components.keyboardAsState import com.tangem.core.ui.extensions.shareText import com.tangem.core.ui.res.TangemTheme import com.tangem.core.ui.utils.BigDecimalFormatter import com.tangem.features.send.impl.presentation.state.SendUiCurrentScreen import com.tangem.features.send.impl.presentation.state.SendUiState import com.tangem.features.send.impl.presentation.state.SendUiStateType -import kotlinx.coroutines.delay @Composable internal fun SendNavigationButtons( @@ -144,11 +143,12 @@ private fun SendingText( modifier: Modifier = Modifier, ) { var isVisibleProxy by remember { mutableStateOf(isVisible) } + val keyboard by keyboardAsState() - // text appearance delay for smooth screen transitions - LaunchedEffect(key1 = isVisible) { - if (isVisible) { - delay(timeMillis = 400) + // the text should appear when the keyboard is closed + LaunchedEffect(isVisible, keyboard) { + if (isVisible && keyboard is Keyboard.Opened) { + return@LaunchedEffect } isVisibleProxy = isVisible } @@ -156,8 +156,8 @@ private fun SendingText( AnimatedVisibility( visible = isVisibleProxy, modifier = modifier, - enter = slideInVertically().plus(fadeIn()), - exit = slideOutVertically().plus(fadeOut()), + enter = slideInVertically() + fadeIn(), + exit = fadeOut(tween(durationMillis = 300)), label = "Animate show sending state text", ) { val amountState = uiState.getAmountState(isEditState) diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/SendScreen.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/SendScreen.kt index 5c7eba689d..d6529709b7 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/SendScreen.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/ui/SendScreen.kt @@ -134,6 +134,7 @@ private fun SendScreenContent(uiState: SendUiState, currentState: SendUiCurrentS Box(modifier = modifier.fillMaxSize()) { AnimatedContent( targetState = currentStateProxy, + contentAlignment = Alignment.TopCenter, label = "Send Scree Navigation", transitionSpec = { val direction = if (initialState.type.ordinal < targetState.type.ordinal) { 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 640189da93..8f7a69c8c1 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 @@ -22,7 +22,7 @@ import com.tangem.core.ui.res.TangemTheme import com.tangem.core.ui.utils.BigDecimalFormatter import com.tangem.core.ui.utils.rememberDecimalFormat import com.tangem.features.send.impl.presentation.state.fields.SendTextField -import kotlinx.coroutines.job +import kotlinx.coroutines.delay @Composable internal fun AmountField(sendField: SendTextField.AmountField, appCurrencyCode: String) { @@ -66,9 +66,8 @@ internal fun AmountField(sendField: SendTextField.AmountField, appCurrencyCode: ) LaunchedEffect(key1 = Unit) { - this.coroutineContext.job.invokeOnCompletion { - requester.requestFocus() - } + delay(timeMillis = 200) + requester.requestFocus() } AmountSecondary(sendField, appCurrencyCode)