Class CountryCodeHelper
- java.lang.Object
-
- com.yoti.mobile.android.common.ui.components.utils.CountryCodeHelper
-
public abstract class CountryCodeHelper extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description CountryCodeHelper(android.content.res.Resources resources, com.yoti.mobile.android.common.ui.components.utils.IDemonymProvider demonymProvider)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.util.Locale[]getAvailableLocales()java.util.List<Country>getCountriesForDeviceSupportedPhoneCode()This method is generating a sorted list of countries from the list of supported regions phone codes which are not always countries.CountrygetCountryForCode(java.lang.String countryCodeIso2OrIso3)java.util.LocalegetSuitableLocale(java.lang.String countryCode)If countryCode is null, return the first locale available on the phone.
-
-
-
Method Detail
-
getSuitableLocale
@NonNull public java.util.Locale getSuitableLocale(@Nullable java.lang.String countryCode)If countryCode is null, return the first locale available on the phone. UsesLocale.getDefault()and if this returns only a language and no country, will useConfiguration.getLocales()and try to find the first match for the returned language above.- Parameters:
countryCode- - country pre selected, can be null in which case the above behaviour will be triggered- Returns:
- a locale according to the above rules.
-
getCountriesForDeviceSupportedPhoneCode
public java.util.List<Country> getCountriesForDeviceSupportedPhoneCode()
This method is generating a sorted list of countries from the list of supported regions phone codes which are not always countries.- Returns:
- sorted list of countries
-
getCountryForCode
public Country getCountryForCode(@NonNull java.lang.String countryCodeIso2OrIso3)
-
getAvailableLocales
protected abstract java.util.Locale[] getAvailableLocales()
- Returns:
- a list of available locales. A typical implementation could be returning
Locale.getAvailableLocales()
-
-