fix #505, be smarter at getting the letters at fastscroller
This commit is contained in:
parent
0bbfde9b82
commit
f0f9bbbb20
|
@ -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 = "#"
|
||||
|
|
Loading…
Reference in New Issue