mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-06-05 21:49:23 +02:00
avoid calling multiple refreshes at app launch
This commit is contained in:
@ -23,7 +23,7 @@ import kotlinx.android.synthetic.main.fragment_recents.*
|
|||||||
class MainActivity : SimpleActivity() {
|
class MainActivity : SimpleActivity() {
|
||||||
private var storedTextColor = 0
|
private var storedTextColor = 0
|
||||||
private var storedPrimaryColor = 0
|
private var storedPrimaryColor = 0
|
||||||
private var wasFragmentInit = false
|
private var isFirstResume = true
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
@ -69,9 +69,11 @@ class MainActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wasFragmentInit) {
|
if (!isFirstResume) {
|
||||||
refreshItems()
|
refreshItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isFirstResume = false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
@ -158,10 +160,6 @@ class MainActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
viewpager.onGlobalLayout {
|
|
||||||
refreshItems()
|
|
||||||
}
|
|
||||||
|
|
||||||
main_tabs_holder.onTabSelectionChanged(
|
main_tabs_holder.onTabSelectionChanged(
|
||||||
tabUnselectedAction = {
|
tabUnselectedAction = {
|
||||||
it.icon?.applyColorFilter(config.textColor)
|
it.icon?.applyColorFilter(config.textColor)
|
||||||
@ -191,8 +189,6 @@ class MainActivity : SimpleActivity() {
|
|||||||
startActivity(this)
|
startActivity(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wasFragmentInit = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getTabIcon(position: Int): Drawable {
|
private fun getTabIcon(position: Int): Drawable {
|
||||||
|
Reference in New Issue
Block a user