set "no personalized learning" flag for IMEs when entering data to the database, closing #718

This commit is contained in:
Philipp Crocoll
2020-01-06 11:57:07 +01:00
parent 0400ab3c53
commit 8f1251e59b
6 changed files with 48 additions and 10 deletions

View File

@@ -141,8 +141,9 @@ namespace keepass2android
Android.Graphics.Color color = new Android.Graphics.Color (224, 224, 224);
btnTogglePassword.SetColorFilter (color, mMode);
Util.SetNoPersonalizedLearning(FindViewById(Resource.Id.root));
}
}
readonly PasswordFont _passwordFont = new PasswordFont();

View File

@@ -111,6 +111,8 @@ namespace keepass2android
SetContentView(Resource.Layout.entry_edit);
_closeForReload = false;
Util.SetNoPersonalizedLearning(FindViewById(Resource.Id.entry_scroll));
// Likely the app has been killed exit the activity
if (!App.Kp2a.DatabaseIsUnlocked)
{
@@ -292,7 +294,9 @@ namespace keepass2android
};
}
}
protected override void OnStart()
{
@@ -1101,7 +1105,8 @@ namespace keepass2android
View ees = (View) sender.Parent;
dlgView.FindViewById<TextView>(Resource.Id.title).Text = ees.FindViewById<TextView>(Resource.Id.extrakey).Text;
dlgView.FindViewById<EditText>(Resource.Id.value).Text = ees.FindViewById<EditText>(Resource.Id.value).Text;
dlgView.FindViewById<CheckBox>(Resource.Id.protection).Checked = ees.FindViewById<CheckBox>(Resource.Id.protection).Checked;
Util.SetNoPersonalizedLearning(dlgView);
dlgView.FindViewById<CheckBox>(Resource.Id.protection).Checked = ees.FindViewById<CheckBox>(Resource.Id.protection).Checked;
var titleView = ((AutoCompleteTextView)dlgView.FindViewById(Resource.Id.title));
titleView.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, Android.Resource.Id.Text1, AdditionalKeys);

View File

@@ -784,9 +784,10 @@ namespace keepass2android
LaunchNextActivity();
}
}
Util.SetNoPersonalizedLearning(FindViewById<EditText>(Resource.Id.password_edit));
}
private void InitializeToolbarCollapsing()
private void InitializeToolbarCollapsing()
{
var rootview = FindViewById<MeasuringRelativeLayout>(Resource.Id.relative_layout);
rootview.ViewTreeObserver.GlobalLayout += (sender, args2) =>

View File

@@ -145,9 +145,11 @@ namespace keepass2android
filter.AddAction(Intents.DatabaseLocked);
RegisterReceiver(_intentReceiver, filter);
Util.SetNoPersonalizedLearning(FindViewById<EditText>(Resource.Id.QuickUnlock_password));
}
}
protected override void OnStart()
{

View File

@@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/root"
android:layout_margin="12dip">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"

View File

@@ -34,6 +34,8 @@ using Android.Graphics;
using Android.Graphics.Drawables;
using Android.Hardware.Display;
using Android.Util;
using Android.Views.InputMethods;
using AndroidX.Core.View.InputMethod;
using KeePassLib.Serialization;
using Uri = Android.Net.Uri;
@@ -634,6 +636,32 @@ namespace keepass2android
}
return hasUnsecureDisplay;
}
}
public static void SetNoPersonalizedLearning(EditText editText)
{
if (editText == null)
return;
if ((int) Build.VERSION.SdkInt >= 26)
editText.ImeOptions = (ImeAction)EditorInfoCompat.ImeFlagNoPersonalizedLearning;
;
}
public static void SetNoPersonalizedLearning(View view)
{
if (view is ViewGroup vg)
{
for (int i=0;i<vg.ChildCount;i++)
{
SetNoPersonalizedLearning(vg.GetChildAt(i));
}
}
if (view is EditText editText)
{
SetNoPersonalizedLearning(editText);
}
}
}
}