mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-18 14:55:53 -04:00
Use Utilities when accessing the default currency
This commit is contained in:
parent
c57aba7992
commit
a23277a527
@ -46,8 +46,8 @@ public class FeePolicy {
|
||||
|
||||
switch (bitcoinNetwork) {
|
||||
case TESTNET:
|
||||
createOfferFeeAddress = "mmm8BdTcHoc5wi75RmiQYsJ2Tr1NoZmM84";
|
||||
takeOfferFeeAddress = "mmm8BdTcHoc5wi75RmiQYsJ2Tr1NoZmM84";
|
||||
createOfferFeeAddress = "mopJDiHncoveyy7S7FZTUNVbrCxazxvGrE";
|
||||
takeOfferFeeAddress = "mopJDiHncoveyy7S7FZTUNVbrCxazxvGrE";
|
||||
break;
|
||||
case MAINNET:
|
||||
// bitsquare donation address used for the moment...
|
||||
|
@ -20,6 +20,7 @@ package io.bitsquare.gui.util;
|
||||
import io.bitsquare.arbitrator.Arbitrator;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
import io.bitsquare.locale.Country;
|
||||
import io.bitsquare.locale.CurrencyUtil;
|
||||
import io.bitsquare.offer.Direction;
|
||||
import io.bitsquare.offer.Offer;
|
||||
import io.bitsquare.user.User;
|
||||
@ -33,7 +34,6 @@ import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import java.util.Currency;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -68,7 +68,7 @@ public class BSFormatter {
|
||||
// no way to remove grouping separator). It seems to be not optimal for user input formatting.
|
||||
private MonetaryFormat coinFormat = MonetaryFormat.BTC.repeatOptionalDecimals(2, 2);
|
||||
|
||||
private String currencyCode = Currency.getInstance(Locale.getDefault()).getCurrencyCode();
|
||||
private String currencyCode = CurrencyUtil.getDefaultCurrency().getCurrencyCode();
|
||||
|
||||
// format is like: 1,00 never more then 2 decimals
|
||||
private final MonetaryFormat fiatFormat = MonetaryFormat.FIAT.repeatOptionalDecimals(0, 0).code(0, currencyCode);
|
||||
@ -77,7 +77,7 @@ public class BSFormatter {
|
||||
@Inject
|
||||
public BSFormatter(User user) {
|
||||
if (user.currentBankAccountProperty().get() == null)
|
||||
setFiatCurrencyCode(Currency.getInstance(Locale.getDefault()).getCurrencyCode());
|
||||
setFiatCurrencyCode(CurrencyUtil.getDefaultCurrency().getCurrencyCode());
|
||||
else if (user.currentBankAccountProperty().get() != null)
|
||||
setFiatCurrencyCode(user.currentBankAccountProperty().get().getCurrency().getCurrencyCode());
|
||||
|
||||
|
@ -18,11 +18,9 @@
|
||||
package io.bitsquare.gui.util.validation;
|
||||
|
||||
import io.bitsquare.locale.BSResources;
|
||||
import io.bitsquare.locale.CurrencyUtil;
|
||||
import io.bitsquare.user.User;
|
||||
|
||||
import java.util.Currency;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@ -46,7 +44,7 @@ public final class FiatValidator extends NumberValidator {
|
||||
public FiatValidator(User user) {
|
||||
if (user != null) {
|
||||
if (user.currentBankAccountProperty().get() == null)
|
||||
setFiatCurrencyCode(Currency.getInstance(Locale.getDefault()).getCurrencyCode());
|
||||
setFiatCurrencyCode(CurrencyUtil.getDefaultCurrency().getCurrencyCode());
|
||||
else if (user.currentBankAccountProperty().get() != null)
|
||||
setFiatCurrencyCode(user.currentBankAccountProperty().get().getCurrency().getCurrencyCode());
|
||||
|
||||
|
@ -18,11 +18,9 @@
|
||||
package io.bitsquare.gui.util.validation;
|
||||
|
||||
import io.bitsquare.locale.BSResources;
|
||||
import io.bitsquare.locale.CurrencyUtil;
|
||||
import io.bitsquare.user.User;
|
||||
|
||||
import java.util.Currency;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@ -46,7 +44,7 @@ public final class OptionalFiatValidator extends NumberValidator {
|
||||
public OptionalFiatValidator(User user) {
|
||||
if (user != null) {
|
||||
if (user.currentBankAccountProperty().get() == null)
|
||||
setFiatCurrencyCode(Currency.getInstance(Locale.getDefault()).getCurrencyCode());
|
||||
setFiatCurrencyCode(CurrencyUtil.getDefaultCurrency().getCurrencyCode());
|
||||
else if (user.currentBankAccountProperty().get() != null)
|
||||
setFiatCurrencyCode(user.currentBankAccountProperty().get().getCurrency().getCurrencyCode());
|
||||
|
||||
|
@ -20,7 +20,6 @@ package io.bitsquare.locale;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Currency;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
public class CurrencyUtil {
|
||||
@ -47,9 +46,8 @@ public class CurrencyUtil {
|
||||
final List<Currency> resultList = new ArrayList<>(mainCurrencies);
|
||||
resultList.addAll(allCurrenciesList);
|
||||
|
||||
Currency defaultCurrency = Currency.getInstance(Locale.getDefault());
|
||||
resultList.remove(defaultCurrency);
|
||||
resultList.add(0, defaultCurrency);
|
||||
resultList.remove(getDefaultCurrency());
|
||||
resultList.add(0, getDefaultCurrency());
|
||||
|
||||
return resultList;
|
||||
}
|
||||
@ -57,6 +55,6 @@ public class CurrencyUtil {
|
||||
public static Currency getDefaultCurrency() {
|
||||
// TODO Only display EUR for the moment
|
||||
return Currency.getInstance("EUR");
|
||||
// NumberFormat.getNumberInstance(Locale.getDefault()).getCurrency();
|
||||
// return Currency.getInstance(Locale.getDefault());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user