/// <summary> /// Wraps autofill data in a LoginCredential Dataset object which can then be sent back to the /// client View. /// </summary> /// <returns>The dataset.</returns> /// <param name="context">Context.</param> /// <param name="autofillFields">Autofill fields.</param> /// <param name="filledAutofillFieldCollection">Filled autofill field collection.</param> public static Dataset NewDataset(Context context, AutofillFieldMetadataCollection autofillFields, FilledAutofillFieldCollection filledAutofillFieldCollection, IAutofillIntentBuilder intentBuilder, Android.Widget.Inline.InlinePresentationSpec inlinePresentationSpec) { var datasetName = filledAutofillFieldCollection.DatasetName ?? "[noname]"; var datasetBuilder = new Dataset.Builder(NewRemoteViews(context.PackageName, datasetName, intentBuilder.AppIconResource)); datasetBuilder.SetId(datasetName); var setValueAtLeastOnce = filledAutofillFieldCollection.ApplyToFields(autofillFields, datasetBuilder); AddInlinePresentation(context, inlinePresentationSpec, datasetName, datasetBuilder, intentBuilder.AppIconResource); if (setValueAtLeastOnce) { return(datasetBuilder.Build()); } else { Kp2aLog.Log("Failed to set at least one value. #fields=" + autofillFields.GetAutofillIds().Length + " " + autofillFields.FocusedAutofillCanonicalHints); } return(null); }
/// <summary> /// Wraps autofill data in a LoginCredential Dataset object which can then be sent back to the /// client View. /// </summary> /// <returns>The dataset.</returns> /// <param name="context">Context.</param> /// <param name="autofillFields">Autofill fields.</param> /// <param name="filledAutofillFieldCollection">Filled autofill field collection.</param> public static Dataset NewDataset(Context context, AutofillFieldMetadataCollection autofillFields, FilledAutofillFieldCollection filledAutofillFieldCollection, IAutofillIntentBuilder intentBuilder) { var datasetName = filledAutofillFieldCollection.DatasetName; if (datasetName != null) { var datasetBuilder = new Dataset.Builder(NewRemoteViews(context.PackageName, datasetName, intentBuilder.AppIconResource)); datasetBuilder.SetId(datasetName); var setValueAtLeastOnce = filledAutofillFieldCollection.ApplyToFields(autofillFields, datasetBuilder); if (setValueAtLeastOnce) { return(datasetBuilder.Build()); } } return(null); }