private void prepareViews() { NavigationController.NavigationBarHidden = true; LoginButton.SetTitleColor( UIColor.White.ColorWithAlpha((nfloat)0.5), UIControlState.Disabled ); EmailTextField.ShouldReturn += _ => { PasswordTextField.BecomeFirstResponder(); return(false); }; PasswordTextField.ShouldReturn += _ => { ViewModel.Login(); PasswordTextField.ResignFirstResponder(); return(false); }; setupKeyboardDismissingGestureRecognizers(); prepareForgotPasswordButton(); ShowPasswordButton.SetupShowPasswordButton(); }
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(); }
public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); ActivityIndicator.Alpha = 0; ActivityIndicator.StartSpinning(); PasswordTextField.ResignFirstResponder(); }
private void prepareViews() { ActivityIndicator.Alpha = 0; ActivityIndicator.StartAnimation(); SignupButton.SetTitleColor( Color.Login.DisabledButtonColor.ToNativeColor(), UIControlState.Disabled ); EmailTextField.ShouldReturn += _ => { PasswordTextField.BecomeFirstResponder(); return(false); }; PasswordTextField.ShouldReturn += _ => { PasswordTextField.ResignFirstResponder(); return(false); }; PasswordTextField.ResignFirstResponder(); ShowPasswordButton.SetupShowPasswordButton(); SelectCountryButton.SemanticContentAttribute = UISemanticContentAttribute.ForceRightToLeft; var spacing = 4; SelectCountryButton.ImageEdgeInsets = new UIEdgeInsets(0, spacing, 0, 0); SelectCountryButton.TitleEdgeInsets = new UIEdgeInsets(0, 0, 0, spacing); }
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(); }
private void prepareViews() { ActivityIndicator.Alpha = 0; ActivityIndicator.StartAnimation(); LoginButton.SetTitleColor( Color.Login.DisabledButtonColor.ToNativeColor(), UIControlState.Disabled ); EmailTextField.ShouldReturn += _ => { PasswordTextField.BecomeFirstResponder(); return(false); }; PasswordTextField.ShouldReturn += _ => { PasswordTextField.ResignFirstResponder(); return(false); }; PasswordTextField.ResignFirstResponder(); ShowPasswordButton.SetupShowPasswordButton(); prepareForgotPasswordButton(); }
private bool TextFieldShouldReturn(UITextField textField) { if (textField.Tag == 0) { PasswordTextField.BecomeFirstResponder(); } else { PasswordTextField.ResignFirstResponder(); } return(true); }
async partial void Authenticate(UIButton _) { var email = EmailTextField.Text; var passw = PasswordTextField.Text; if (string.IsNullOrWhiteSpace(email)) { ErrorMessageDialog(StringResources.common_ui_forms_email_validate_empty); } else if (string.IsNullOrWhiteSpace(passw)) { ErrorMessageDialog(StringResources.common_ui_forms_password_validate_empty); } else if (!Regex.Match(email, @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$").Success) { ErrorMessageDialog(StringResources.common_ui_forms_email_validate_invalid); } else { PasswordTextField.BecomeFirstResponder(); PasswordTextField.ResignFirstResponder(); LoginUIButton.Enabled = false; var client = new RestClient(); LoginActivityIndicator.StartAnimating(); Logger.LOG_EVENT_WITH_ACTION("LOGIN", "ATTEMPT"); var response = await client.Login(email, passw); LoginActivityIndicator.StopAnimating(); LoginUIButton.Enabled = true; if (response.Meta.Messages.Count > 0) { Logger.LOG_EVENT_WITH_ACTION("LOGIN", "ERROR"); // Only show the first error as there var err = StringResources.ResourceManager.GetString($"login.api.error.{response.Meta.Messages[0]}"); ErrorMessageDialog(err); } else if (!string.IsNullOrEmpty(response.Data?.Tokens.Access)) { Logger.LOG_EVENT_WITH_ACTION("LOGIN", "SUCCESS"); NSUserDefaults.StandardUserDefaults.SetString(JsonConvert.SerializeObject(response.Data.Tokens), "tokens"); NSUserDefaults.StandardUserDefaults.SetString(email, "username"); Queries.SetActiveUser(response.Data); Analytics.SetUserID(response.Data.User.Id.ToString()); UIApplication.SharedApplication.Windows[0].RootViewController = UIStoryboard.FromName("Main", null).InstantiateInitialViewController(); } } }
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(); }
private void GestureGecognizer() { var gestureRecognizer = new UITapGestureRecognizer(() => { FirstNameTextField.ResignFirstResponder(); LastNameTextField.ResignFirstResponder(); EmailTextField.ResignFirstResponder(); PasswordTextField.ResignFirstResponder(); ConfirmPasswordTextField.ResignFirstResponder(); PhoneNumberTextField.ResignFirstResponder(); }); View.AddGestureRecognizer(gestureRecognizer); }
public override bool ShouldPerformSegue(string segueIdentifier, NSObject sender) { if (segueIdentifier == "SegueToPink") { if (PasswordTextField.Text == "password") { PasswordTextField.ResignFirstResponder(); return(true); } else { ErrorLabel.Hidden = false; return(false); } } return(base.ShouldPerformSegue(segueIdentifier, sender)); }
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(); } })); }
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(); }
public override void ViewDidLoad() { base.ViewDidLoad(); Title = Resources.LoginTitle; ResetSuccessLabel.Text = Resources.APITokenResetSuccess; InstructionLabel.Text = Resources.TokenResetInstruction; PasswordTextField.Placeholder = Resources.Password; SignOutButton.SetTitle(Resources.OrSignOut, UIControlState.Normal); EmailLabel.Text = ViewModel.Email.ToString(); ViewModel.Error .Subscribe(ErrorLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.Password .Subscribe(PasswordTextField.Rx().TextObserver()) .DisposedBy(DisposeBag); PasswordTextField.Rx().Text() .Subscribe(ViewModel.Password) .DisposedBy(DisposeBag); SignOutButton.Rx() .BindAction(ViewModel.SignOut) .DisposedBy(DisposeBag); ViewModel.SignOut.Elements .Subscribe(IosDependencyContainer.Instance.IntentDonationService.ClearAll) .DisposedBy(DisposeBag); ShowPasswordButton.Rx().Tap() .Subscribe(_ => { PasswordTextField.ResignFirstResponder(); PasswordTextField.SecureTextEntry = !PasswordTextField.SecureTextEntry; PasswordTextField.BecomeFirstResponder(); }) .DisposedBy(DisposeBag); LoginButton.Rx().Tap() .Subscribe(ViewModel.Done.Inputs) .DisposedBy(DisposeBag); PasswordTextField.Rx().ShouldReturn() .Subscribe(ViewModel.Done.Inputs) .DisposedBy(DisposeBag); //Enabled ViewModel.NextIsEnabled .Subscribe(LoginButton.Rx().Enabled()) .DisposedBy(DisposeBag); //Visibility ErrorLabel.Hidden = true; ViewModel.HasError .Subscribe(ErrorLabel.Rx().AnimatedIsVisible()) .DisposedBy(DisposeBag); ViewModel.Done.Executing .Invert() .Subscribe(ShowPasswordButton.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.Done.Executing .Subscribe(ActivityIndicatorView.Rx().IsVisibleWithFade()) .DisposedBy(DisposeBag); ViewModel.Done.Executing.Select(loginButtonTitle) .Subscribe(LoginButton.Rx().AnimatedTitle()) .DisposedBy(DisposeBag); PasswordTextField.BecomeFirstResponder(); ShowPasswordButton.SetupShowPasswordButton(); //Color ViewModel.HasError .Select(loginButtonTintColor) .Subscribe(LoginButton.Rx().TintColor()) .DisposedBy(DisposeBag); ViewModel.NextIsEnabled .Select(loginButtonTitleColor) .Subscribe(LoginButton.Rx().TitleColor()) .DisposedBy(DisposeBag); UIColor loginButtonTintColor(bool hasError) => hasError ? UIColor.White : UIColor.Black; UIColor loginButtonTitleColor(bool enabled) => enabled ? Core.UI.Helper.Colors.Login.EnabledButtonColor.ToNativeColor() : Core.UI.Helper.Colors.Login.DisabledButtonColor.ToNativeColor(); }
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(); }
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); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. //Button.AccessibilityIdentifier = "myButton"; //Button.TouchUpInside += delegate { // var title = string.Format ("{0} clicks!", count++); // Button.SetTitle (title, UIControlState.Normal); //}; #region Include Return Button in Keyboard this.UsernameTextField.ShouldReturn += (textField) => { UsernameTextField.ResignFirstResponder(); return(true); }; this.PasswordTextField.ShouldReturn += (textField) => { PasswordTextField.ResignFirstResponder(); return(true); }; #endregion #region When Clicked out side keyboard, Close the Keyboard UITapGestureRecognizer g_recognizer = new UITapGestureRecognizer(() => { UsernameTextField.ResignFirstResponder(); PasswordTextField.ResignFirstResponder(); }); this.View.AddGestureRecognizer(g_recognizer); #endregion #region Add Next Previous Buttons to Toolbar UsernameTextField.InputAccessoryView = new NextPreviousToolBar(UsernameTextField, null, PasswordTextField); PasswordTextField.InputAccessoryView = new NextPreviousToolBar(PasswordTextField, UsernameTextField, null); #endregion #region Move UI View Up Handling // Keyboard popup _didShowNotificationObserver = NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.DidShowNotification, KeyBoardDidShow, this); // Keyboard Down _willHideNotificationObserver = NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.WillHideNotification, KeyBoardWillHide, this); #endregion LoginButton.TouchUpInside += delegate { try { Core.Connect(UsernameTextField.Text, PasswordTextField.Text); authenticator.CreateAccount(UsernameTextField.Text, PasswordTextField.Text); //account = new Account(UsernameTextField.Text, Core.PopulateCredentials(UsernameTextField.Text, PasswordTextField.Text)); //AccountStore.Create().Save(account, CREDENTIALS_NAME); this.NavigationController.PushViewController(mainView, true); UsernameTextField.Text = ""; PasswordTextField.Text = ""; View.EndEditing(true); //Core.Login(); } catch (Exception ex) { //TODO JR: add error handling dialog } }; }