From bce66e3cdef9ad3370f730dae546c0d62b8cf3f0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 7 Jan 2023 21:06:32 +0100 Subject: [PATCH] do not trim searched text on main tab --- .../filemanager/pro/fragments/ItemsFragment.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt index 960a6c1d..140f563a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt @@ -295,22 +295,21 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF } override fun searchQueryChanged(text: String) { - val searchText = text.trim() - lastSearchedText = searchText + lastSearchedText = text if (context == null) { return } items_swipe_refresh.isEnabled = text.isEmpty() && activity?.config?.enablePullToRefresh != false when { - searchText.isEmpty() -> { + text.isEmpty() -> { items_fastscroller.beVisible() getRecyclerAdapter()?.updateItems(itemsIgnoringSearch) items_placeholder.beGone() items_placeholder_2.beGone() hideProgressBar() } - searchText.length == 1 -> { + text.length == 1 -> { items_fastscroller.beGone() items_placeholder.beVisible() items_placeholder_2.beVisible() @@ -319,10 +318,10 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF else -> { showProgressBar() ensureBackgroundThread { - val files = searchFiles(searchText, currentPath) + val files = searchFiles(text, currentPath) files.sortBy { it.getParentPath() } - if (lastSearchedText != searchText) { + if (lastSearchedText != text) { return@ensureBackgroundThread }