Use createWithAdaptiveBitmap instead of createWithBitmap to prevent crash on some devices
This commit is contained in:
parent
bd3fb48442
commit
0c4b4d6e3c
3 changed files with 3 additions and 3 deletions
|
@ -151,7 +151,7 @@ open class Contact : Comparable<Contact> {
|
||||||
if (bm == null) IconCompat.createWithResource(
|
if (bm == null) IconCompat.createWithResource(
|
||||||
coreContext.context,
|
coreContext.context,
|
||||||
R.drawable.avatar
|
R.drawable.avatar
|
||||||
) else IconCompat.createWithBitmap(bm)
|
) else IconCompat.createWithAdaptiveBitmap(bm)
|
||||||
if (icon != null) {
|
if (icon != null) {
|
||||||
personBuilder.setIcon(icon)
|
personBuilder.setIcon(icon)
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ class NativeContact(val nativeId: String, private val lookupKey: String? = null)
|
||||||
if (bm == null) IconCompat.createWithResource(
|
if (bm == null) IconCompat.createWithResource(
|
||||||
coreContext.context,
|
coreContext.context,
|
||||||
R.drawable.avatar
|
R.drawable.avatar
|
||||||
) else IconCompat.createWithBitmap(bm)
|
) else IconCompat.createWithAdaptiveBitmap(bm)
|
||||||
if (icon != null) {
|
if (icon != null) {
|
||||||
personBuilder.setIcon(icon)
|
personBuilder.setIcon(icon)
|
||||||
}
|
}
|
||||||
|
|
|
@ -378,7 +378,7 @@ class NotificationsManager(private val context: Context) {
|
||||||
val builder = Person.Builder().setName(displayName)
|
val builder = Person.Builder().setName(displayName)
|
||||||
val userIcon =
|
val userIcon =
|
||||||
if (picture != null) {
|
if (picture != null) {
|
||||||
IconCompat.createWithBitmap(picture)
|
IconCompat.createWithAdaptiveBitmap(picture)
|
||||||
} else {
|
} else {
|
||||||
IconCompat.createWithResource(context, R.drawable.avatar)
|
IconCompat.createWithResource(context, R.drawable.avatar)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue