fix #505, be smarter at getting the letters at fastscroller

This commit is contained in:
tibbi 2020-04-15 16:40:00 +02:00
parent 0bbfde9b82
commit f0f9bbbb20
1 changed files with 11 additions and 1 deletions

View File

@ -243,7 +243,17 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
private fun setupLetterFastscroller(contacts: ArrayList<Contact>) {
letter_fastscroller.setupWithRecyclerView(fragment_list, { position ->
try {
val name = contacts[position].getNameToDisplay()
val contact = contacts[position]
var name = when {
contact.isABusinessContact() -> contact.getFullCompany()
config.startNameWithSurname -> contact.surname
else -> contact.firstName
}
if (name.isEmpty() && contact.emails.isNotEmpty()) {
name = contact.emails.first().value
}
var character = if (name.isNotEmpty()) name.substring(0, 1) else ""
if (!character.areLettersOnly()) {
character = "#"