Sort all contact names and keep them in up to date list
This commit is contained in:
@ -187,6 +187,7 @@ class AndroidContactsActivity : AppCompatActivity() {
|
||||
for ((_, value) in contacts)
|
||||
if (value.name != "")
|
||||
BaresipService.androidContacts.add(value)
|
||||
Utils.reloadContactNames()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -1440,6 +1440,7 @@ class BaresipService: Service() {
|
||||
val registrationUpdate = MutableLiveData<Long>()
|
||||
val contacts = ArrayList<Contact>()
|
||||
val androidContacts = ArrayList<AndroidContact>()
|
||||
val contactNames = mutableListOf<String>()
|
||||
val chatTexts: MutableMap<String, String> = mutableMapOf()
|
||||
val activities = mutableListOf<String>()
|
||||
var dnsServers = listOf<InetAddress>()
|
||||
|
||||
@ -70,6 +70,7 @@ class Contact(var name: String, var uri: String, var color: Int, val id: Long) {
|
||||
BaresipService.contacts.add(contact)
|
||||
}
|
||||
}
|
||||
Utils.reloadContactNames()
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@ -328,9 +328,15 @@ object Utils {
|
||||
return ContactsActivity.contactUri(name) ?: AndroidContactsActivity.contactUri(name)
|
||||
}
|
||||
|
||||
fun reloadContactNames() {
|
||||
BaresipService.contactNames.clear()
|
||||
BaresipService.contactNames.addAll(Contact.contacts().map{Contact -> Contact.name})
|
||||
BaresipService.contactNames.addAll(AndroidContact.contacts().map{AndroidContact -> AndroidContact.name})
|
||||
BaresipService.contactNames.sort()
|
||||
}
|
||||
|
||||
fun contactNames() : List<String> {
|
||||
return Contact.contacts().map{Contact -> Contact.name} +
|
||||
AndroidContact.contacts().map{AndroidContact -> AndroidContact.name}
|
||||
return BaresipService.contactNames
|
||||
}
|
||||
|
||||
fun setAvatar(ctx: Context, imageView: ImageView, textView: TextView, uri: String) {
|
||||
|
||||
Reference in New Issue
Block a user