diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/core/managers/NumberFormatter.kt b/app/src/main/java/io/horizontalsystems/bankwallet/core/managers/NumberFormatter.kt index 514147d233..7eeb3c7a16 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/core/managers/NumberFormatter.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/core/managers/NumberFormatter.kt @@ -8,7 +8,7 @@ import java.math.BigDecimal import java.math.BigInteger import java.math.RoundingMode import java.text.NumberFormat -import java.util.* +import java.util.Locale import java.util.concurrent.ConcurrentHashMap class NumberFormatter( @@ -115,7 +115,8 @@ class NumberFormatter( when (value) { is Value.Currency -> { val currencyValue = value.currencyValue - formatFiatShort(currencyValue.value, currencyValue.currency.symbol, currencyValue.currency.decimal) + val formatted = formatFiatShort(currencyValue.value.abs(), currencyValue.currency.symbol, currencyValue.currency.decimal) + sign(value.currencyValue.value) + formatted } is Value.Percent -> { format(value.percent.abs(), 0, 2, sign(value.percent), "%") diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/market/MarketViewModel.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/market/MarketViewModel.kt index d069470c22..96f7b2fdb2 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/market/MarketViewModel.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/market/MarketViewModel.kt @@ -95,8 +95,8 @@ class MarketViewModel( globalMarket.btcDominance?.let { App.numberFormatter.format(it, 0, 2, suffix = "%") } ?: "-", - globalMarket.btcDominance?.let { getDiff(it) } ?: "----", - globalMarket.btcDominance?.let { it > BigDecimal.ZERO } ?: false, + globalMarket.btcDominanceChange?.let { getDiff(it) } ?: "----", + globalMarket.btcDominanceChange?.let { it > BigDecimal.ZERO } ?: false, MetricsType.TotalMarketCap ), MarketOverviewViewItem( @@ -105,7 +105,7 @@ class MarketViewModel( ?: "-", globalMarket.etfDailyInflow?.let { val sign = if (it >= BigDecimal.ZERO) "+" else "-" - "$sign${formatFiatShortened(it, baseCurrency.symbol)}" + "$sign${formatFiatShortened(it.abs(), baseCurrency.symbol)}" } ?: "----", globalMarket.etfDailyInflow?.let { it > BigDecimal.ZERO } ?: false, MetricsType.Etf diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/market/etf/EtfFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/market/etf/EtfFragment.kt index 333f29ffd9..629724fcac 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/market/etf/EtfFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/market/etf/EtfFragment.kt @@ -285,7 +285,12 @@ fun ChartEtf(loading: Boolean, etfPoints: List, currency: Currency) { } val dailyInflowStr = dailyInflow?.let { - App.numberFormatter.formatFiatShort(it.abs(), currency.symbol, currency.decimal) + val sign = when { + it == BigDecimal.ZERO -> "" + it < BigDecimal.ZERO -> "-" + else -> "+" + } + sign + App.numberFormatter.formatFiatShort(it.abs(), currency.symbol, currency.decimal) } val dailyInflowPositive = dailyInflow != null && dailyInflow > BigDecimal.ZERO