/**
         * Adds a {@code FilledAutofillField} to the collection, indexed by all of its hints.
         */
        public void Add([NonNull] FilledAutofillField filledAutofillField)
        {
            string[] autofillHints = filledAutofillField.GetAutofillHints();
            string   nextHint      = null;

            for (int i = 0; i < autofillHints.Length; i++)
            {
                string hint = autofillHints[i];
                if (i < autofillHints.Length - 1)
                {
                    nextHint = autofillHints[i + 1];
                }

                // First convert the compound W3C autofill hints
                if (IsW3CSectionPrefix(hint) && i < autofillHints.Length - 1)
                {
                    hint = autofillHints[++i];
                    if (CommonUtil.DEBUG)
                    {
                        Log.Debug(CommonUtil.TAG, "Hint is a W3C section prefix; using " + hint + " instead");
                    }
                    if (i < autofillHints.Length - 1)
                    {
                        nextHint = autofillHints[i + 1];
                    }
                }

                if (IsW3CTypePrefix(hint) && nextHint != null && IsW3CTypeHint(nextHint))
                {
                    hint = nextHint;
                    i++;
                    if (CommonUtil.DEBUG)
                    {
                        Log.Debug(CommonUtil.TAG, "Hint is a W3C type prefix; using " + hint + " instead");
                    }
                }

                if (IsW3CAddressType(hint) && nextHint != null)
                {
                    hint = nextHint;
                    i++;
                    if (CommonUtil.DEBUG)
                    {
                        Log.Debug(CommonUtil.TAG, "Hint is a W3C address prefix; using " + hint + " instead");
                    }
                }

                // Then check if the "actual" hint is supported.


                if (AutofillHints.IsValidHint(hint))
                {
                    mHintMap[hint] = filledAutofillField;
                }
                else
                {
                    Log.Error(CommonUtil.TAG, "Invalid hint: " + autofillHints[i]);
                }
            }
        }
Beispiel #2
0
 public void Add(FilledAutofillField filledAutofillField)
 {
     if (filledAutofillFields == null)
     {
         filledAutofillFields = ImmutableList.Create <FilledAutofillField>();
     }
     filledAutofillFields.Add(filledAutofillField);
 }
Beispiel #3
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || GetType() != o.GetType())
            {
                return(false);
            }

            FilledAutofillField that = (FilledAutofillField)o;

            if (mTextValue != null ? !mTextValue.Equals(that.mTextValue) : that.mTextValue != null)
            {
                return(false);
            }
            if (mDateValue != null ? !mDateValue.Equals(that.mDateValue) : that.mDateValue != null)
            {
                return(false);
            }
            return(mToggleValue != null?mToggleValue.Equals(that.mToggleValue) : that.mToggleValue == null);
        }