From 131eb784077a435d877520f1949c131fd81dfbfb Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Tue, 5 Apr 2022 13:38:36 +0200 Subject: [PATCH] Setting to change the keyboard during a search #1254 --- CHANGELOG | 1 + .../java/com/kunzisoft/keepass/activities/GroupActivity.kt | 6 ++++++ .../java/com/kunzisoft/keepass/settings/PreferencesUtil.kt | 7 +++++++ app/src/main/res/values/donottranslate.xml | 2 ++ app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/preferences_keyboard.xml | 5 +++++ fastlane/metadata/android/en-US/changelogs/106.txt | 3 ++- fastlane/metadata/android/fr-FR/changelogs/106.txt | 3 ++- 8 files changed, 27 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index a8c677b7e..eca035600 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,7 @@ KeePassDX(3.4.0) * Passphrase implementation #218 * Fix small bugs #1282 * Better search implementation #175 #1254 + * Setting to change keyboard during a search #1243 KeePassDX(3.3.3) * Fix shared otpauth link if database not open #1274 diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt index 8042b0eb5..99f3f0fd4 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt @@ -79,6 +79,7 @@ import com.kunzisoft.keepass.settings.PreferencesUtil import com.kunzisoft.keepass.settings.SettingsActivity import com.kunzisoft.keepass.tasks.ActionRunnable import com.kunzisoft.keepass.timeout.TimeoutHelper +import com.kunzisoft.keepass.utils.BACK_PREVIOUS_KEYBOARD_ACTION import com.kunzisoft.keepass.utils.UriUtil import com.kunzisoft.keepass.view.* import com.kunzisoft.keepass.viewmodels.GroupEditViewModel @@ -182,6 +183,11 @@ class GroupActivity : DatabaseLockActivity(), addSearch() //loadGroup() + + // Back to previous keyboard + if (PreferencesUtil.isKeyboardPreviousSearchEnable(this@GroupActivity)) { + sendBroadcast(Intent(BACK_PREVIOUS_KEYBOARD_ACTION)) + } return true } diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt b/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt index 37688d30f..a0816ec7c 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt @@ -657,6 +657,12 @@ object PreferencesUtil { context.resources.getBoolean(R.bool.keyboard_previous_database_credentials_default)) } + fun isKeyboardPreviousSearchEnable(context: Context): Boolean { + val prefs = PreferenceManager.getDefaultSharedPreferences(context) + return prefs.getBoolean(context.getString(R.string.keyboard_previous_search_key), + context.resources.getBoolean(R.bool.keyboard_previous_search_default)) + } + fun isKeyboardPreviousFillInEnable(context: Context): Boolean { val prefs = PreferenceManager.getDefaultSharedPreferences(context) return prefs.getBoolean(context.getString(R.string.keyboard_previous_fill_in_key), @@ -822,6 +828,7 @@ object PreferencesUtil { context.getString(R.string.keyboard_key_vibrate_key) -> editor.putBoolean(name, value.toBoolean()) context.getString(R.string.keyboard_key_sound_key) -> editor.putBoolean(name, value.toBoolean()) context.getString(R.string.keyboard_previous_database_credentials_key) -> editor.putBoolean(name, value.toBoolean()) + context.getString(R.string.keyboard_previous_search_key) -> editor.putBoolean(name, value.toBoolean()) context.getString(R.string.keyboard_previous_fill_in_key) -> editor.putBoolean(name, value.toBoolean()) context.getString(R.string.keyboard_previous_lock_key) -> editor.putBoolean(name, value.toBoolean()) context.getString(R.string.autofill_close_database_key) -> editor.putBoolean(name, value.toBoolean()) diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index 9c3e28ec8..094a83604 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -146,6 +146,8 @@ false keyboard_previous_database_credentials_key false + keyboard_previous_search_key + true keyboard_previous_fill_in_key false keyboard_previous_lock_key diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index dc8c761d6..29e24d6e3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -504,6 +504,8 @@ Switch keyboard Database credentials screen Automatically switch back to the previous keyboard on the database credentials screen + Search screen + Automatically switch back to the previous keyboard on the search screen Auto key action Automatically switch back to the previous keyboard after executing \"Auto key action\" Lock database diff --git a/app/src/main/res/xml/preferences_keyboard.xml b/app/src/main/res/xml/preferences_keyboard.xml index 3399e2152..0c1300f2d 100644 --- a/app/src/main/res/xml/preferences_keyboard.xml +++ b/app/src/main/res/xml/preferences_keyboard.xml @@ -84,6 +84,11 @@ android:title="@string/keyboard_previous_database_credentials_title" android:summary="@string/keyboard_previous_database_credentials_summary" android:defaultValue="@bool/keyboard_previous_database_credentials_default"/> +