make sure we use the proper letter at the contact colored avatar

This commit is contained in:
tibbi
2020-04-16 12:36:33 +02:00
parent 0ad5874c5d
commit 93b7ef3343
3 changed files with 22 additions and 17 deletions

View File

@ -242,17 +242,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
private fun setupLetterFastscroller(contacts: ArrayList<Contact>) {
letter_fastscroller.setupWithRecyclerView(fragment_list, { position ->
try {
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
}
val name = contacts[position].getAvatarLetterName(context)
var character = if (name.isNotEmpty()) name.substring(0, 1) else ""
if (!character.areLettersOnly()) {
character = "#"