From a929db99399437aa8fbb81c426ddcb4e641c8aaf Mon Sep 17 00:00:00 2001 From: Philipp Crocoll Date: Tue, 2 Jan 2018 14:59:19 +0100 Subject: [PATCH] fix save popup in QuickUnlock --- .../Resources/layout/QuickUnlock.xml | 2 + .../services/AutofillBase/AutofillHelper.cs | 46 ------------------- .../AutofillBase/AutofillServiceBase.cs | 8 ++-- 3 files changed, 5 insertions(+), 51 deletions(-) diff --git a/src/keepass2android/Resources/layout/QuickUnlock.xml b/src/keepass2android/Resources/layout/QuickUnlock.xml index 5e38b63f..1bcb13a2 100644 --- a/src/keepass2android/Resources/layout/QuickUnlock.xml +++ b/src/keepass2android/Resources/layout/QuickUnlock.xml @@ -135,6 +135,8 @@ android:paddingRight="16dp" android:ems="4" android:layout_below="@id/QuickUnlock_label" android:id="@+id/QuickUnlock_password" + android:singleLine="true" + android:fontFamily="sans-serif" android:textSize="20sp" android:focusable="true" android:focusableInTouchMode="true" /> diff --git a/src/keepass2android/services/AutofillBase/AutofillHelper.cs b/src/keepass2android/services/AutofillBase/AutofillHelper.cs index 1684e4e4..003677ff 100644 --- a/src/keepass2android/services/AutofillBase/AutofillHelper.cs +++ b/src/keepass2android/services/AutofillBase/AutofillHelper.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using Android.Content; using Android.Service.Autofill; using Android.Util; @@ -46,50 +45,5 @@ namespace keepass2android.services.AutofillBase presentation.SetImageViewResource(Resource.Id.icon, drawableId); return presentation; } - - /// - /// Wraps autofill data in a Response object (essentially a series of Datasets) which can then - /// be sent back to the client View. - /// - /// The response. - /// Context. - /// If set to true dataset auth. - /// Autofill fields. - /// Client form data map. - /// - public static FillResponse NewResponse(Context context, bool datasetAuth, AutofillFieldMetadataCollection autofillFields, Dictionary clientFormDataMap, IAutofillIntentBuilder intentBuilder) - { - var responseBuilder = new FillResponse.Builder(); - if (clientFormDataMap != null) - { - var datasetNames = clientFormDataMap.Keys; - foreach (var datasetName in datasetNames) - { - var filledAutofillFieldCollection = clientFormDataMap[datasetName]; - if (filledAutofillFieldCollection != null) - { - var dataset = NewDataset(context, autofillFields, filledAutofillFieldCollection, intentBuilder); - if (dataset != null) - { - responseBuilder.AddDataset(dataset); - } - } - } - } - if (autofillFields.SaveType != 0) - { - //TODO implement save - var autofillIds = autofillFields.GetAutofillIds(); - responseBuilder.SetSaveInfo - (new SaveInfo.Builder(autofillFields.SaveType, autofillIds).Build()); - return responseBuilder.Build(); - } - else - { - CommonUtil.logd("These fields are not meant to be saved by autofill."); - return null; - } - } - } } diff --git a/src/keepass2android/services/AutofillBase/AutofillServiceBase.cs b/src/keepass2android/services/AutofillBase/AutofillServiceBase.cs index 94cf6b1b..9b4f2749 100644 --- a/src/keepass2android/services/AutofillBase/AutofillServiceBase.cs +++ b/src/keepass2android/services/AutofillBase/AutofillServiceBase.cs @@ -64,9 +64,9 @@ namespace keepass2android.services.AutofillBase AutofillFieldMetadataCollection autofillFields = parser.AutofillFields; - bool responseAuth = true; + var autofillIds = autofillFields.GetAutofillIds(); - if (responseAuth && autofillIds.Length != 0 && CanAutofill(query)) + if (autofillIds.Length != 0 && CanAutofill(query)) { var responseBuilder = new FillResponse.Builder(); @@ -81,9 +81,7 @@ namespace keepass2android.services.AutofillBase } else { - var datasetAuth = true; - var response = AutofillHelper.NewResponse(this, datasetAuth, autofillFields, null, IntentBuilder); - callback.OnSuccess(response); + callback.OnSuccess(null); } }