Esempio n. 1
0
        public static void OpenCountryCodeDialog(CountryCodePicker codePicker)
        {
            Context context = codePicker.Context;

            Dialog dialog = new Dialog(context, Resource.Style.Theme_AppCompat_Light_Dialog);

            codePicker.RefreshCustomMasterList();
            codePicker.RefreshPreferredCountries();
            List <Country> masterCountries = Country.GetCustomMasterCountryList(codePicker);

            //dialog.RequestWindowFeature(WindowFeatures.NoTitle);
            dialog.Window.SetContentView(Resource.Layout.LayoutPickerDialog);
            RecyclerView recyclerView_countryDialog = (RecyclerView)dialog.FindViewById(Resource.Id.recycler_countryDialog);

            TextView textViewTitle = (TextView)dialog.FindViewById(Resource.Id.textView_title);

            textViewTitle.Text = codePicker.GetDialogTitle();
            EditText editText_search = (EditText)dialog.FindViewById(Resource.Id.editText_search);

            editText_search.Hint = codePicker.GetSearchHintText();
            TextView textView_noResult = (TextView)dialog.FindViewById(Resource.Id.textView_noresult);

            textView_noResult.Text = codePicker.GetNoResultFoundText();
            CountryCodeAdapter cca = new CountryCodeAdapter(context, masterCountries, codePicker, editText_search, textView_noResult, dialog);

            recyclerView_countryDialog.SetLayoutManager(new LinearLayoutManager(context));
            recyclerView_countryDialog.SetAdapter(cca);

            dialog.Show();
        }
 public CountryCodeAdapter(Context context, List <Country> countries, CountryCodePicker codePicker, EditText editText_search, TextView textView_noResult, Dialog dialog)
 {
     this.context           = context;
     this.masterCountries   = countries;
     this.codePicker        = codePicker;
     this.dialog            = dialog;
     this.textView_noResult = textView_noResult;
     this.editText_search   = editText_search;
     this.inflater          = LayoutInflater.From(context);
     SetTextWatcher();
     this.filteredCountries = GetFilteredCountries("");
 }