diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/eip20approve/Eip20ApproveConfirmFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/eip20approve/Eip20ApproveConfirmFragment.kt index f10e061f77..6b125aed12 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/eip20approve/Eip20ApproveConfirmFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/eip20approve/Eip20ApproveConfirmFragment.kt @@ -1,22 +1,15 @@ package io.horizontalsystems.bankwallet.modules.eip20approve import android.os.Parcelable -import androidx.compose.foundation.Image -import androidx.compose.foundation.clickable -import androidx.compose.foundation.interaction.MutableInteractionSource -import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalView -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.lifecycle.viewmodel.compose.viewModel @@ -24,16 +17,14 @@ import androidx.navigation.NavController import io.horizontalsystems.bankwallet.R import io.horizontalsystems.bankwallet.core.BaseComposeFragment import io.horizontalsystems.bankwallet.core.setNavigationResultX -import io.horizontalsystems.bankwallet.core.slideFromBottom import io.horizontalsystems.bankwallet.core.slideFromRight import io.horizontalsystems.bankwallet.modules.confirm.ConfirmTransactionScreen import io.horizontalsystems.bankwallet.modules.eip20approve.AllowanceMode.OnlyRequired import io.horizontalsystems.bankwallet.modules.eip20approve.AllowanceMode.Unlimited import io.horizontalsystems.bankwallet.modules.evmfee.Cautions -import io.horizontalsystems.bankwallet.modules.evmfee.FeeSettingsInfoDialog -import io.horizontalsystems.bankwallet.modules.multiswap.QuoteInfoRow import io.horizontalsystems.bankwallet.modules.multiswap.TokenRow import io.horizontalsystems.bankwallet.modules.multiswap.TokenRowUnlimited +import io.horizontalsystems.bankwallet.modules.multiswap.ui.DataFieldFee import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme import io.horizontalsystems.bankwallet.ui.compose.components.ButtonPrimaryDefault import io.horizontalsystems.bankwallet.ui.compose.components.ButtonPrimaryYellow @@ -42,8 +33,6 @@ import io.horizontalsystems.bankwallet.ui.compose.components.TransactionInfoCont import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer import io.horizontalsystems.bankwallet.ui.compose.components.cell.BoxBorderedTop import io.horizontalsystems.bankwallet.ui.compose.components.cell.SectionUniversalLawrence -import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_grey -import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_leah import io.horizontalsystems.core.SnackbarDuration import io.horizontalsystems.core.helpers.HudHelper import kotlinx.coroutines.delay @@ -162,42 +151,10 @@ fun Eip20ApproveConfirmScreen(navController: NavController) { VSpacer(height = 16.dp) SectionUniversalLawrence { - QuoteInfoRow( - title = { - val title = stringResource(id = R.string.FeeSettings_NetworkFee) - val infoText = stringResource(id = R.string.FeeSettings_NetworkFee_Info) - - subhead2_grey(text = title) - - Image( - modifier = Modifier - .padding(horizontal = 8.dp) - .clickable( - onClick = { - navController.slideFromBottom( - R.id.feeSettingsInfoDialog, - FeeSettingsInfoDialog.Input(title, infoText) - ) - }, - interactionSource = remember { MutableInteractionSource() }, - indication = null - ) - , - painter = painterResource(id = R.drawable.ic_info_20), - contentDescription = "" - ) - - }, - value = { - val primary = uiState.networkFee?.primary?.getFormattedPlain() ?: "---" - val secondary = uiState.networkFee?.secondary?.getFormattedPlain() ?: "---" - - Column(horizontalAlignment = Alignment.End) { - subhead2_leah(text = primary) - VSpacer(height = 1.dp) - subhead2_grey(text = secondary) - } - } + DataFieldFee( + navController, + uiState.networkFee?.primary?.getFormattedPlain() ?: "---", + uiState.networkFee?.secondary?.getFormattedPlain() ?: "---" ) } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/eip20revoke/Eip20RevokeConfirmFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/eip20revoke/Eip20RevokeConfirmFragment.kt index 92e07ca1ff..ad852bcad1 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/eip20revoke/Eip20RevokeConfirmFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/eip20revoke/Eip20RevokeConfirmFragment.kt @@ -1,22 +1,15 @@ package io.horizontalsystems.bankwallet.modules.eip20revoke import android.os.Parcelable -import androidx.compose.foundation.Image -import androidx.compose.foundation.clickable -import androidx.compose.foundation.interaction.MutableInteractionSource -import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalView -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.lifecycle.viewmodel.compose.viewModel @@ -25,13 +18,11 @@ import io.horizontalsystems.bankwallet.R import io.horizontalsystems.bankwallet.core.BaseComposeFragment import io.horizontalsystems.bankwallet.core.requireInput import io.horizontalsystems.bankwallet.core.setNavigationResultX -import io.horizontalsystems.bankwallet.core.slideFromBottom import io.horizontalsystems.bankwallet.core.slideFromRight import io.horizontalsystems.bankwallet.modules.confirm.ConfirmTransactionScreen import io.horizontalsystems.bankwallet.modules.evmfee.Cautions -import io.horizontalsystems.bankwallet.modules.evmfee.FeeSettingsInfoDialog -import io.horizontalsystems.bankwallet.modules.multiswap.QuoteInfoRow import io.horizontalsystems.bankwallet.modules.multiswap.TokenRow +import io.horizontalsystems.bankwallet.modules.multiswap.ui.DataFieldFee import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme import io.horizontalsystems.bankwallet.ui.compose.components.ButtonPrimaryDefault import io.horizontalsystems.bankwallet.ui.compose.components.ButtonPrimaryYellow @@ -40,8 +31,6 @@ import io.horizontalsystems.bankwallet.ui.compose.components.TransactionInfoCont import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer import io.horizontalsystems.bankwallet.ui.compose.components.cell.BoxBorderedTop import io.horizontalsystems.bankwallet.ui.compose.components.cell.SectionUniversalLawrence -import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_grey -import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_leah import io.horizontalsystems.core.SnackbarDuration import io.horizontalsystems.core.helpers.HudHelper import io.horizontalsystems.marketkit.models.Token @@ -160,41 +149,10 @@ fun Eip20RevokeScreen(navController: NavController, input: Eip20RevokeConfirmFra VSpacer(height = 16.dp) SectionUniversalLawrence { - QuoteInfoRow( - title = { - val title = stringResource(id = R.string.FeeSettings_NetworkFee) - val infoText = stringResource(id = R.string.FeeSettings_NetworkFee_Info) - - subhead2_grey(text = title) - - Image( - modifier = Modifier - .padding(horizontal = 8.dp) - .clickable( - onClick = { - navController.slideFromBottom( - R.id.feeSettingsInfoDialog, - FeeSettingsInfoDialog.Input(title, infoText) - ) - }, - interactionSource = remember { MutableInteractionSource() }, - indication = null - ), - painter = painterResource(id = R.drawable.ic_info_20), - contentDescription = "" - ) - - }, - value = { - val primary = uiState.networkFee?.primary?.getFormattedPlain() ?: "---" - val secondary = uiState.networkFee?.secondary?.getFormattedPlain() ?: "---" - - Column(horizontalAlignment = Alignment.End) { - subhead2_leah(text = primary) - VSpacer(height = 1.dp) - subhead2_grey(text = secondary) - } - } + DataFieldFee( + navController, + uiState.networkFee?.primary?.getFormattedPlain() ?: "---", + uiState.networkFee?.secondary?.getFormattedPlain() ?: "---" ) } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/multiswap/SwapConfirmFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/multiswap/SwapConfirmFragment.kt index 7a4374a1b1..49c635ba84 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/multiswap/SwapConfirmFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/multiswap/SwapConfirmFragment.kt @@ -1,12 +1,8 @@ package io.horizontalsystems.bankwallet.modules.multiswap import android.os.Parcelable -import androidx.compose.foundation.Image -import androidx.compose.foundation.clickable -import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.material.Text import androidx.compose.runtime.Composable @@ -19,7 +15,6 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalView -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.lifecycle.viewmodel.compose.viewModel @@ -30,14 +25,13 @@ import io.horizontalsystems.bankwallet.core.badge import io.horizontalsystems.bankwallet.core.iconPlaceholder import io.horizontalsystems.bankwallet.core.imageUrl import io.horizontalsystems.bankwallet.core.setNavigationResultX -import io.horizontalsystems.bankwallet.core.slideFromBottom import io.horizontalsystems.bankwallet.core.slideFromRight import io.horizontalsystems.bankwallet.entities.CoinValue import io.horizontalsystems.bankwallet.entities.Currency import io.horizontalsystems.bankwallet.entities.CurrencyValue import io.horizontalsystems.bankwallet.modules.confirm.ConfirmTransactionScreen import io.horizontalsystems.bankwallet.modules.evmfee.Cautions -import io.horizontalsystems.bankwallet.modules.evmfee.FeeSettingsInfoDialog +import io.horizontalsystems.bankwallet.modules.multiswap.ui.DataFieldFee import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme import io.horizontalsystems.bankwallet.ui.compose.components.ButtonPrimaryDefault import io.horizontalsystems.bankwallet.ui.compose.components.ButtonPrimaryYellow @@ -213,42 +207,10 @@ fun SwapConfirmScreen(navController: NavController) { VSpacer(height = 16.dp) SectionUniversalLawrence { - QuoteInfoRow( - title = { - val title = stringResource(id = R.string.FeeSettings_NetworkFee) - val infoText = stringResource(id = R.string.FeeSettings_NetworkFee_Info) - - subhead2_grey(text = title) - - Image( - modifier = Modifier - .padding(horizontal = 8.dp) - .clickable( - onClick = { - navController.slideFromBottom( - R.id.feeSettingsInfoDialog, - FeeSettingsInfoDialog.Input(title, infoText) - ) - }, - interactionSource = remember { MutableInteractionSource() }, - indication = null - ) - , - painter = painterResource(id = R.drawable.ic_info_20), - contentDescription = "" - ) - - }, - value = { - val primary = uiState.networkFee?.primary?.getFormattedPlain() ?: "---" - val secondary = uiState.networkFee?.secondary?.getFormattedPlain() ?: "---" - - Column(horizontalAlignment = Alignment.End) { - subhead2_leah(text = primary) - VSpacer(height = 1.dp) - subhead2_grey(text = secondary) - } - } + DataFieldFee( + navController, + uiState.networkFee?.primary?.getFormattedPlain() ?: "---", + uiState.networkFee?.secondary?.getFormattedPlain() ?: "---" ) } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/multiswap/ui/DataFieldFee.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/multiswap/ui/DataFieldFee.kt new file mode 100644 index 0000000000..3a207e594e --- /dev/null +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/multiswap/ui/DataFieldFee.kt @@ -0,0 +1,63 @@ +package io.horizontalsystems.bankwallet.modules.multiswap.ui + +import androidx.compose.foundation.Image +import androidx.compose.foundation.clickable +import androidx.compose.foundation.interaction.MutableInteractionSource +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import androidx.navigation.NavController +import io.horizontalsystems.bankwallet.R +import io.horizontalsystems.bankwallet.core.slideFromBottom +import io.horizontalsystems.bankwallet.modules.evmfee.FeeSettingsInfoDialog +import io.horizontalsystems.bankwallet.modules.multiswap.QuoteInfoRow +import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer +import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_grey +import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_leah + +@Composable +fun DataFieldFee( + navController: NavController, + primary: String, + secondary: String, +) { + QuoteInfoRow( + title = { + val title = stringResource(id = R.string.FeeSettings_NetworkFee) + val infoText = stringResource(id = R.string.FeeSettings_NetworkFee_Info) + + subhead2_grey(text = title) + + Image( + modifier = Modifier + .padding(horizontal = 8.dp) + .clickable( + onClick = { + navController.slideFromBottom( + R.id.feeSettingsInfoDialog, + FeeSettingsInfoDialog.Input(title, infoText) + ) + }, + interactionSource = remember { MutableInteractionSource() }, + indication = null + ), + painter = painterResource(id = R.drawable.ic_info_20), + contentDescription = "" + ) + + }, + value = { + Column(horizontalAlignment = Alignment.End) { + subhead2_leah(text = primary) + VSpacer(height = 1.dp) + subhead2_grey(text = secondary) + } + } + ) +} \ No newline at end of file diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/sendevmtransaction/SendEvmTransactionView.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/sendevmtransaction/SendEvmTransactionView.kt index 0100c1e390..f92565b980 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/sendevmtransaction/SendEvmTransactionView.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/sendevmtransaction/SendEvmTransactionView.kt @@ -1,8 +1,5 @@ package io.horizontalsystems.bankwallet.modules.sendevmtransaction -import androidx.compose.foundation.Image -import androidx.compose.foundation.clickable -import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -13,7 +10,6 @@ import androidx.compose.foundation.layout.size import androidx.compose.material.Icon import androidx.compose.material.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalView @@ -27,11 +23,9 @@ import io.horizontalsystems.bankwallet.core.ethereum.CautionViewItem import io.horizontalsystems.bankwallet.core.iconPlaceholder import io.horizontalsystems.bankwallet.core.imageUrl import io.horizontalsystems.bankwallet.core.shorten -import io.horizontalsystems.bankwallet.core.slideFromBottom import io.horizontalsystems.bankwallet.modules.evmfee.Cautions -import io.horizontalsystems.bankwallet.modules.evmfee.FeeSettingsInfoDialog -import io.horizontalsystems.bankwallet.modules.multiswap.QuoteInfoRow import io.horizontalsystems.bankwallet.modules.multiswap.ui.DataField +import io.horizontalsystems.bankwallet.modules.multiswap.ui.DataFieldFee import io.horizontalsystems.bankwallet.modules.send.SendModule import io.horizontalsystems.bankwallet.modules.send.evm.settings.SendEvmNonceViewModel import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme @@ -84,42 +78,10 @@ fun SendEvmTransactionView( VSpacer(height = 16.dp) SectionUniversalLawrence { - QuoteInfoRow( - title = { - val title = stringResource(id = R.string.FeeSettings_NetworkFee) - val infoText = stringResource(id = R.string.FeeSettings_NetworkFee_Info) - - subhead2_grey(text = title) - - Image( - modifier = Modifier - .padding(horizontal = 8.dp) - .clickable( - onClick = { - navController.slideFromBottom( - R.id.feeSettingsInfoDialog, - FeeSettingsInfoDialog.Input(title, infoText) - ) - }, - interactionSource = remember { MutableInteractionSource() }, - indication = null - ) - , - painter = painterResource(id = R.drawable.ic_info_20), - contentDescription = "" - ) - - }, - value = { - val primary = networkFee?.primary?.getFormattedPlain() ?: "---" - val secondary = networkFee?.secondary?.getFormattedPlain() ?: "---" - - Column(horizontalAlignment = Alignment.End) { - subhead2_leah(text = primary) - VSpacer(height = 1.dp) - subhead2_grey(text = secondary) - } - } + DataFieldFee( + navController, + networkFee?.primary?.getFormattedPlain() ?: "---", + networkFee?.secondary?.getFormattedPlain() ?: "---" ) }