private void GetWidgets()
        {
            mGoogleFab          = (FloatingActionButton)FindViewById(Resource.Id.fab_google);
            mGoogleFab.Click   += MGoogleFab_Click;
            mFacebookFab        = (FloatingActionButton)FindViewById(Resource.Id.fab_fb);
            mFacebookFab.Click += MFacebookFab_Click;

            mRelativeLayout = (RelativeLayout)FindViewById(Resource.Id.onboard_root);
            mRelativeLayout.RequestFocus();

            mLinearLayout = (LinearLayout)FindViewById(Resource.Id.mLinear_view_2);
            ccLinear      = (LinearLayout)FindViewById(Resource.Id.cc_layout_2);

            mEditText = (EditText)FindViewById(Resource.Id.user_phone_edittext2);
            mEditText.SetCursorVisible(false);
            mEditText.Click       += MEditText_Click;
            mEditText.FocusChange += MEditText_FocusChange;
            mLinearLayout.Click   += MLinearLayout_Click;

            //country code tools
            countryFlagImg = (CircleImageView)FindViewById(Resource.Id.country_flag_img_2);
            builder        = new CountryPicker.Builder().With(this).SortBy(CountryPicker.SortByName);
            picker         = builder.Build();
            country        = picker.CountryFromSIM;
            countryFlagImg.SetBackgroundResource(country.Flag);
        }
Esempio n. 2
0
        private void ShowCountryListDialog(EditText editText)
        {
            codeEditText = editText;
            var builder = new CountryPicker.Builder()
                          .With(CrossCurrentActivity.Current.Activity)
                          .Listener(this);
            var picker = builder.Build();

            picker.ShowDialog(CrossCurrentActivity.Current.Activity);
        }
        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;
                    }
                }
            };
        }
Esempio n. 4
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            var appbarMain    = view.FindViewById <AppBarLayout>(Resource.Id.enter_phone_appbar);
            var toolbarMain   = appbarMain.FindViewById <Toolbar>(Resource.Id.main_toolbar);
            var countryLinear = view.FindViewById <ConstraintLayout>(Resource.Id.cpicker_lin);

            phoneEt       = view.FindViewById <TextInputLayout>(Resource.Id.enter_phone_et);
            nextBtn       = view.FindViewById <MaterialButton>(Resource.Id.enter_cont_btn);
            countryFlagIv = view.FindViewById <ImageView>(Resource.Id.cflag_iv);
            dialcodeTv    = view.FindViewById <TextView>(Resource.Id.dialcode_tv);

            ((AppCompatActivity)Activity).SetSupportActionBar(toolbarMain);
            ((AppCompatActivity)Activity).SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            toolbarMain.Title            = "Enter phone";
            toolbarMain.NavigationClick += ToolbarMain_NavigationClick;


            builder = new CountryPicker.Builder().With(Context).Listener(new CountryPickerListener((c) =>
            {
                countryFlagIv.SetImageResource(c.Flag);
                dialcodeTv.Text = c.DialCode;
                phoneEt.RequestFocus();
            }));
            picker = builder.Build();

            var country = picker.CountryFromSIM;

            countryFlagIv.SetImageResource(country.Flag);
            dialcodeTv.Text = country.DialCode;
            phoneEt.RequestFocus();
            phoneEt.EditText.TextChanged += EditText_TextChanged;

            countryLinear.Click += CountryLinear_Click;

            nextBtn.Click += NextBtn_Click;
        }
Esempio n. 5
0
        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);
            }
        }