avoid showing accent characters at contact image placeholders

This commit is contained in:
tibbi 2020-04-10 22:02:51 +02:00
parent 718afea9d6
commit 0eb161e05a
2 changed files with 7 additions and 1 deletions

View File

@ -463,7 +463,7 @@ fun Context.showReceivedMessageNotification(address: String, body: String, threa
val summaryText = getString(R.string.new_message)
val sender = getNameAndPhotoFromPhoneNumber(address)?.name ?: ""
val largeIcon = bitmap ?: getNotificationLetterIcon(sender.toCharArray().getOrNull(0)?.toString() ?: "S")
val largeIcon = bitmap ?: getNotificationLetterIcon(sender.getNameLetter())
val builder = NotificationCompat.Builder(this, channelId)
.setContentTitle(sender)
.setContentText(body)

View File

@ -0,0 +1,6 @@
package com.simplemobiletools.smsmessenger.extensions
import com.simplemobiletools.commons.extensions.normalizeString
// get the contact names first letter at showing the placeholder without image
fun String.getNameLetter() = normalizeString().toCharArray().getOrNull(0)?.toString() ?: "S"