public FilledAutofillField Generate(int seed)
            {
                var filledAutofillField = new FilledAutofillField(Type);
                var calendar            = Instance;

                calendar.Set(Year, calendar.Get(Year) + seed);
                filledAutofillField.SetDateValue(calendar.TimeInMillis);
                return(filledAutofillField);
            }
            public FilledAutofillField Generate(int seed)
            {
                FilledAutofillField filledAutofillField = new FilledAutofillField(Type);
                var calendar = Instance;
                int expYear  = calendar.Get(Year) + seed;

                calendar.Set(Year, expYear);
                filledAutofillField.SetDateValue(calendar.TimeInMillis);
                filledAutofillField.SetTextValue(expYear.ToString());
                return(filledAutofillField);
            }
Ejemplo n.º 3
0
            public FilledAutofillField Generate(int seed)
            {
                var filledAutofillField = new FilledAutofillField(Type);
                var calendar            = Android.Icu.Util.Calendar.Instance;

                calendar.Set(Year, calendar.Get(Year) - seed * 10);
                calendar.Set(Month, seed % 12);
                calendar.Set(Date, seed % 27);
                filledAutofillField.SetDateValue(calendar.TimeInMillis);
                return(filledAutofillField);
            }
            public FilledAutofillField Generate(int seed)
            {
                var days = DayRange();
                int day  = seed % days.Length;
                var filledAutofillField = new FilledAutofillField(Type);
                var calendar            = Instance;

                calendar.Set(Date, day);
                filledAutofillField.SetListValue(days, day);
                filledAutofillField.SetTextValue(day.ToString());
                filledAutofillField.SetDateValue(calendar.TimeInMillis);
                return(filledAutofillField);
            }
            public FilledAutofillField Generate(int seed)
            {
                var months   = MonthRange();
                int month    = seed % months.Length;
                var calendar = Instance;

                calendar.Set(Month, month);
                var filledAutofillField = new FilledAutofillField(Type);

                filledAutofillField.SetListValue(months, month);
                filledAutofillField.SetTextValue(month.ToString());
                filledAutofillField.SetDateValue(calendar.TimeInMillis);
                return(filledAutofillField);
            }
        private void ParseLocked(bool forFill, AssistStructure.ViewNode viewNode, StringBuilder validWebDomain)
        {
            var webDomain = viewNode.WebDomain;

            if (webDomain != null)
            {
                if (CommonUtil.DEBUG)
                {
                    Log.Debug(CommonUtil.TAG, "child web domain: " + webDomain);
                }
                if (validWebDomain.Length() > 0)
                {
                    if (webDomain != validWebDomain.ToString())
                    {
                        throw new SecurityException("Found multiple web domains: valid= "
                                                    + validWebDomain + ", child=" + webDomain);
                    }
                }
                else
                {
                    validWebDomain.Append(webDomain);
                }
            }

            if (viewNode.GetAutofillHints() != null)
            {
                var filteredHints = AutofillHints.FilterForSupportedHints(
                    viewNode.GetAutofillHints());
                if (filteredHints != null && filteredHints.Length > 0)
                {
                    if (forFill)
                    {
                        mAutofillFields.Add(new AutofillFieldMetadata(viewNode));
                    }
                    else
                    {
                        var           filledAutofillField = new FilledAutofillField(viewNode.GetAutofillHints());
                        AutofillValue autofillValue       = viewNode.AutofillValue;
                        if (autofillValue.IsText)
                        {
                            // Using toString of AutofillValue.getTextValue in order to save it to
                            // SharedPreferences.
                            filledAutofillField.SetTextValue(autofillValue.TextValue);
                        }
                        else if (autofillValue.IsDate)
                        {
                            filledAutofillField.SetDateValue(autofillValue.DateValue);
                        }
                        else if (autofillValue.IsList)
                        {
                            filledAutofillField.SetListValue(viewNode.GetAutofillOptions(),
                                                             autofillValue.ListValue);
                        }

                        mFilledAutofillFieldCollection.Add(filledAutofillField);
                    }
                }
            }

            int childrenSize = viewNode.ChildCount;

            if (childrenSize > 0)
            {
                for (int i = 0; i < childrenSize; i++)
                {
                    ParseLocked(forFill, viewNode.GetChildAt(i), validWebDomain);
                }
            }
        }