From 1652040c1cf9fe447441ff94c65ca3793e1d6a45 Mon Sep 17 00:00:00 2001 From: Tamim Hossain <132823494+CodeWithTamim@users.noreply.github.com> Date: Sat, 10 Aug 2024 17:51:45 +0600 Subject: [PATCH] Simplify search logic using SearchView (#3459) Refactor the search functionality to use SearchView for better handling of search queries. - Removed redundant code and replaced it with SearchView's onQueryTextChange listener. - Improved readability and maintainability of the search logic. --- .../src/main/kotlin/com/v2ray/ang/ui/PerAppProxyActivity.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/PerAppProxyActivity.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/PerAppProxyActivity.kt index 1e2419bb..d3e372fe 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/PerAppProxyActivity.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/PerAppProxyActivity.kt @@ -188,12 +188,10 @@ class PerAppProxyActivity : BaseActivity() { if (searchItem != null) { val searchView = searchItem.actionView as SearchView searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener { - override fun onQueryTextSubmit(query: String?): Boolean { - return false - } + override fun onQueryTextSubmit(query: String?): Boolean = false override fun onQueryTextChange(newText: String?): Boolean { - filterProxyApp(newText?:"") + filterProxyApp(newText.orEmpty()) return false } })