protected override void OnResume()
        {
            bool hasSession = sessionManager.GetSession();

            switch (isConnected)
            {
            case true:
                switch (hasSession)
                {
                case true when !string.IsNullOrEmpty(sessionManager.GetFirstname()):
                    StartActivity(typeof(MainActivity));
                    Finish();
                    break;

                default:
                    StartActivity(typeof(OnboardingActivity));
                    Finish();
                    break;
                }

                break;

            case false:
                NoNetworkFragment.Display(SupportFragmentManager);
                break;
            }
            base.OnResume();
        }
        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. 3
0
        private void NextButton_Click(object sender, EventArgs e)
        {
            ShowProgressDialog();
            var otpCode = CodePinView.Value;

            if (!CrossConnectivity.Current.IsConnected)
            {
                Android.Support.V4.App.DialogFragment dialogFragment = new NoNetworkFragment();
                dialogFragment.Show(SupportFragmentManager, "no network");
            }
            else
            {
                VerifyCode(otpCode);
            }
        }