Class 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)  
    • Constructor Detail

      • CountryCodeHelper

        public CountryCodeHelper​(@NonNull
                                 android.content.res.Resources resources,
                                 com.yoti.mobile.android.common.ui.components.utils.IDemonymProvider demonymProvider)
    • 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. Uses Locale.getDefault() and if this returns only a language and no country, will use Configuration.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()