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)
|
icon.setTint(theme.textPrimary)
|
||||||
|
|
||||||
if (name?.isNotEmpty() == true) {
|
if (name?.isNotEmpty() == true) {
|
||||||
val initials = name?.split(" ").orEmpty()
|
val initials = name
|
||||||
.filter { name -> name.isNotEmpty() }
|
?.substringBefore(',')
|
||||||
.map { name -> name[0].toString() }
|
?.split(" ").orEmpty()
|
||||||
|
.filter { subname -> subname.isNotEmpty() }
|
||||||
|
.map { subname -> subname[0].toString() }
|
||||||
|
|
||||||
initial.text = if (initials.size > 1) initials.first() + initials.last() else initials.first()
|
initial.text = if (initials.size > 1) initials.first() + initials.last() else initials.first()
|
||||||
icon.visibility = GONE
|
icon.visibility = GONE
|
||||||
|
|||||||
Reference in New Issue
Block a user