mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-02-03 01:07:37 +01:00
redraw the contacts list after changing the filters
This commit is contained in:
parent
135240564f
commit
bd13b59e36
@ -249,6 +249,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
||||
|
||||
fun showFilterDialog() {
|
||||
FilterContactSourcesDialog(this) {
|
||||
contacts_fragment.forceListRedraw = true
|
||||
contacts_fragment.initContacts()
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,8 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
||||
private var contactsIgnoringSearch = ArrayList<Contact>()
|
||||
lateinit private var config: Config
|
||||
|
||||
var forceListRedraw = false
|
||||
|
||||
fun setupFragment(activity: MainActivity) {
|
||||
config = activity.config
|
||||
if (this.activity == null) {
|
||||
@ -114,7 +116,8 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
||||
fragment_list.beVisibleIf(contacts.isNotEmpty())
|
||||
|
||||
val currAdapter = fragment_list.adapter
|
||||
if (currAdapter == null) {
|
||||
if (currAdapter == null || forceListRedraw) {
|
||||
forceListRedraw = false
|
||||
ContactsAdapter(activity as SimpleActivity, contacts, activity, this is FavoritesFragment, fragment_list, fragment_fastscroller) {
|
||||
if (config.callContact) {
|
||||
val contact = it as Contact
|
||||
@ -132,6 +135,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
||||
fragment_list.adapter = this
|
||||
}
|
||||
|
||||
fragment_fastscroller.setScrollTo(0)
|
||||
fragment_fastscroller.setViews(fragment_list) {
|
||||
val item = (fragment_list.adapter as ContactsAdapter).contactItems.getOrNull(it)
|
||||
fragment_fastscroller.updateBubbleText(item?.getBubbleText() ?: "")
|
||||
|
Loading…
x
Reference in New Issue
Block a user