mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-03-12 09:10:17 +01:00
fixing some glitches
This commit is contained in:
parent
ffb6550744
commit
aa0647ada6
app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities
@ -58,7 +58,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||||||
private val PICK_EXPORT_FILE_INTENT = 2
|
private val PICK_EXPORT_FILE_INTENT = 2
|
||||||
|
|
||||||
private var isSearchOpen = false
|
private var isSearchOpen = false
|
||||||
private var searchMenuItem: MenuItem? = null
|
private var mSearchMenuItem: MenuItem? = null
|
||||||
private var searchQuery = ""
|
private var searchQuery = ""
|
||||||
private var werePermissionsHandled = false
|
private var werePermissionsHandled = false
|
||||||
private var isFirstResume = true
|
private var isFirstResume = true
|
||||||
@ -126,7 +126,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setupTabColors()
|
setupTabColors()
|
||||||
setupToolbar(main_toolbar, searchMenuItem = searchMenuItem)
|
setupToolbar(main_toolbar, searchMenuItem = mSearchMenuItem)
|
||||||
|
|
||||||
val configStartNameWithSurname = config.startNameWithSurname
|
val configStartNameWithSurname = config.startNameWithSurname
|
||||||
if (storedStartNameWithSurname != configStartNameWithSurname) {
|
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() {
|
private fun storeStateVariables() {
|
||||||
config.apply {
|
config.apply {
|
||||||
storedShowContactThumbnails = showContactThumbnails
|
storedShowContactThumbnails = showContactThumbnails
|
||||||
@ -225,8 +233,8 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||||||
|
|
||||||
private fun setupSearch(menu: Menu) {
|
private fun setupSearch(menu: Menu) {
|
||||||
val searchManager = getSystemService(Context.SEARCH_SERVICE) as SearchManager
|
val searchManager = getSystemService(Context.SEARCH_SERVICE) as SearchManager
|
||||||
searchMenuItem = menu.findItem(R.id.search)
|
mSearchMenuItem = menu.findItem(R.id.search)
|
||||||
(searchMenuItem!!.actionView as SearchView).apply {
|
(mSearchMenuItem!!.actionView as SearchView).apply {
|
||||||
setSearchableInfo(searchManager.getSearchableInfo(componentName))
|
setSearchableInfo(searchManager.getSearchableInfo(componentName))
|
||||||
isSubmitButtonEnabled = false
|
isSubmitButtonEnabled = false
|
||||||
queryHint = getString(getSearchString())
|
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 {
|
override fun onMenuItemActionExpand(item: MenuItem?): Boolean {
|
||||||
getCurrentFragment()?.onSearchOpened()
|
getCurrentFragment()?.onSearchOpened()
|
||||||
isSearchOpen = true
|
isSearchOpen = true
|
||||||
@ -633,7 +641,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||||||
getAllFragments().forEach {
|
getAllFragments().forEach {
|
||||||
it?.onSearchQueryChanged("")
|
it?.onSearchQueryChanged("")
|
||||||
}
|
}
|
||||||
searchMenuItem?.collapseActionView()
|
mSearchMenuItem?.collapseActionView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.simplemobiletools.contacts.pro.activities
|
package com.simplemobiletools.contacts.pro.activities
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.Menu
|
|
||||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.*
|
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() {
|
private fun setupCustomizeColors() {
|
||||||
settings_customize_colors_holder.setOnClickListener {
|
settings_customize_colors_holder.setOnClickListener {
|
||||||
startCustomizationActivity()
|
startCustomizationActivity()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user