public static NumberKeyListener Create(InputTypes inputTypes)
        {
            if ((inputTypes & InputTypes.NumberFlagDecimal) == 0)
            {
                // If decimal isn't allowed, we can just use the Android version
#pragma warning disable 0618
                return(DigitsKeyListener.GetInstance(inputTypes.HasFlag(InputTypes.NumberFlagSigned), false));

#pragma warning restore 0618
            }

            // Figure out what the decimal separator is for the current locale
            char decimalSeparator = GetDecimalSeparator();

            if (decimalSeparator == '.')
            {
                // If it's '.', then we can just use the default Android version
#pragma warning disable 0618
                return(DigitsKeyListener.GetInstance(inputTypes.HasFlag(InputTypes.NumberFlagSigned), true));

#pragma warning restore 0618
            }

            // If decimals are enabled and the locale's decimal separator is not '.'
            // (which is hard-coded in the Android DigitKeyListener), then use
            // our custom one with a configurable decimal separator
            return(GetInstance(inputTypes, decimalSeparator));
        }
Example #2
0
        public static bool HasPasswordFlag(this InputTypes inputTypes)
        {
            if (inputTypes.HasFlag(InputTypes.NumberVariationPassword) ||
                inputTypes.HasFlag(InputTypes.TextVariationPassword) ||
                inputTypes.HasFlag(InputTypes.TextVariationVisiblePassword) ||
                inputTypes.HasFlag(InputTypes.TextVariationWebPassword))
            {
                return(true);
            }

            return(false);
        }