mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-01-23 04:20:36 +01:00
fixing some glitches
This commit is contained in:
parent
ffb6550744
commit
aa0647ada6
@ -58,7 +58,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
||||
private val PICK_EXPORT_FILE_INTENT = 2
|
||||
|
||||
private var isSearchOpen = false
|
||||
private var searchMenuItem: MenuItem? = null
|
||||
private var mSearchMenuItem: MenuItem? = null
|
||||
private var searchQuery = ""
|
||||
private var werePermissionsHandled = false
|
||||
private var isFirstResume = true
|
||||
@ -126,7 +126,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
||||
}
|
||||
|
||||
setupTabColors()
|
||||
setupToolbar(main_toolbar, searchMenuItem = searchMenuItem)
|
||||
setupToolbar(main_toolbar, searchMenuItem = mSearchMenuItem)
|
||||
|
||||
val configStartNameWithSurname = config.startNameWithSurname
|
||||
if (storedStartNameWithSurname != configStartNameWithSurname) {
|
||||
@ -213,6 +213,14 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
if (isSearchOpen && mSearchMenuItem != null) {
|
||||
mSearchMenuItem!!.collapseActionView()
|
||||
} else {
|
||||
super.onBackPressed()
|
||||
}
|
||||
}
|
||||
|
||||
private fun storeStateVariables() {
|
||||
config.apply {
|
||||
storedShowContactThumbnails = showContactThumbnails
|
||||
@ -225,8 +233,8 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
||||
|
||||
private fun setupSearch(menu: Menu) {
|
||||
val searchManager = getSystemService(Context.SEARCH_SERVICE) as SearchManager
|
||||
searchMenuItem = menu.findItem(R.id.search)
|
||||
(searchMenuItem!!.actionView as SearchView).apply {
|
||||
mSearchMenuItem = menu.findItem(R.id.search)
|
||||
(mSearchMenuItem!!.actionView as SearchView).apply {
|
||||
setSearchableInfo(searchManager.getSearchableInfo(componentName))
|
||||
isSubmitButtonEnabled = false
|
||||
queryHint = getString(getSearchString())
|
||||
@ -243,7 +251,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
||||
})
|
||||
}
|
||||
|
||||
MenuItemCompat.setOnActionExpandListener(searchMenuItem, object : MenuItemCompat.OnActionExpandListener {
|
||||
MenuItemCompat.setOnActionExpandListener(mSearchMenuItem, object : MenuItemCompat.OnActionExpandListener {
|
||||
override fun onMenuItemActionExpand(item: MenuItem?): Boolean {
|
||||
getCurrentFragment()?.onSearchOpened()
|
||||
isSearchOpen = true
|
||||
@ -633,7 +641,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
||||
getAllFragments().forEach {
|
||||
it?.onSearchQueryChanged("")
|
||||
}
|
||||
searchMenuItem?.collapseActionView()
|
||||
mSearchMenuItem?.collapseActionView()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.simplemobiletools.contacts.pro.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
@ -57,11 +56,6 @@ class SettingsActivity : SimpleActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
updateMenuItemColors(menu)
|
||||
return super.onCreateOptionsMenu(menu)
|
||||
}
|
||||
|
||||
private fun setupCustomizeColors() {
|
||||
settings_customize_colors_holder.setOnClickListener {
|
||||
startCustomizationActivity()
|
||||
|
Loading…
Reference in New Issue
Block a user