Merge pull request #3674 from bodymindarts/fix-bsq-monetary-format

Use correct monetary format in BsqFormatter
This commit is contained in:
Florian Reimair 2019-11-25 12:37:54 +01:00 committed by GitHub
commit 4c9d915031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,23 +72,13 @@ public class BsqFormatter implements CoinFormatter {
@Inject @Inject
public BsqFormatter() { public BsqFormatter() {
this.monetaryFormat = BisqEnvironment.getParameters().getMonetaryFormat(); this.btcCoinFormat = BisqEnvironment.getParameters().getMonetaryFormat();
this.immutableCoinFormatter = new ImmutableCoinFormatter(BisqEnvironment.getParameters().getMonetaryFormat()); this.monetaryFormat = new MonetaryFormat().shift(6).code(6, "BSQ").minDecimals(2);
this.immutableCoinFormatter = new ImmutableCoinFormatter(monetaryFormat);
GlobalSettings.localeProperty().addListener((observable, oldValue, newValue) -> switchLocale(newValue)); GlobalSettings.localeProperty().addListener((observable, oldValue, newValue) -> switchLocale(newValue));
switchLocale(GlobalSettings.getLocale()); switchLocale(GlobalSettings.getLocale());
btcCoinFormat = monetaryFormat;
final String baseCurrencyCode = BisqEnvironment.getBaseCurrencyNetwork().getCurrencyCode();
switch (baseCurrencyCode) {
case "BTC":
monetaryFormat = new MonetaryFormat().shift(6).code(6, "BSQ").minDecimals(2);
break;
default:
throw new RuntimeException("baseCurrencyCode not defined. baseCurrencyCode=" + baseCurrencyCode);
}
amountFormat.setMinimumFractionDigits(2); amountFormat.setMinimumFractionDigits(2);
} }