set the most frequent contact source as the default one
This commit is contained in:
parent
44bd03b98a
commit
ca9b1cc6c4
|
@ -89,6 +89,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
contacts_placeholder_2.setOnClickListener {
|
||||
showFilterDialog()
|
||||
}
|
||||
|
||||
if (!isFirstResume) {
|
||||
initContacts()
|
||||
}
|
||||
|
@ -144,6 +145,11 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
|
||||
private fun initContacts() {
|
||||
ContactsHelper(this).getContacts {
|
||||
if (config.lastUsedContactSource.isEmpty()) {
|
||||
val grouped = it.groupBy { it.source }.maxWith(compareBy { it.value.size })
|
||||
config.lastUsedContactSource = grouped?.key ?: ""
|
||||
}
|
||||
|
||||
Contact.sorting = config.sorting
|
||||
it.sort()
|
||||
|
||||
|
|
Loading…
Reference in New Issue