From 9fe1a904c8968881063fc29c984d20beb63fd1c5 Mon Sep 17 00:00:00 2001 From: Philipp Crocoll Date: Tue, 23 Jan 2018 19:11:01 +0100 Subject: [PATCH] allow to hide the length of the QuickUnlock code. Closes #52 --- src/keepass2android/QuickUnlock.cs | 11 ++++++++++- src/keepass2android/Resources/values/config.xml | 1 + src/keepass2android/Resources/values/strings.xml | 4 ++++ src/keepass2android/Resources/xml/preferences.xml | 8 ++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/keepass2android/QuickUnlock.cs b/src/keepass2android/QuickUnlock.cs index 6a49877d..a04543d6 100644 --- a/src/keepass2android/QuickUnlock.cs +++ b/src/keepass2android/QuickUnlock.cs @@ -107,7 +107,16 @@ namespace keepass2android _quickUnlockLength = App.Kp2a.QuickUnlockKeyLength; - txtLabel.Text = GetString(Resource.String.QuickUnlock_label, new Java.Lang.Object[] {_quickUnlockLength}); + if (PreferenceManager.GetDefaultSharedPreferences(this) + .GetBoolean(GetString(Resource.String.QuickUnlockHideLength_key), false)) + { + txtLabel.Text = GetString(Resource.String.QuickUnlock_label_secure); + } + else + { + txtLabel.Text = GetString(Resource.String.QuickUnlock_label, new Java.Lang.Object[] { _quickUnlockLength }); + } + EditText pwd = (EditText) FindViewById(Resource.Id.QuickUnlock_password); pwd.SetEms(_quickUnlockLength); diff --git a/src/keepass2android/Resources/values/config.xml b/src/keepass2android/Resources/values/config.xml index 86b60f8c..b3ba7a6f 100644 --- a/src/keepass2android/Resources/values/config.xml +++ b/src/keepass2android/Resources/values/config.xml @@ -97,6 +97,7 @@ FileHandling_prefs_key keyboardswitch_prefs_key AutoFill_prefs_key + QuickUnlockHideLength_key OfflineMode_key diff --git a/src/keepass2android/Resources/values/strings.xml b/src/keepass2android/Resources/values/strings.xml index 17d974b0..d585b0ec 100644 --- a/src/keepass2android/Resources/values/strings.xml +++ b/src/keepass2android/Resources/values/strings.xml @@ -290,6 +290,7 @@ File to import will be selected in the next step. Enable QuickUnlock Enter last %1$d characters of your password: + Enter QuickUnlock code: QuickUnlock! Close database Enable QuickUnlock by default @@ -302,6 +303,9 @@ QuickUnlock requires a notification to work properly. Select this option to display a notification without an icon. Length of QuickUnlock key Maximum number of characters used as QuickUnlock password. + Hide QuickUnlock length + If enabled, the length of the QuickUnlock code is not displayed on the QuickUnlock screen. + QuickUnlock failed: incorrect password! File attachments directory Directory where file attachments are saved to. diff --git a/src/keepass2android/Resources/xml/preferences.xml b/src/keepass2android/Resources/xml/preferences.xml index 5ab3772e..90a20932 100644 --- a/src/keepass2android/Resources/xml/preferences.xml +++ b/src/keepass2android/Resources/xml/preferences.xml @@ -423,6 +423,14 @@ android:defaultValue="true" android:title="@string/QuickUnlockIconHidden16_title" android:key="@string/QuickUnlockIconHidden16_key" /> + +