| | |
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Set;
|
| | |
|
| | | public class CountryDialog extends PopupWindow implements WheelView.OnWheelItemSelectedListener {
|
| | |
|
| | |
| | | countriesGroupByFirstLetter = _countriesGroupByFirstLetter;
|
| | | }
|
| | |
|
| | | public static boolean hasCountries() {
|
| | | return countriesGroupByFirstLetter.size() > 0 ? true : false;
|
| | | }
|
| | |
|
| | | @OnClick(R.id.dialog_country_ok)
|
| | | public void dialog_country_ok_click(View view) {
|
| | | for (OkClickedListener okButtonClickedListener : okButtonClickedListeners) {
|
| | |
| | | dismiss();
|
| | | }
|
| | |
|
| | | public CountryDialog(View parentView, OkClickedListener okButtonClickedListener) {
|
| | | public CountryDialog(View parentView, OkClickedListener okButtonClickedListener, String defaultValue) {
|
| | | view = LayoutInflater.from(MainActivity.getInstance()).inflate(R.layout.dialog_country, null);
|
| | | ViewUtils.inject(this, view);
|
| | |
|
| | | if (defaultValue != null && !"".equals(defaultValue)) {
|
| | | for (int i = 0; i < uniqueFirstLetterList.size(); i++) {
|
| | | String firstLetter = uniqueFirstLetterList.get(i);
|
| | | int j = 0;
|
| | | for(String countryName : countriesGroupByFirstLetter.get(firstLetter)) {
|
| | | if (defaultValue.equals(countryName)) {
|
| | | dialog_country_name_first_letter.setSelection(i);
|
| | | dialog_country_name.setSelection(j);
|
| | | break;
|
| | | }
|
| | | j++;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | this.countriesWithSameFirstLetter = countriesGroupByFirstLetter.get(uniqueFirstLetterList.get(dialog_country_name_first_letter.getSelection()));
|
| | |
|
| | |
| | | dialog_country_name_first_letter.setBackgroundResource(R.color.colorBackground);
|
| | | dialog_country_name_first_letter.setStyle(wheelViewStyle);
|
| | |
|
| | | dialog_country_name_first_letter.setSelection(4);
|
| | |
|
| | | //dialog_country_name_first_letter.setSelection(4);
|
| | |
|
| | | dialog_country_name.setWheelAdapter(new SelectDialog.WheelAdapter(MainActivity.getInstance()));
|
| | | dialog_country_name.setSkin(WheelView.Skin.Holo);
|