From 11540f7317a5d25d582590a606d4b4c7a6aabf0f Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 19 Apr 2022 10:52:55 +0400 Subject: [PATCH] Updated on 2026-08-14 --- .../tap/features/tokens/redux/TokensState.kt | 3 +- .../wallet/ui/adapters/WalletAdapter.kt | 30 +++++++++++-------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/tokens/redux/TokensState.kt b/app/src/main/java/com/tangem/tap/features/tokens/redux/TokensState.kt index 5476447c70..0bf2afeb58 100644 --- a/app/src/main/java/com/tangem/tap/features/tokens/redux/TokensState.kt +++ b/app/src/main/java/com/tangem/tap/features/tokens/redux/TokensState.kt @@ -61,7 +61,8 @@ fun List.filter(supportedBlockchains: Set?): List hideWarning() + BalanceStatus.VerifiedOnline, BalanceStatus.SameCurrencyTransactionInProgress -> hideWarning(isCustom) BalanceStatus.Loading -> { - hideWarning() + hideWarning(isCustom) if (wallet.currencyData.amountFormatted == null) { tvExchangeRate.text = root.getString(R.string.wallet_balance_loading) } } BalanceStatus.TransactionInProgress -> - showWarning(root.getString(R.string.wallet_balance_tx_in_progress)) + showWarning(root.getString(R.string.wallet_balance_tx_in_progress), isCustom) BalanceStatus.Unreachable -> - showWarning(root.getString(R.string.wallet_balance_blockchain_unreachable)) + showWarning(root.getString(R.string.wallet_balance_blockchain_unreachable), isCustom) BalanceStatus.NoAccount -> - showWarning(root.getString(R.string.wallet_error_no_account)) + showWarning(root.getString(R.string.wallet_error_no_account), isCustom) else -> { } } } - private fun showWarning(message: String) { - toggleWarning(true) + private fun showWarning(message: String, isCustom: Boolean = false) { + toggleWarning(true, isCustom) binding.tvStatusErrorMessage.text = message } - private fun hideWarning() { - toggleWarning(false) + private fun hideWarning(isCustom: Boolean = false) { + toggleWarning(false, isCustom) } - private fun toggleWarning(show: Boolean) { - binding.tvExchangeRate.show(!show) - binding.tvCustomCurrency.show(!show) + private fun toggleWarning(show: Boolean, isCustom: Boolean = false) { + if (!show) { + binding.tvExchangeRate.show(!isCustom) + binding.tvCustomCurrency.show(isCustom) + } else { + binding.tvExchangeRate.hide() + binding.tvCustomCurrency.hide() + } binding.tvStatusErrorMessage.show(show) } }