Fixed crash in AppUtils.getInitials
This commit is contained in:
parent
ffbc209c69
commit
e19ab356d4
1 changed files with 7 additions and 4 deletions
|
@ -97,11 +97,14 @@ class AppUtils {
|
||||||
if (displayName.isEmpty()) return ""
|
if (displayName.isEmpty()) return ""
|
||||||
|
|
||||||
val split = displayName.toUpperCase(Locale.getDefault()).split(" ")
|
val split = displayName.toUpperCase(Locale.getDefault()).split(" ")
|
||||||
return when (split.size) {
|
var initials = ""
|
||||||
0 -> ""
|
for (i in split.indices) {
|
||||||
1 -> split[0][0].toString()
|
if (split[i].isNotEmpty()) {
|
||||||
else -> split[0][0].toString() + split[1][0].toString()
|
initials += split[i][0]
|
||||||
|
if (initials.length >= 2) break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return initials
|
||||||
}
|
}
|
||||||
|
|
||||||
fun pixelsToDp(pixels: Float): Float {
|
fun pixelsToDp(pixels: Float): Float {
|
||||||
|
|
Loading…
Reference in a new issue