/// <summary>
 /// Stop the timer and hide the SetError overlay
 /// </summary>
 private void NewPasswordTextView_FocusChange(object sender, Android.Views.View.FocusChangeEventArgs e)
 {
     if (!e.HasFocus && _timer != null)
     {
         _timer.Cancel();
     }
 }
Example #2
0
        /// <summary>
        /// Evenement lorsque l'Edit Text du password de la page CreateAccount change
        /// </summary>
        private void OnPasswordTextChanged(object sender, EventArgs e)
        {
            App.Locator.Login.UserPassword = PasswordEditText.Text;
            if (PasswordEditText.Text.Length < 8)
            {
                PasswordEditText.SetError(Resources.GetString(Resource.String.login_password_error), null);
                if (timer != null)
                {
                    timer.Cancel();
                }
            }
            else
            {
                PasswordEditText.SetError(string.Empty, null);
                switch ((int)PasswordComplexityHelper.CheckStrength(PasswordEditText.Text))
                {
                case (int)PasswordComplexityHelper.PasswordScore.Weak:
                    var spanString0 = Resources.GetString(Resource.String.login_password_weak);
                    var spanText0   = string.Format(spanString0, Resources.GetString(Resource.String.login_weak));

                    var resultTuple0       = SeekiosApp.Helper.StringHelper.GetStartAndEndIndexOfStringInString(spanString0, Resources.GetString(Resource.String.login_weak));
                    var formattedinfoText0 = new SpannableString(spanText0);
                    formattedinfoText0.SetSpan(new ForegroundColorSpan(Color.ParseColor(App.Red)), resultTuple0.Item1, resultTuple0.Item2, 0);

                    PasswordEditText.SetError(formattedinfoText0, null);
                    break;

                case (int)PasswordComplexityHelper.PasswordScore.Medium:

                    var spanString = Resources.GetString(Resource.String.login_password_medium);
                    var spanText   = string.Format(spanString, Resources.GetString(Resource.String.login_medium));

                    var resultTuple       = SeekiosApp.Helper.StringHelper.GetStartAndEndIndexOfStringInString(spanString, Resources.GetString(Resource.String.login_medium));
                    var formattedinfoText = new SpannableString(spanText);
                    formattedinfoText.SetSpan(new ForegroundColorSpan(Color.ParseColor(App.Orange)), resultTuple.Item1, resultTuple.Item2, 0);

                    PasswordEditText.SetError(formattedinfoText, null);
                    break;

                case (int)PasswordComplexityHelper.PasswordScore.Strong:
                case (int)PasswordComplexityHelper.PasswordScore.VeryStrong:

                    var spanString1 = Resources.GetString(Resource.String.login_password_strong);
                    var spanText1   = string.Format(spanString1, Resources.GetString(Resource.String.login_strong));

                    var resultTuple1       = SeekiosApp.Helper.StringHelper.GetStartAndEndIndexOfStringInString(spanString1, Resources.GetString(Resource.String.login_strong));
                    var formattedinfoText1 = new SpannableString(spanText1);
                    formattedinfoText1.SetSpan(new ForegroundColorSpan(Color.ParseColor(App.MainColor)), resultTuple1.Item1, resultTuple1.Item2, 0);

                    PasswordEditText.SetError(formattedinfoText1, null);
                    break;
                }
                LaunchTimerToHideError();
            }
            if (string.IsNullOrEmpty(PasswordEditText.Text))
            {
                PasswordEditText.Error = null;
            }
        }
Example #3
0
 public override void OnDestroy()
 {
     spawnTimer.Cancel();
     base.OnDestroy();
 }
Example #4
0
 public override void OnDestroy()
 {
     waveStartTimerOverlay.Cancel();
     waveStartTimer.Cancel();
     base.OnDestroy();
 }