Skip to content

Commit df00f52

Browse files
Merge pull request #1889 from Infomaniak/mutable-parameter
Remove mutable parameter.
2 parents 16cd037 + 5fa2e68 commit df00f52

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

app/src/main/java/com/infomaniak/mail/ui/newMessage/ContactAdapter.kt

+6-9
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ContactAdapter(
4343
) : Adapter<ContactViewHolder>() {
4444

4545
private var allContacts: List<MergedContact> = emptyList()
46-
private var matchedContacts = mutableListOf<MatchedContact>()
46+
private var matchedContacts = listOf<MatchedContact>()
4747

4848
private var displayAddUnknownContactButton = true
4949
private var searchQuery = ""
@@ -99,12 +99,13 @@ class ContactAdapter(
9999
}
100100

101101
fun clear() {
102-
matchedContacts.clear()
102+
matchedContacts = listOf()
103103
notifyDataSetChanged()
104104
}
105105

106106
fun searchContacts(text: CharSequence) {
107-
fun performFiltering(constraint: CharSequence): MutableList<MatchedContact> {
107+
108+
fun performFiltering(constraint: CharSequence): List<MatchedContact> {
108109
val searchTerm = constraint.standardize()
109110

110111
val finalUserList = mutableListOf<MatchedContact>()
@@ -126,13 +127,9 @@ class ContactAdapter(
126127
return finalUserList
127128
}
128129

129-
fun publishResults(results: MutableList<MatchedContact>) {
130-
matchedContacts = results
131-
notifyDataSetChanged()
132-
}
133-
134130
searchQuery = text.toString()
135-
publishResults(performFiltering(text))
131+
matchedContacts = performFiltering(text)
132+
notifyDataSetChanged()
136133
}
137134

138135
fun removeUsedEmail(email: String): Boolean {

0 commit comments

Comments
 (0)