private void AndroidEditTextOnAfterTextChanged(object sender, AfterTextChangedEventArgs afterTextChangedEventArgs)
        {
            if(editText == null)
                return;

            var newText = editText.Text;
            var oldStart = selectionStart;
            var newStart = SelectionStart;

            if (newStart <= oldStart) // we erased characters
            {
                SetTextInternal(newText, false);
            }
            else // we add or replaced characters
            {
                // check that new characters are correct.
                builder.Clear();
                var predicate = CharacterFilterPredicate;
                for (int i = oldStart; i < newStart; i++)
                {
                    var character = newText[i];
                    if (predicate == null || predicate(character))
                        builder.Append(character);
                }

                SetTextInternal(newText.Substring(0, oldStart) + builder + newText.Substring(newStart), false);
                newStart = Math.Min(oldStart + builder.Length, text.Length);
            }

            UpdateTextToEditImpl();
            Select(newStart, 0);
        }
        /// <summary>
        /// Since they are several over write of the Test property during layout we have to set this field as long as it is not definitly set
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void nativeBtn_AfterTextChanged(object sender, AfterTextChangedEventArgs e)
        {

            ISpannable spannable = e.Editable;
            var indice = spannable.ToString().IndexOf(iconButton.Icon);
            var spans = spannable.GetSpans(indice, indice + iconButton.Icon.Length, Java.Lang.Class.FromType(typeof(TypefaceSpan))).ToList();
            if (spans.Count == 0)
                nativeBtn.SetText(iconSpan, TextView.BufferType.Spannable);

        }
 private void EditTextOnAfterTextChanged(object sender, AfterTextChangedEventArgs afterTextChangedEventArgs)
 {
     FireValueChanged(TextView.TextFormatted);
 }
Beispiel #4
0
 public void AfterTextChanged(IEditable editable)
 {
     var args = new AfterTextChangedEventArgs(editable);
     AfterTextChangedAction.Invoke(editable, args);
 }
		private void OnNotesTextChanged(object sender, AfterTextChangedEventArgs e)
		{
			CurrentData.Notes = _notesText.Text;
		}
		private void OnTagsTextChanged(object sender, AfterTextChangedEventArgs e)
		{
			CurrentData.Tags = _tagsText.Text;
		}
		private void OnClassTextChanged(object sender, AfterTextChangedEventArgs e)
		{
			CurrentData.Class = _classText.Text;
			TryEnableSendButton();
		}
Beispiel #8
0
 private void TxtShewatchiTarikh_AfterTextChanged(object sender, Android.Text.AfterTextChangedEventArgs e)
 {
     DatewiseLoadDate();
 }
        private void TextChangedHandler(object sender, AfterTextChangedEventArgs e)
        {
            string newText = e.Editable.ToString();

            int decimalPointPosition = e.Editable.ToString().IndexOf(decimalSeparator);
            if (decimalPointPosition > 0)
            {
                if (newText.Substring(decimalPointPosition).IndexOf(groupingSeparator) > 0)
                {
                    DiscardInput(previousText);
                    return;
                }
            }

            if (newText.Length == 1 && newText == decimalSeparator)
            {
                DiscardInput(previousText);
                return;
            }

            string[] splitText = newText.Split(decimalSeparator.ToCharArray());
            string leftPart = splitText[0];
            string rightPart = null;
            if (splitText.Length > 1)
            {
                rightPart = splitText[1];
            }

            if (MaxDigitsBeforeDecimal > 0 && leftPart != null && leftPart.Replace(groupingSeparator, "").Length > MaxDigitsBeforeDecimal)
            {
                DiscardInput(previousText);
                return;
            }

            if (rightPart != null && rightPart.Length > MaxDigitsAfterDecimal)
            {
                DiscardInput(previousText);
                return;
            }

            if (newText.Length > 2)
            {
                string lastChar = newText[newText.Length - 1].ToString();
                string secToLastChar = newText[newText.Length - 2].ToString();
                if (lastChar == decimalSeparator || lastChar == groupingSeparator)
                {
                    if (lastChar == secToLastChar)
                    {
                        DiscardInput(previousText);
                        return;
                    }
                }
            }

            if (CountMatches(e.Editable.ToString(), decimalSeparator.ToString()) > 1)
            {
                DiscardInput(previousText);
                return;
            }

            if (e.Editable.Length() == 0)
            {
                HandleNumericValueCleared();
                return;
            }

            SetTextInternal(Format(e.Editable.ToString()));
            SetSelection(Text.Length);
            HandleNumericValueChanged();
        }
 private void EditTextOnAfterTextChanged(object sender, AfterTextChangedEventArgs e)
 {
     FireValueChanged(TextView.Text);
 }
Beispiel #11
0
 private void OnViewChange(object sender, AfterTextChangedEventArgs e)
 {
     string newValue = e.Editable.ToString();
     _observable.StringValue = newValue;
 }
	    private void InputTextChanged(object sender, AfterTextChangedEventArgs e)
	    {
            viewModel.HandleTyping(inputText.Text);
	    }
 private void OnAfterTextChanged(object sender, AfterTextChangedEventArgs afterTextChangedEventArgs)
 {
     var handler = UnusualNameChanged;
     if (handler != null)
         handler(this, EventArgs.Empty);
 }
Beispiel #14
0
 private void EnhancedEntryRenderer_AfterTextChanged(object sender, Android.Text.AfterTextChangedEventArgs e)
 {
     ((global::Android.Widget.EditText)sender).SetSelection(((global::Android.Widget.EditText)sender).Text.Length);
 }