Ejemplo n.º 1
0
        void ITextWatcher.OnTextChanged(ICharSequence s, int start, int before, int count)
        {
            if (Mask != null)
            {
                if (!_editingOnChanged && _editingBefore)
                {
                    _editingOnChanged = true;
                    if (_ignore)
                    {
                        return;
                    }
                    if (count > 0)
                    {
                        var startingPosition = _maskToRaw[NextValidPosition(start)];
                        var addedString      = s.SubSequence(start, start + count).ToString();
                        count = _rawText.AddToString(Clear(addedString), startingPosition, _maxRawLength);
                        if (_initialized)
                        {
                            int currentPosition = startingPosition + count < _rawToMask.Length ?
                                                  _rawToMask[startingPosition + count] :
                                                  currentPosition = _lastValidMaskPosition + 1;

                            _selection = NextValidPosition(currentPosition);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void OnTextChanged(Java.Lang.ICharSequence s, int start, int before, int count)
        {
            if (string.IsNullOrEmpty(mask))
            {
                return;
            }
            if (!editingOnChanged && editingBefore)
            {
                editingOnChanged = true;
                if (ignore)
                {
                    return;
                }

                if (count > 0)
                {
                    int startingPosition = maskToRaw[nextValidPosition(start)];
                    var addedString      = s.SubSequence(start, start + count);
                    count = rawText.AddToString(clear(addedString), startingPosition, maxRawLength);
                    if (initialized)
                    {
                        int currentPosition = startingPosition + count < rawToMask.Length ? rawToMask[startingPosition + count] :
                                              lastValidMaskPosition + 1;

                        selection = nextValidPosition(currentPosition);
                    }
                }
            }
        }