-
-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
please Open to use Country #136
Comments
Hi, I am facing the same situation. I would like to store in my database the country code extracted from the chosen country (I can do that), and after, when I retrieve the country code, display the country name (without using the . It would be awesome if this class was usable outside the package. As a temporary workaround for my case, I created a class com.hbb20.MyCountry (which is in the same package so accessible and containing the following code: package com.hbb20;
import android.content.Context;
import java.util.Locale;
public class MyCountry {
private Country country;
private MyCountry(Country country) {
this.country = country;
}
public String getName() {
return country.getName();
}
public static MyCountry fromCodeName(Context context, String codeName) {
Locale currentLocale = context.getResources().getConfiguration().locale;
CountryCodePicker.Language chosenLanguage = null;
for (CountryCodePicker.Language language : CountryCodePicker.Language.values()) {
if (language.getCode().equalsIgnoreCase(currentLocale.getLanguage())) {
chosenLanguage = language;
}
}
if (chosenLanguage == null) {
chosenLanguage = CountryCodePicker.Language.ENGLISH;
}
return new MyCountry(Country.getCountryForNameCodeFromLibraryMasterList(context, chosenLanguage, codeName));
}
} |
so, this is not good)) |
Yes, you are right. But as I said, it is only a temporary workaround. By doing this I don't need to fork, sync the changes and publish my own library to maven, which is time consuming compared to the 10 minutes I took to make this class. It works for now and with some luck the author will open the class so I can get rid of this class in the near future :) |
Sorry for the trouble it is causing to you people. As this was not my own use case so I never realized need to make country class open. I will open this class and release the new version (along with other pending features) soon. If you can wait for a week then it will good enough for me. |
Thanks @hbb20 ! Actually, your library is much more powerful than just letting us pick some country or write number formatted as we type. You solve such a headache with your library :p |
Please try v2.1.1. Please note that name of the class is changed to CCPCountry from Country to avoid any possible confusion. Please let me know if you want something else. Thanks |
Thanks @hbb20, works well! |
Hi!
I need use in my custom Fragment (Search Toolbar + RecyclerView) your Country Database)
so please open our class Country or CountryAdapter)
The text was updated successfully, but these errors were encountered: