diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt index a61dec86..b3a58c17 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt @@ -199,10 +199,6 @@ class MainActivity : SimpleActivity() { main_menu.toggleHideOnScroll(false) main_menu.setupMenu() - main_menu.onSearchOpenListener = { - (getCurrentFragment() as? ItemsFragment)?.searchOpened() - } - main_menu.onSearchClosedListener = { getAllFragments().forEach { it?.searchQueryChanged("") 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 140f563a..16a70d30 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 @@ -30,8 +30,6 @@ import java.io.File class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet), ItemOperationsListener, Breadcrumbs.BreadcrumbsListener { private var showHidden = false - private var skipItemUpdating = false - private var isSearchOpen = false private var lastSearchedText = "" private var scrollStates = HashMap() private var zoomListener: MyRecyclerView.MyZoomListener? = null @@ -134,7 +132,6 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF } private fun addItems(items: ArrayList, forceRefresh: Boolean = false) { - skipItemUpdating = false activity?.runOnUiThread { items_swipe_refresh?.isRefreshing = false breadcrumbs.setBreadcrumb(currentPath) @@ -173,7 +170,6 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF @SuppressLint("NewApi") private fun getItems(path: String, callback: (originalPath: String, items: ArrayList) -> Unit) { - skipItemUpdating = false ensureBackgroundThread { if (activity?.isDestroyed == false && activity?.isFinishing == false) { val config = context!!.config @@ -288,7 +284,6 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF private fun openDirectory(path: String) { (activity as? MainActivity)?.apply { - skipItemUpdating = isSearchOpen openedDirectory() } openPath(path) @@ -394,20 +389,8 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF return files } - fun searchOpened() { - isSearchOpen = true + private fun searchClosed() { lastSearchedText = "" - } - - fun searchClosed() { - isSearchOpen = false - if (!skipItemUpdating) { - getRecyclerAdapter()?.updateItems(storedItems) - } - - skipItemUpdating = false - lastSearchedText = "" - items_swipe_refresh.isEnabled = activity?.config?.enablePullToRefresh != false items_fastscroller.beVisible() items_placeholder.beGone()