Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9369c815 authored by Moez Bhatti's avatar Moez Bhatti
Browse files

Check if we have valid initials before determining avatar icon visibility

Credit to @salehsagharchi in https://github.com/moezbhatti/qksms/pull/1622
parent 04725350
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -84,7 +84,6 @@ class AvatarView @JvmOverloads constructor(
        binding.initial.setTextColor(theme.textPrimary)
        binding.icon.setTint(theme.textPrimary)

        if (fullName?.isNotEmpty() == true) {
        val initials = fullName
                ?.substringBefore(',')
                ?.split(" ").orEmpty()
@@ -93,6 +92,7 @@ class AvatarView @JvmOverloads constructor(
                .filter { initial -> initial.isLetterOrDigit() }
                .map { initial -> initial.toString() }

        if (initials.isNotEmpty()) {
            binding.initial.text = if (initials.size > 1) initials.first() + initials.last() else initials.first()
            binding.icon.visibility = GONE
        } else {