minor refactoring and code formatting

This commit is contained in:
Philipp Crocoll
2017-12-28 21:53:03 +01:00
parent 4c0cfb77fb
commit 0697f4a964
3 changed files with 7 additions and 17 deletions

View File

@@ -65,17 +65,13 @@ namespace keepass2android.services.AutofillBase
if (responseAuth && autofillIds.Length != 0)
{
var responseBuilder = new FillResponse.Builder();
// If the entire Autofill Response is authenticated, AuthActivity is used
// to generate Response.
var sender = IntentBuilder.GetAuthIntentSenderForResponse(this, query);
RemoteViews presentation = keepass2android.services.AutofillBase.AutofillHelper
.NewRemoteViews(PackageName, GetString(Resource.String.autofill_sign_in_prompt),
Resource.Drawable.ic_launcher);
RemoteViews presentation = AutofillHelper.NewRemoteViews(PackageName, GetString(Resource.String.autofill_sign_in_prompt),Resource.Drawable.ic_launcher);
var datasetBuilder = new Dataset.Builder(presentation);
datasetBuilder
.SetAuthentication(sender);
datasetBuilder.SetAuthentication(sender);
//need to add placeholders so we can directly fill after ChooseActivity
foreach (var autofillId in autofillIds)
{
datasetBuilder.SetValue(autofillId, AutofillValue.ForText("PLACEHOLDER"));

View File

@@ -48,11 +48,6 @@ namespace keepass2android.services.AutofillBase
StartActivityForResult(i, RequestCodeQuery);
}
protected override void OnStart()
{
base.OnStart();
}
protected abstract Intent GetQueryIntent(string requestedUrl);
protected void RestartApp()

View File

@@ -139,8 +139,7 @@ namespace keepass2android.services.AutofillBase.model
/// <returns><c>true</c>, if to fields was applyed, <c>false</c> otherwise.</returns>
/// <param name="autofillFieldMetadataCollection">Autofill field metadata collection.</param>
/// <param name="datasetBuilder">Dataset builder.</param>
public bool ApplyToFields(AutofillFieldMetadataCollection autofillFieldMetadataCollection,
Dataset.Builder datasetBuilder)
public bool ApplyToFields(AutofillFieldMetadataCollection autofillFieldMetadataCollection, Dataset.Builder datasetBuilder)
{
bool setValueAtLeastOnce = false;
List<string> allHints = autofillFieldMetadataCollection.AllAutofillHints;
@@ -152,14 +151,14 @@ namespace keepass2android.services.AutofillBase.model
{
continue;
}
for (int autofillFieldIndex = 0; autofillFieldIndex < fillableAutofillFields.Count; autofillFieldIndex++)
foreach (AutofillFieldMetadata autofillFieldMetadata in fillableAutofillFields)
{
FilledAutofillField filledAutofillField;
if (!HintMap.TryGetValue(hint, out filledAutofillField) || (filledAutofillField == null))
{
continue;
}
AutofillFieldMetadata autofillFieldMetadata = fillableAutofillFields[autofillFieldIndex];
var autofillId = autofillFieldMetadata.AutofillId;
var autofillType = autofillFieldMetadata.AutofillType;
switch (autofillType)