Merge pull request #1870 from nextcloud/bugfix/1869/crash-avatar

Workaround for crash when loading avatar
This commit is contained in:
Tim Krueger 2022-03-15 14:02:31 +01:00 committed by GitHub
commit 4ee930f9d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -424,12 +424,17 @@ class ChatController(args: Bundle) :
if (actionBar != null && bitmap != null && resources != null) { if (actionBar != null && bitmap != null && resources != null) {
val avatarSize = (actionBar?.height!! / 1.5).roundToInt() val avatarSize = (actionBar?.height!! / 1.5).roundToInt()
val bitmapResized = Bitmap.createScaledBitmap(bitmap, avatarSize, avatarSize, false) if (avatarSize > 0) {
val bitmapResized = Bitmap.createScaledBitmap(bitmap, avatarSize, avatarSize, false)
val roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(resources!!, bitmapResized) val roundedBitmapDrawable =
roundedBitmapDrawable.isCircular = true RoundedBitmapDrawableFactory.create(resources!!, bitmapResized)
roundedBitmapDrawable.setAntiAlias(true) roundedBitmapDrawable.isCircular = true
actionBar?.setIcon(roundedBitmapDrawable) roundedBitmapDrawable.setAntiAlias(true)
actionBar?.setIcon(roundedBitmapDrawable)
} else {
Log.d(TAG, "loadAvatarForStatusBar avatarSize <= 0")
}
} }
} }