Use createWithAdaptiveBitmap instead of createWithBitmap to prevent crash on some devices

This commit is contained in:
Sylvain Berfini 2021-11-15 12:02:19 +01:00
parent bd3fb48442
commit 0c4b4d6e3c
3 changed files with 3 additions and 3 deletions

View file

@ -151,7 +151,7 @@ open class Contact : Comparable<Contact> {
if (bm == null) IconCompat.createWithResource(
coreContext.context,
R.drawable.avatar
) else IconCompat.createWithBitmap(bm)
) else IconCompat.createWithAdaptiveBitmap(bm)
if (icon != null) {
personBuilder.setIcon(icon)
}

View file

@ -71,7 +71,7 @@ class NativeContact(val nativeId: String, private val lookupKey: String? = null)
if (bm == null) IconCompat.createWithResource(
coreContext.context,
R.drawable.avatar
) else IconCompat.createWithBitmap(bm)
) else IconCompat.createWithAdaptiveBitmap(bm)
if (icon != null) {
personBuilder.setIcon(icon)
}

View file

@ -378,7 +378,7 @@ class NotificationsManager(private val context: Context) {
val builder = Person.Builder().setName(displayName)
val userIcon =
if (picture != null) {
IconCompat.createWithBitmap(picture)
IconCompat.createWithAdaptiveBitmap(picture)
} else {
IconCompat.createWithResource(context, R.drawable.avatar)
}