Fix keyboard search and selection

This commit is contained in:
J-Jamet
2022-04-07 14:28:45 +02:00
parent 94c02b7288
commit 15b9f1616f
7 changed files with 21 additions and 11 deletions

View File

@@ -1132,6 +1132,7 @@ class GroupActivity : DatabaseLockActivity(),
finishNodeAction()
searchView?.setOnQueryTextListener(null)
searchFiltersView?.saveSearchParameters()
}
private fun addSearchQueryInSearchView(searchQuery: String) {

View File

@@ -32,6 +32,7 @@ import android.view.inputmethod.InputMethodManager
import android.widget.FrameLayout
import android.widget.PopupWindow
import android.widget.TextView
import androidx.core.content.ContextCompat
import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.activities.EntrySelectionLauncherActivity
import com.kunzisoft.keepass.adapters.FieldsAdapter
@@ -241,9 +242,6 @@ class MagikeyboardService : InputMethodService(), KeyboardView.OnKeyboardActionL
?.showInputMethodPicker()
}
KEY_ENTRY -> {
actionKeyEntry()
}
KEY_ENTRY_ALT -> {
var searchInfo: SearchInfo? = null
if (mFormPackageName != null) {
searchInfo = SearchInfo().apply {
@@ -252,6 +250,9 @@ class MagikeyboardService : InputMethodService(), KeyboardView.OnKeyboardActionL
}
actionKeyEntry(searchInfo)
}
KEY_ENTRY_ALT -> {
actionKeyEntry()
}
KEY_LOCK -> {
removeEntryInfo()
sendBroadcast(Intent(LOCK_ACTION))
@@ -409,5 +410,13 @@ class MagikeyboardService : InputMethodService(), KeyboardView.OnKeyboardActionL
// Launch notification if allowed
KeyboardEntryNotificationService.launchNotificationIfAllowed(context, entry, toast)
}
fun activatedInSettings(context: Context): Boolean {
return ContextCompat.getSystemService(context, InputMethodManager::class.java)
?.enabledInputMethodList
?.any {
it.packageName == context.packageName
} ?: false
}
}
}

View File

@@ -23,7 +23,6 @@ import android.os.Bundle
import androidx.fragment.app.DialogFragment
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import com.kunzisoft.keepass.R
import com.kunzisoft.keepass.settings.preferencedialogfragment.DurationDialogFragmentCompat

View File

@@ -33,6 +33,7 @@ import com.kunzisoft.keepass.biometric.AdvancedUnlockManager
import com.kunzisoft.keepass.database.element.SortNodeEnum
import com.kunzisoft.keepass.database.search.SearchParameters
import com.kunzisoft.keepass.education.Education
import com.kunzisoft.keepass.magikeyboard.MagikeyboardService
import com.kunzisoft.keepass.password.PassphraseGenerator
import com.kunzisoft.keepass.timeout.TimeoutHelper
import com.kunzisoft.keepass.utils.UriUtil
@@ -623,6 +624,7 @@ object PreferencesUtil {
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
return prefs.getBoolean(context.getString(R.string.keyboard_search_share_key),
context.resources.getBoolean(R.bool.keyboard_search_share_default))
&& MagikeyboardService.activatedInSettings(context)
}
fun isKeyboardSaveSearchInfoEnable(context: Context): Boolean {

View File

@@ -254,8 +254,7 @@ class SearchFiltersView @JvmOverloads constructor(context: Context,
}
}
override fun onDetachedFromWindow() {
fun saveSearchParameters() {
PreferencesUtil.setDefaultSearchParameters(context, searchParameters)
super.onDetachedFromWindow()
}
}

View File

@@ -135,9 +135,9 @@
<string name="keyboard_selection_entry_key" translatable="false">keyboard_selection_entry_key</string>
<bool name="keyboard_selection_entry_default" translatable="false">false</bool>
<string name="keyboard_search_share_key" translatable="false">keyboard_search_share_key</string>
<bool name="keyboard_search_share_default" translatable="false">false</bool>
<bool name="keyboard_search_share_default" translatable="false">true</bool>
<string name="keyboard_save_search_info_key" translatable="false">keyboard_save_search_info_key</string>
<bool name="keyboard_save_search_info_default" translatable="false">true</bool>
<bool name="keyboard_save_search_info_default" translatable="false">false</bool>
<string name="keyboard_auto_go_action_key" translatable="false">keyboard_auto_go_action_key</string>
<bool name="keyboard_auto_go_action_default" translatable="false">true</bool>
<string name="keyboard_key_vibrate_key" translatable="false">keyboard_key_vibrate_key</string>

View File

@@ -483,10 +483,10 @@
<string name="keyboard_selection_entry_summary">When viewing an entry in KeePassDX, populate Magikeyboard with that entry</string>
<string name="keyboard_notification_entry_title">Notification info</string>
<string name="keyboard_notification_entry_summary">Show a notification when an entry is available</string>
<string name="keyboard_search_share_title">Search shared info</string>
<string name="keyboard_search_share_summary">When sharing a URL to KeePassDX, filter the entries using that URL domain</string>
<string name="keyboard_search_share_title">Select shared info</string>
<string name="keyboard_search_share_summary">When sharing info to KeePassDX, filter the entries using this info to feed the Magikeyboard</string>
<string name="keyboard_save_search_info_title">Save shared info</string>
<string name="keyboard_save_search_info_summary">After sharing a URL to KeePassDX, when an entry is selected, try to remember that entry for further uses</string>
<string name="keyboard_save_search_info_summary">After sharing info to KeePassDX, when an entry is selected, try saving the info in the entry for easier future uses</string>
<string name="keyboard_notification_entry_clear_close_title">Clear at closing</string>
<string name="keyboard_notification_entry_clear_close_summary">Close the database when closing the notification</string>
<string name="keyboard_entry_timeout_title">Timeout</string>