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,6 +141,7 @@ namespace keepass2android
Android.Graphics.Color color = new Android.Graphics.Color (224, 224, 224);
btnTogglePassword.SetColorFilter (color, mMode);
Util.SetNoPersonalizedLearning(FindViewById(Resource.Id.root));
}

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,6 +294,8 @@ namespace keepass2android
};
}
protected override void OnStart()
@@ -1101,6 +1105,7 @@ 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;
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));

View File

@@ -784,6 +784,7 @@ namespace keepass2android
LaunchNextActivity();
}
Util.SetNoPersonalizedLearning(FindViewById<EditText>(Resource.Id.password_edit));
}
private void InitializeToolbarCollapsing()

View File

@@ -145,6 +145,8 @@ namespace keepass2android
filter.AddAction(Intents.DatabaseLocked);
RegisterReceiver(_intentReceiver, filter);
Util.SetNoPersonalizedLearning(FindViewById<EditText>(Resource.Id.QuickUnlock_password));
}

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);
}
}
}
}