Ejemplo n.º 1
0
        private void prepareViews()
        {
            NavigationController.NavigationBarHidden = true;

            ActivityIndicator.Alpha = 0;
            ActivityIndicator.StartSpinning();

            SignupButton.SetTitleColor(
                Core.UI.Helper.Colors.Login.DisabledButtonColor.ToNativeColor(),
                UIControlState.Disabled
                );

            EmailTextField.ShouldReturn += _ => {
                PasswordTextField.BecomeFirstResponder();
                return(false);
            };

            PasswordTextField.ShouldReturn += _ =>
            {
                ViewModel.Signup.Execute();
                PasswordTextField.ResignFirstResponder();
                return(false);
            };

            View.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                EmailTextField.ResignFirstResponder();
                PasswordTextField.ResignFirstResponder();
            }));

            ShowPasswordButton.SetupShowPasswordButton();
        }
Ejemplo n.º 2
0
        private void prepareViews()
        {
            NavigationController.NavigationBarHidden = true;

            LoginButton.SetTitleColor(
                Foundation.MvvmCross.Helper.Color.Login.DisabledButtonColor.ToNativeColor(),
                UIControlState.Disabled
                );

            EmailTextField.ShouldReturn += _ =>
            {
                PasswordTextField.BecomeFirstResponder();
                return(false);
            };

            PasswordTextField.ShouldReturn += _ =>
            {
                ViewModel.Login();
                PasswordTextField.ResignFirstResponder();
                return(false);
            };

            View.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                EmailTextField.ResignFirstResponder();
                PasswordTextField.ResignFirstResponder();
            }));

            prepareForgotPasswordButton();
            ShowPasswordButton.SetupShowPasswordButton();
        }
Ejemplo n.º 3
0
        public override void LoadView()
        {
            base.LoadView();

            //Add tap gesture recognizer for view
            UITapGestureRecognizer tapSpaceRecoginzer = new UITapGestureRecognizer();

            tapSpaceRecoginzer.AddTarget(() => EmailTextField.ResignFirstResponder());
            View.AddGestureRecognizer(tapSpaceRecoginzer);
        }
Ejemplo n.º 4
0
        private void prepareViews()
        {
            NavigationController.NavigationBarHidden = true;

            ActivityIndicator.Alpha = 0;
            ActivityIndicator.StartSpinning();

            SignupButton.SetTitleColor(
                Color.Login.DisabledButtonColor.ToNativeColor(),
                UIControlState.Disabled
                );

            EmailTextField.ShouldReturn += _ => {
                PasswordTextField.BecomeFirstResponder();
                return(false);
            };

            PasswordTextField.ShouldReturn += _ =>
            {
                ViewModel.SignupCommand.Execute();
                PasswordTextField.ResignFirstResponder();
                return(false);
            };

            View.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                EmailTextField.ResignFirstResponder();
                PasswordTextField.ResignFirstResponder();
            }));

            SignupShakeTriggerButton.TouchUpInside += (sender, e) =>
            {
                if (!ViewModel.Email.IsValid)
                {
                    EmailTextField.Shake();
                }
                if (!ViewModel.Password.IsValid)
                {
                    PasswordTextField.Shake();
                }
                if (!ViewModel.IsCountryValid)
                {
                    SelectCountryButton.Shake();
                    CountryNotSelectedImageView.Shake();
                    CountryDropDownCaretImageView.Shake();
                }
            };

            ShowPasswordButton.SetupShowPasswordButton();

            EmailTextField.ResignFirstResponder();
            PasswordTextField.ResignFirstResponder();
        }
Ejemplo n.º 5
0
        private void GestureGecognizer()
        {
            var gestureRecognizer = new UITapGestureRecognizer(() =>
            {
                FirstNameTextField.ResignFirstResponder();
                LastNameTextField.ResignFirstResponder();
                EmailTextField.ResignFirstResponder();
                PasswordTextField.ResignFirstResponder();
                ConfirmPasswordTextField.ResignFirstResponder();
                PhoneNumberTextField.ResignFirstResponder();
            });

            View.AddGestureRecognizer(gestureRecognizer);
        }
Ejemplo n.º 6
0
        private void setupKeyboardDismissingGestureRecognizers()
        {
            void dismissKeyboard()
            {
                EmailTextField.ResignFirstResponder();
                PasswordTextField.ResignFirstResponder();
            }

            View.AddGestureRecognizer(new UITapGestureRecognizer(dismissKeyboard));

            View.AddGestureRecognizer(new UIPanGestureRecognizer((recognizer) =>
            {
                if (recognizer.TranslationInView(View).Y > 0)
                {
                    dismissKeyboard();
                }
            }));
        }
Ejemplo n.º 7
0
        partial void ShowRegionsSelectorTableView(Foundation.NSObject sender)
        {
            EmailTextField.ResignFirstResponder();

            RegionsTableViewController regionsTVC = new RegionsTableViewController(SetSelectedRegion, RegionNameTextField.Text);

            UIPopoverController popoverController = new UIPopoverController(regionsTVC);

            popoverController.BackgroundColor = UIColor.White;
            popoverController.SetPopoverContentSize(new CoreGraphics.CGSize(340, 230), true);
            AppDisplayUtil.Instance.SetPopoverController(popoverController);

            CGRect anchorFrame = ((UIButton)sender).Frame;

            anchorFrame.Width /= 2;

            popoverController.PresentFromRect(new CGRect(75, 30, 0, 0), (UIView)sender, UIPopoverArrowDirection.Any, true);
        }
Ejemplo n.º 8
0
        private void prepareViews()
        {
            NavigationController.NavigationBarHidden = true;

            LoginButton.SetTitleColor(
                Color.Login.DisabledButtonColor.ToNativeColor(),
                UIControlState.Disabled
                );

            EmailTextField.ShouldReturn += _ => {
                PasswordTextField.BecomeFirstResponder();
                return(false);
            };

            PasswordTextField.ShouldReturn += _ =>
            {
                ViewModel.LoginCommand.Execute();
                PasswordTextField.ResignFirstResponder();
                return(false);
            };

            View.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                EmailTextField.ResignFirstResponder();
                PasswordTextField.ResignFirstResponder();
            }));

            LoginShakeTriggerButton.TouchUpInside += (sender, e) =>
            {
                if (!ViewModel.Email.IsValid)
                {
                    EmailTextField.Shake();
                }
                if (!ViewModel.Password.IsValid)
                {
                    PasswordTextField.Shake();
                }
            };

            PasswordTextField.ResignFirstResponder();

            ShowPasswordButton.SetupShowPasswordButton();
            prepareForgotPasswordButton();
        }
Ejemplo n.º 9
0
        private void SetDataAndStyleToView()
        {
            // init strings in view
            InitializeAllStrings();

            // set up the background
            //BackgroundImageView2.Image = UIImage.FromBundle("LoginBackground");

            // dissmiss the keyboard when i press return key on email TextField
            EmailTextField.ShouldReturn += (textField) =>
            {
                EmailTextField.ResignFirstResponder();
                PasswordTextField.BecomeFirstResponder();
                return(true);
            };

            // dissmiss the keyboard when i press return key on password TextField
            PasswordTextField.ShouldReturn += (textField) =>
            {
                PasswordTextField.ResignFirstResponder();
                LoginButton_TouchUpInside(null, null);
                return(true);
            };

            // dissmiss the keyboard when i press return key on Name TextField
            FirstNameTextField.ShouldReturn += (textField) =>
            {
                FirstNameTextField.ResignFirstResponder();
                LastNameTextField.BecomeFirstResponder();
                return(true);
            };

            // dissmiss the keyboard when i press return key on FirstName TextField
            LastNameTextField.ShouldReturn += (textField) =>
            {
                LastNameTextField.ResignFirstResponder();
                EmailTextFieldOfRegistration.BecomeFirstResponder();
                return(true);
            };

            // dissmiss the keyboard when i press return key on email TextField
            EmailTextFieldOfRegistration.ShouldReturn += (textField) =>
            {
                EmailTextFieldOfRegistration.ResignFirstResponder();
                PasswordTextFieldOfRegistration.BecomeFirstResponder();
                return(true);
            };

            // dissmiss the keyboard when i press return key on password TextField
            PasswordTextFieldOfRegistration.ShouldReturn += (textField) =>
            {
                PasswordTextFieldOfRegistration.ResignFirstResponder();
                ConfirmPasswordTextField.BecomeFirstResponder();
                return(true);
            };
            PasswordTextFieldOfRegistration.EditingChanged += (o, e) =>
            {
                ErrorMessageLabel.Hidden = true;
            };
            PasswordTextFieldOfRegistration.ShouldBeginEditing += (textField) =>
            {
                if (View.Frame.Y >= 0)
                {
                    bottom = ((float)(RegistrationContainer.Frame.Y + PasswordTextFieldOfRegistration.Frame.Y + PasswordTextFieldOfRegistration.Frame.Height + 10));
                }
                return(true);
            };

            // dissmiss the keyboard when i press return key on Confirm Password TextField
            ConfirmPasswordTextField.ShouldReturn += (textField) =>
            {
                ConfirmPasswordTextField.ResignFirstResponder();
                return(true);
            };
            ConfirmPasswordTextField.EditingChanged += (o, e) =>
            {
                ErrorMessageLabel.Hidden = true;
            };
            ConfirmPasswordTextField.ShouldBeginEditing += (textField) =>
            {
                if (View.Frame.Y >= 0)
                {
                    bottom = ((float)(RegistrationContainer.Frame.Y + ConfirmPasswordTextField.Frame.Y + ConfirmPasswordTextField.Frame.Height + 10));
                }
                return(true);
            };

            // dissmiss the keyboard when i press return key on Confirm Password TextField
            EmailTextFieldOfForgetPassword.ShouldReturn += (textField) =>
            {
                EmailTextFieldOfForgetPassword.ResignFirstResponder();
                return(true);
            };

            EmailTextField.KeyboardType                       = UIKeyboardType.EmailAddress;
            EmailTextField.AutocorrectionType                 = UITextAutocorrectionType.No;
            PasswordTextField.AutocorrectionType              = UITextAutocorrectionType.No;
            FirstNameTextField.ReturnKeyType                  = UIReturnKeyType.Next;
            LastNameTextField.AutocorrectionType              = UITextAutocorrectionType.No;
            LastNameTextField.ReturnKeyType                   = UIReturnKeyType.Next;
            EmailTextFieldOfRegistration.KeyboardType         = UIKeyboardType.EmailAddress;
            EmailTextFieldOfRegistration.AutocorrectionType   = UITextAutocorrectionType.No;
            EmailTextFieldOfRegistration.ReturnKeyType        = UIReturnKeyType.Next;
            PasswordTextFieldOfRegistration.ReturnKeyType     = UIReturnKeyType.Next;
            ConfirmPasswordTextField.ReturnKeyType            = UIReturnKeyType.Next;
            EmailTextFieldOfForgetPassword.KeyboardType       = UIKeyboardType.EmailAddress;
            EmailTextFieldOfForgetPassword.AutocorrectionType = UITextAutocorrectionType.No;

            // set up the rounded corner fot the button
            LoadingIndicator.Hidden         = true;
            LoginButton.Layer.CornerRadius  = 4;
            LoginButton.Layer.MasksToBounds = true;

            RegistrationButton.Layer.CornerRadius  = 4;
            RegistrationButton.Layer.MasksToBounds = true;
            RegistrationButton.Enabled             = false;

            ResetPasswordButton.Layer.CornerRadius  = 4;
            ResetPasswordButton.Layer.MasksToBounds = true;
            ResetPasswordButton.Enabled             = false;

            //DisplayFacebookButton();
            //_facebookButton.Layer.CornerRadius = 4;
            //_facebookButton.Layer.MasksToBounds = true;

            CreateAccountButton.ContentEdgeInsets  = new UIEdgeInsets(5, 0, 5, 5);
            ForgetPasswordButton.ContentEdgeInsets = new UIEdgeInsets(5, 5, 5, 0);

            LoginContainer.Hidden          = false;
            RegistrationContainer.Hidden   = true;
            ForgetPasswordContainer.Hidden = true;
            BackButton.Hidden           = true;
            CreateAccountButton.Hidden  = false;
            ForgetPasswordButton.Hidden = false;
            ErrorMessageLabel.Hidden    = true;
            ErrorMessageLabel.TextColor = UIColor.FromRGB(255, 76, 56);
        }
        partial void OnClick(UIButton sender)
        {
            EmailTextField.ResignFirstResponder();
            PasswordTextField.ResignFirstResponder();
            FirstNameTextField.ResignFirstResponder();
            LastNameTextField.ResignFirstResponder();

            //Ensure required fields are input
            if (Settings.Email == null || Settings.Email == string.Empty)
            {
                HelperMethods.SendBasicAlert("Validation", "Please input a valid email address");
                return;
            }
            if (Settings.Password == null || Settings.Password == string.Empty)
            {
                HelperMethods.SendBasicAlert("Validation", "Please input a valid password");
                return;
            }

            if (Settings.Email != ReEmailTextField.Text)
            {
                HelperMethods.SendBasicAlert("Validation", "Email doesn't match");
                return;
            }

            if (Settings.Password != RePasswordTextField.Text)
            {
                HelperMethods.SendBasicAlert("Validation", "Password doesn't match");
                return;
            }


            if (Settings.FirstName == null || Settings.FirstName == string.Empty)
            {
                HelperMethods.SendBasicAlert("Validation", "Please input your first name");
                return;
            }
            if (Settings.LastName == null || Settings.LastName == string.Empty)
            {
                HelperMethods.SendBasicAlert("Validation", "Please input your last name");
                return;
            }
            if (Settings.Phone == null || Settings.Phone == string.Empty)
            {
                HelperMethods.SendBasicAlert("Validation", "Please input your phone number");
                return;
            }

            if (Settings.LocationPickerSelectedId == 0)
            {
                HelperMethods.SendBasicAlert("Validation", "Please select your location");
                return;
            }

            RegistrationViewController registrationVC = (RegistrationViewController)((MultiStepProcessHorizontalViewController)this.ParentViewController).ContainerViewController;
            var stepThree = registrationVC.Steps[2];

            registrationVC._pageViewController.SetViewControllers(new[] { stepThree as UIViewController }, UIPageViewControllerNavigationDirection.Forward, true, (finished) =>
            {
                if (finished)
                {
                    //finalStep.StepActivated(this, new MultiStepProcessStepEventArgs());
                }
            });
            //throw new NotImplementedException();
        }
Ejemplo n.º 11
0
        public override void SetDataAndStyleToView()
        {
            Title = Application.LocalizedString("ParameterTitle");
            InitialiseAllStrings();

            // round corner on the button modify the image of the user
            ModifyUserImageButton.Layer.CornerRadius = 4;
            ModifyUserImageButton.Layer.BorderWidth  = 1;
            ModifyUserImageButton.Layer.BorderColor  = UIColor.FromRGBA(98, 218, 115, 255).CGColor;
            ModifyUserImageButton.ContentEdgeInsets  = new UIEdgeInsets(5, 10, 5, 10);

            SaveButton.Layer.CornerRadius  = 4;
            SaveButton.Layer.MasksToBounds = true;
            AboutButton.Enabled            = true;
            LogOutButton.Enabled           = true;
            EmailTextField.Enabled         = false;

            // Free Credits Details
            RefreshDisplayedCreditCount();

            FirstNameTextField.EditingChanged += (o, e) => { _hasDataChanged = true; SaveButton.Enabled = true; };
            FirstNameTextField.ShouldReturn   += (textField) =>
            {
                FirstNameTextField.ResignFirstResponder();
                return(true);
            };

            LastNameTextField.EditingChanged += (o, e) => { _hasDataChanged = true; SaveButton.Enabled = true; };
            LastNameTextField.ShouldReturn   += (textField) =>
            {
                LastNameTextField.ResignFirstResponder();
                _hasDataChanged = true;
                return(true);
            };

            EmailTextField.EditingChanged += (o, e) =>
            {
                _hasDataChanged    = true;
                SaveButton.Enabled = true;
                EmailTextField.AutocorrectionType = UITextAutocorrectionType.No;
            };

            EmailTextField.ShouldReturn += (textField) =>
            {
                EmailTextField.ResignFirstResponder();
                _hasDataChanged = true;
                return(true);
            };

            CountryCodeTextField.EditingChanged += (o, e) => { _hasDataChanged = true; SaveButton.Enabled = true; };
            CountryCodeTextField.ShouldReturn   += (textField) =>
            {
                CountryCodeTextField.ResignFirstResponder();
                _hasDataChanged = true;
                return(true);
            };

            PhoneNumberTextField.EditingChanged += (o, e) => { _hasDataChanged = true; SaveButton.Enabled = true; };
            PhoneNumberTextField.ShouldReturn   += (textField) =>
            {
                PhoneNumberTextField.ResignFirstResponder();
                _hasDataChanged = true;
                return(true);
            };

            var toolbar = new UIToolbar();

            toolbar.BarStyle    = UIBarStyle.Default;
            toolbar.Translucent = true;
            toolbar.SizeToFit();

            // Done button
            var doneButton = new UIBarButtonItem(Application.LocalizedString("Validate"), UIBarButtonItemStyle.Done, (s, e) =>
            {
                PhoneNumberTextField.ResignFirstResponder();
            });

            toolbar.SetItems(new UIBarButtonItem[] { doneButton }, true);
            PhoneNumberTextField.InputAccessoryView = toolbar;
            PhoneNumberTextField.InputAccessoryView = toolbar;
            PhoneNumberTextField.InputAccessoryView = toolbar;

            FirstNameTextField.Text           = App.CurrentUserEnvironment.User.FirstName;
            LastNameTextField.Text            = App.CurrentUserEnvironment.User.LastName;
            EmailTextField.Text               = App.CurrentUserEnvironment.User.Email;
            PhoneNumberTextField.KeyboardType = UIKeyboardType.DecimalPad;
            //if (!string.IsNullOrEmpty(App.CurrentUserEnvironment.User.PhoneNumber))
            //{
            //    var phoneNumber = App.CurrentUserEnvironment.User.PhoneNumber.Split('|');
            //    if (phoneNumber != null && phoneNumber.Length == 2)
            //    {
            //        if (phoneNumber[0].Contains("+"))
            //        {
            //            phoneNumber[0] = phoneNumber[0].Substring(1, phoneNumber[0].Length - 1);
            //        }
            //        CountryCodeTextField.Text = phoneNumber[0];
            //        PhoneNumberTextField.Text = phoneNumber[1];
            //    }
            //}
            UserImageView.Layer.CornerRadius = UserImageView.Frame.Size.Width / 2;
            UserImageView.ClipsToBounds      = true;
            if (!string.IsNullOrEmpty(App.CurrentUserEnvironment.User.UserPicture))
            {
                using (var dataDecoded = new NSData(App.CurrentUserEnvironment.User.UserPicture
                                                    , NSDataBase64DecodingOptions.IgnoreUnknownCharacters))
                {
                    UserImageView.Image = new UIImage(dataDecoded);
                }
            }
            SaveButton.Enabled = false;
        }
Ejemplo n.º 12
0
 private void resetPasswordButtonTapped()
 => EmailTextField.ResignFirstResponder();
Ejemplo n.º 13
0
        /*
         *处理屏幕转动产生的显示问题
         */
        public override void WillAnimateRotation(UIInterfaceOrientation toInterfaceOrientation, double duration)
        {
            base.WillAnimateRotation(toInterfaceOrientation, duration);

            EmailTextField.ResignFirstResponder();
        }
Ejemplo n.º 14
0
 public override void ViewWillDisappear(bool animated)
 {
     base.ViewWillDisappear(animated);
     EmailTextField.ResignFirstResponder();
 }
Ejemplo n.º 15
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Title = Resources.LoginForgotPassword;
            ResetPasswordButton.SetTitle(Resources.GetPasswordResetLink, UIControlState.Normal);
            EmailTextField.Placeholder = Resources.EmailAddress;
            SuccessMessageLabel.Text   = Resources.PasswordResetSuccess;

            prepareViews();

            //Text
            ViewModel.ErrorMessage
            .Subscribe(errorMessage =>
            {
                ErrorLabel.Text   = errorMessage;
                ErrorLabel.Hidden = string.IsNullOrEmpty(errorMessage);
            })
            .DisposedBy(DisposeBag);

            EmailTextField.Rx().Text()
            .Select(Email.From)
            .Subscribe(ViewModel.Email.OnNext)
            .DisposedBy(DisposeBag);

            ViewModel.Reset.Executing
            .Subscribe(loading =>
            {
                UIView.Transition(
                    ResetPasswordButton,
                    Animation.Timings.EnterTiming,
                    UIViewAnimationOptions.TransitionCrossDissolve,
                    () => ResetPasswordButton.SetTitle(loading ? "" : Resources.GetPasswordResetLink, UIControlState.Normal),
                    null
                    );
            })
            .DisposedBy(DisposeBag);

            //Visibility
            ViewModel.PasswordResetSuccessful
            .Subscribe(DoneCard.Rx().IsVisibleWithFade())
            .DisposedBy(DisposeBag);

            ViewModel.PasswordResetSuccessful
            .Invert()
            .Subscribe(ResetPasswordButton.Rx().IsVisibleWithFade())
            .DisposedBy(DisposeBag);

            ViewModel.PasswordResetSuccessful
            .Where(s => s == false)
            .Subscribe(_ => EmailTextField.BecomeFirstResponder())
            .DisposedBy(DisposeBag);

            ViewModel.PasswordResetSuccessful
            .Where(successful => successful)
            .Subscribe(_ => EmailTextField.ResignFirstResponder())
            .DisposedBy(DisposeBag);

            ViewModel.Reset.Executing
            .Subscribe(ActivityIndicator.Rx().IsVisibleWithFade())
            .DisposedBy(DisposeBag);

            //Colors
            ViewModel.EmailValid
            .Select(resetButtonTitleColor)
            .Subscribe(ResetPasswordButton.Rx().TitleColor());

            //Commands
            ResetPasswordButton.Rx()
            .BindAction(ViewModel.Reset)
            .DisposedBy(DisposeBag);

            ViewModel.PasswordResetWithInvalidEmail
            .Subscribe(_ => EmailTextField.Shake())
            .DisposedBy(DisposeBag);

            UIColor resetButtonTitleColor(bool enabled) => enabled
                    ? Colors.Login.EnabledButtonColor.ToNativeColor()
                    : Colors.Login.DisabledButtonColor.ToNativeColor();
        }