forked from upstream-mirrors/quik
For avatar initials, strip off any names after a comma
This commit is contained in:
@@ -85,9 +85,11 @@ class AvatarView @JvmOverloads constructor(
|
||||
icon.setTint(theme.textPrimary)
|
||||
|
||||
if (name?.isNotEmpty() == true) {
|
||||
val initials = name?.split(" ").orEmpty()
|
||||
.filter { name -> name.isNotEmpty() }
|
||||
.map { name -> name[0].toString() }
|
||||
val initials = name
|
||||
?.substringBefore(',')
|
||||
?.split(" ").orEmpty()
|
||||
.filter { subname -> subname.isNotEmpty() }
|
||||
.map { subname -> subname[0].toString() }
|
||||
|
||||
initial.text = if (initials.size > 1) initials.first() + initials.last() else initials.first()
|
||||
icon.visibility = GONE
|
||||
|
||||
Reference in New Issue
Block a user