Package com.cheetahdigital.uikit.helper
Class CountryDecoder
- java.lang.Object
-
- com.cheetahdigital.uikit.helper.CountryDecoder
-
- All Implemented Interfaces:
java.util.Comparator<com.mukesh.countrypicker.models.Country>
public class CountryDecoder extends java.lang.Object implements java.util.Comparator<com.mukesh.countrypicker.models.Country>
This is used as a helper class in decoding R.string.countries that are base64 encoded to avoid special characters.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CountryDecoder.BaseCountry
BaseCountry class
-
Constructor Summary
Constructors Constructor Description CountryDecoder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(com.mukesh.countrypicker.models.Country lhs, com.mukesh.countrypicker.models.Country rhs)
Comparator for sorting countries by name.static java.lang.String
getCountryCode(java.lang.String countryName)
Gets the country code of a given country (as per CountryPicker implementation)
-
-
-
Method Detail
-
getCountryCode
public static java.lang.String getCountryCode(java.lang.String countryName)
Gets the country code of a given country (as per CountryPicker implementation)- Parameters:
countryName
- name of the country to lookup- Returns:
- country code found using the passed country name. If none found return US
-
compare
public int compare(com.mukesh.countrypicker.models.Country lhs, com.mukesh.countrypicker.models.Country rhs)
Comparator for sorting countries by name.- Specified by:
compare
in interfacejava.util.Comparator<com.mukesh.countrypicker.models.Country>
- Parameters:
lhs
- left-hand siderhs
- right-hand side- Returns:
- positive integer when lhs is greater than rhs, else negative integer
-
-