Closed serhuz closed 2 years ago
There's a logic that checks whether the given currency is valid
private boolean isValid(final Currency currency) { return currency != null && currency.getSymbol() != null && currency.getName() != null && currency.getCode() != null; }
Yet, there are currencies which have no symbol defined, like Hong Kong Dollar
{ "country": "HK", "name": "Hong Kong dollar", "code": "HKD" }
This effectively excludes such currencies from being added to currencyMap field.
currencyMap
private void loadCurrencies(Context context) { final String currencyArray = AssetsReader.readFromAssets(context, R.raw.com_blongho_country_data_currencies); Gson gson = new Gson(); final Currency[] currencies = gson.fromJson(currencyArray, Currency[].class); for (final Currency currency : currencies) { if (isValid(currency)) { currencyMap.put(currency.getCountry().toLowerCase(), currency); } } }
Would it make sense to mark the symbol field as @Nullable and remove isValid() check?
symbol
@Nullable
isValid()
Your first issue in worldCountryData. The team will take a look at it as soon as possible
Staled issue
Thanks for this eye-opener. This issue has been resolved
There's a logic that checks whether the given currency is valid
Yet, there are currencies which have no symbol defined, like Hong Kong Dollar
This effectively excludes such currencies from being added to
currencyMap
field.Would it make sense to mark the
symbol
field as@Nullable
and removeisValid()
check?