close search at opening settings/about

This commit is contained in:
tibbi 2022-02-09 22:15:38 +01:00
parent dfb87a840a
commit 28401e5577
3 changed files with 12 additions and 6 deletions

View File

@ -63,7 +63,7 @@ android {
} }
dependencies { 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:RootTools:df729dcb13'
implementation 'com.github.Stericson:RootShell:1.6' implementation 'com.github.Stericson:RootShell:1.6'
implementation 'com.alexvasilkov:gesture-views:2.5.2' implementation 'com.alexvasilkov:gesture-views:2.5.2'

View File

@ -411,10 +411,7 @@ class MainActivity : SimpleActivity() {
main_view_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { main_view_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrollStateChanged(state: Int) { override fun onPageScrollStateChanged(state: Int) {
if (isSearchOpen) { closeSearchIfOpen()
(getCurrentFragment() as? ItemOperationsListener)?.searchQueryChanged("")
searchMenuItem?.collapseActionView()
}
} }
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {} 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) { private fun openPath(path: String, forceRefresh: Boolean = false) {
if (mIsPasswordProtectionPending && !mWasProtectionHandled) { if (mIsPasswordProtectionPending && !mWasProtectionHandled) {
return return
@ -599,11 +603,13 @@ class MainActivity : SimpleActivity() {
} }
private fun launchSettings() { private fun launchSettings() {
closeSearchIfOpen()
hideKeyboard() hideKeyboard()
startActivity(Intent(applicationContext, SettingsActivity::class.java)) startActivity(Intent(applicationContext, SettingsActivity::class.java))
} }
private fun launchAbout() { private fun launchAbout() {
closeSearchIfOpen()
val licenses = LICENSE_GLIDE or LICENSE_PATTERN or LICENSE_REPRINT or LICENSE_GESTURE_VIEWS val licenses = LICENSE_GLIDE or LICENSE_PATTERN or LICENSE_REPRINT or LICENSE_GESTURE_VIEWS
val faqItems = arrayListOf( val faqItems = arrayListOf(

View File

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.6.0' ext.kotlin_version = '1.6.10'
repositories { repositories {
google() google()