properly refresh contacts when thumbnail visibility changes
This commit is contained in:
parent
fac521babd
commit
7bf74e9e70
|
@ -77,14 +77,15 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||
return
|
||||
}
|
||||
|
||||
if (storedShowContactThumbnails != config.showContactThumbnails) {
|
||||
if (storedShowPhoneNumbers != config.showPhoneNumbers) {
|
||||
restartActivity()
|
||||
return
|
||||
}
|
||||
|
||||
if (storedShowPhoneNumbers != config.showPhoneNumbers) {
|
||||
restartActivity()
|
||||
return
|
||||
val configShowContactThumbnails = config.showContactThumbnails
|
||||
if (storedShowContactThumbnails != configShowContactThumbnails) {
|
||||
contacts_fragment.showContactThumbnailsChanged(configShowContactThumbnails)
|
||||
favorites_fragment.showContactThumbnailsChanged(configShowContactThumbnails)
|
||||
}
|
||||
|
||||
val configTextColor = config.textColor
|
||||
|
|
|
@ -24,7 +24,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||
protected var activity: MainActivity? = null
|
||||
private var lastHashCode = 0
|
||||
private var contactsIgnoringSearch = ArrayList<Contact>()
|
||||
lateinit private var config: Config
|
||||
private lateinit var config: Config
|
||||
|
||||
var forceListRedraw = false
|
||||
|
||||
|
@ -144,11 +144,19 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||
(currAdapter as ContactsAdapter).apply {
|
||||
startNameWithSurname = config.startNameWithSurname
|
||||
showPhoneNumbers = config.showPhoneNumbers
|
||||
showContactThumbnails = config.showContactThumbnails
|
||||
updateItems(contacts)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun showContactThumbnailsChanged(showThumbnails: Boolean) {
|
||||
(fragment_list.adapter as? ContactsAdapter)?.apply {
|
||||
showContactThumbnails = showThumbnails
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
fun onActivityResume() {
|
||||
updateViewStuff()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue