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()
new_conversation_address.onTextChangeListener {
val searchString = it
new_conversation_address.onTextChangeListener { searchString ->
val filteredContacts = ArrayList<SimpleContact>()
allContacts.forEach {
if (it.phoneNumbers.any { it.normalizedNumber.contains(searchString, true) } ||
it.name.contains(searchString, true) ||
it.name.contains(searchString.normalizeString(), true) ||
it.name.normalizeString().contains(searchString, true)) {
filteredContacts.add(it)
allContacts.forEach { contact ->
if (contact.phoneNumbers.any { it.normalizedNumber.contains(searchString, true) } ||
contact.name.contains(searchString, true) ||
contact.name.contains(searchString.normalizeString(), true) ||
contact.name.normalizeString().contains(searchString, true)) {
filteredContacts.add(contact)
}
}