Minor code improvements

This commit is contained in:
Naveen 2022-06-12 01:31:38 +05:30
parent d72f19810d
commit 95c02be871
1 changed files with 7 additions and 8 deletions

View File

@ -61,15 +61,14 @@ class NewConversationActivity : SimpleActivity() {
} }
fetchContacts() fetchContacts()
new_conversation_address.onTextChangeListener { new_conversation_address.onTextChangeListener { searchString ->
val searchString = it
val filteredContacts = ArrayList<SimpleContact>() val filteredContacts = ArrayList<SimpleContact>()
allContacts.forEach { allContacts.forEach { contact ->
if (it.phoneNumbers.any { it.normalizedNumber.contains(searchString, true) } || if (contact.phoneNumbers.any { it.normalizedNumber.contains(searchString, true) } ||
it.name.contains(searchString, true) || contact.name.contains(searchString, true) ||
it.name.contains(searchString.normalizeString(), true) || contact.name.contains(searchString.normalizeString(), true) ||
it.name.normalizeString().contains(searchString, true)) { contact.name.normalizeString().contains(searchString, true)) {
filteredContacts.add(it) filteredContacts.add(contact)
} }
} }