From 827be7225bc387f00e22320e88c808d77317ab27 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 12 Apr 2020 10:56:00 +0200 Subject: [PATCH] fill the suggested contacts before the remaining ones --- .../smsmessenger/activities/NewMessageActivity.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewMessageActivity.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewMessageActivity.kt index 58fd422e..e30e6873 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewMessageActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/activities/NewMessageActivity.kt @@ -39,14 +39,15 @@ class NewMessageActivity : SimpleActivity() { return } - getAvailableContacts { - allContacts = it - runOnUiThread { - setupAdapter(allContacts) + fillSuggestedContacts { + getAvailableContacts { + allContacts = it + runOnUiThread { + setupAdapter(allContacts) + } } } - fillSuggestedContacts() new_message_to.onTextChangeListener { val searchString = it val filteredContacts = ArrayList() @@ -89,7 +90,7 @@ class NewMessageActivity : SimpleActivity() { } } - private fun fillSuggestedContacts() { + private fun fillSuggestedContacts(callback: () -> Unit) { ensureBackgroundThread { val suggestions = getSuggestedContacts() runOnUiThread { @@ -107,6 +108,7 @@ class NewMessageActivity : SimpleActivity() { } } } + callback() } } }