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 {
|
contacts_placeholder_2.setOnClickListener {
|
||||||
showFilterDialog()
|
showFilterDialog()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isFirstResume) {
|
if (!isFirstResume) {
|
||||||
initContacts()
|
initContacts()
|
||||||
}
|
}
|
||||||
|
@ -144,6 +145,11 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||||
|
|
||||||
private fun initContacts() {
|
private fun initContacts() {
|
||||||
ContactsHelper(this).getContacts {
|
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
|
Contact.sorting = config.sorting
|
||||||
it.sort()
|
it.sort()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue