use the letter fastscroller at SelectContact activity and dialog

This commit is contained in:
tibbi
2021-11-17 10:47:21 +01:00
parent 390084a719
commit e436073156
6 changed files with 126 additions and 70 deletions

View File

@ -243,14 +243,15 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
}
private fun setupLetterFastscroller(contacts: ArrayList<Contact>) {
val sorting = context.config.sorting
letter_fastscroller.setupWithRecyclerView(fragment_list, { position ->
try {
val contact = contacts[position]
var name = when {
contact.isABusinessContact() -> contact.getFullCompany()
context.config.sorting and SORT_BY_SURNAME != 0 && contact.surname.isNotEmpty() -> contact.surname
context.config.sorting and SORT_BY_MIDDLE_NAME != 0 && contact.middleName.isNotEmpty() -> contact.middleName
context.config.sorting and SORT_BY_FIRST_NAME != 0 && contact.firstName.isNotEmpty() -> contact.firstName
sorting and SORT_BY_SURNAME != 0 && contact.surname.isNotEmpty() -> contact.surname
sorting and SORT_BY_MIDDLE_NAME != 0 && contact.middleName.isNotEmpty() -> contact.middleName
sorting and SORT_BY_FIRST_NAME != 0 && contact.firstName.isNotEmpty() -> contact.firstName
context.config.startNameWithSurname -> contact.surname
else -> contact.firstName
}