mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 23:06:39 +01:00
This commit is contained in:
parent
1e6777bb09
commit
5316c871c5
1 changed files with 19 additions and 2 deletions
|
@ -20,6 +20,7 @@ package bisq.core.util;
|
|||
import bisq.core.app.BisqEnvironment;
|
||||
import bisq.core.dao.exceptions.ValidationException;
|
||||
import bisq.core.dao.governance.param.Param;
|
||||
import bisq.core.locale.GlobalSettings;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.provider.price.MarketPrice;
|
||||
import bisq.core.util.validation.BtcAddressValidator;
|
||||
|
@ -36,6 +37,9 @@ import org.bitcoinj.utils.MonetaryFormat;
|
|||
import javax.inject.Inject;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
@ -44,14 +48,17 @@ public class BsqFormatter extends BSFormatter {
|
|||
@SuppressWarnings("PointlessBooleanExpression")
|
||||
private static final boolean useBsqAddressFormat = true || !DevEnv.isDevMode();
|
||||
private final String prefix = "B";
|
||||
private final DecimalFormat amountFormat = new DecimalFormat("###,###,###.##");
|
||||
private final DecimalFormat marketCapFormat = new DecimalFormat("###,###,###");
|
||||
private DecimalFormat amountFormat;
|
||||
private DecimalFormat marketCapFormat;
|
||||
private final MonetaryFormat btcCoinFormat;
|
||||
|
||||
@Inject
|
||||
public BsqFormatter() {
|
||||
super();
|
||||
|
||||
GlobalSettings.localeProperty().addListener((observable, oldValue, newValue) -> setFormatter(newValue));
|
||||
setFormatter(GlobalSettings.getLocale());
|
||||
|
||||
btcCoinFormat = super.coinFormat;
|
||||
|
||||
final String baseCurrencyCode = BisqEnvironment.getBaseCurrencyNetwork().getCurrencyCode();
|
||||
|
@ -73,6 +80,16 @@ public class BsqFormatter extends BSFormatter {
|
|||
amountFormat.setMinimumFractionDigits(2);
|
||||
}
|
||||
|
||||
private void setFormatter(Locale locale) {
|
||||
amountFormat = (DecimalFormat) NumberFormat.getNumberInstance(locale);
|
||||
amountFormat.setMinimumFractionDigits(2);
|
||||
amountFormat.setMaximumFractionDigits(2);
|
||||
|
||||
marketCapFormat = (DecimalFormat) NumberFormat.getNumberInstance(locale);
|
||||
marketCapFormat = new DecimalFormat();
|
||||
marketCapFormat.setMaximumFractionDigits(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base-58 encoded String representation of this
|
||||
* object, including version and checksum bytes.
|
||||
|
|
Loading…
Add table
Reference in a new issue