From 28401e557741aed60ce4115221cdf27df04d2a81 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 9 Feb 2022 22:15:38 +0100 Subject: [PATCH] close search at opening settings/about --- app/build.gradle | 2 +- .../filemanager/pro/activities/MainActivity.kt | 14 ++++++++++---- build.gradle | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 9d7e8c01..7b296c76 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -63,7 +63,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:4d36cc84e9' + implementation 'com.github.SimpleMobileTools:Simple-Commons:f84b3a7e61' implementation 'com.github.Stericson:RootTools:df729dcb13' implementation 'com.github.Stericson:RootShell:1.6' implementation 'com.alexvasilkov:gesture-views:2.5.2' 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 3868289f..fd7d2d03 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 @@ -411,10 +411,7 @@ class MainActivity : SimpleActivity() { main_view_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { override fun onPageScrollStateChanged(state: Int) { - if (isSearchOpen) { - (getCurrentFragment() as? ItemOperationsListener)?.searchQueryChanged("") - searchMenuItem?.collapseActionView() - } + closeSearchIfOpen() } override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {} @@ -493,6 +490,13 @@ class MainActivity : SimpleActivity() { } } + private fun closeSearchIfOpen() { + if (isSearchOpen) { + (getCurrentFragment() as? ItemOperationsListener)?.searchQueryChanged("") + searchMenuItem?.collapseActionView() + } + } + private fun openPath(path: String, forceRefresh: Boolean = false) { if (mIsPasswordProtectionPending && !mWasProtectionHandled) { return @@ -599,11 +603,13 @@ class MainActivity : SimpleActivity() { } private fun launchSettings() { + closeSearchIfOpen() hideKeyboard() startActivity(Intent(applicationContext, SettingsActivity::class.java)) } private fun launchAbout() { + closeSearchIfOpen() val licenses = LICENSE_GLIDE or LICENSE_PATTERN or LICENSE_REPRINT or LICENSE_GESTURE_VIEWS val faqItems = arrayListOf( diff --git a/build.gradle b/build.gradle index 87eca93f..eee3813c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.6.0' + ext.kotlin_version = '1.6.10' repositories { google()