private void InitControls() { mToolbar = (Android.Support.V7.Widget.Toolbar)FindViewById(Resource.Id.getting_started_toolbar); if (mToolbar != null) { SetSupportActionBar(mToolbar); } SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.Title = ""; CCLayout = (LinearLayout)FindViewById(Resource.Id.cc_layout); CCLayout.Click += (s3, e3) => { picker.ShowBottomSheet(this); }; CCTV = (TextView)FindViewById(Resource.Id.cc_textview); //country code tools countryFlagImg = (CircleImageView)FindViewById(Resource.Id.country_flag_img); countryFlagImg.RequestFocus(); builder = new CountryPicker.Builder().With(this).Listener(this).SortBy(CountryPicker.SortByName); picker = builder.Build(); country1 = picker.CountryFromSIM; country_code = country1.Code; countryFlagImg.SetBackgroundResource(country1.Flag); CCTV.Text = country1.DialCode; UserPhoneText = (EditText)FindViewById(Resource.Id.user_phone_edittext); UserPhoneText.AddTextChangedListener(this); UserPhoneText.SetOnKeyListener(this); PrimaryButton = (Button)FindViewById(Resource.Id.primary_btn); PrimaryButton.Click += (s1, e1) => { if (!CrossConnectivity.Current.IsConnected) { Android.Support.V4.App.DialogFragment dialogFragment = new NoNetworkFragment(); dialogFragment.Show(SupportFragmentManager, "no network"); } else { if (!ValidatePhoneNumberAndCode()) { return; } } }; }
private void ShowPicker() { var builder = new CountryPicker.Builder().With(this).Listener(this); if (_styleSwitch.Checked) { builder.Style(R.Style.CountryPickerStyle); } builder.Theme(_themeSwitch.Checked ? CountryPicker.ThemeNew : CountryPicker.ThemeOld) .CanSearch(_searchSwitch.Checked) .SortBy(_sortBy); _countryPicker = builder.Build(); if (_useBottomSheet.Checked) { _countryPicker.ShowBottomSheet(this); } else { _countryPicker.ShowDialog(this); } }