mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-22 13:05:31 +03:00
Merge pull request #1870 from nextcloud/bugfix/1869/crash-avatar
Workaround for crash when loading avatar
This commit is contained in:
commit
4ee930f9d5
1 changed files with 10 additions and 5 deletions
|
@ -424,12 +424,17 @@ class ChatController(args: Bundle) :
|
|||
if (actionBar != null && bitmap != null && resources != null) {
|
||||
|
||||
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)
|
||||
roundedBitmapDrawable.isCircular = true
|
||||
roundedBitmapDrawable.setAntiAlias(true)
|
||||
actionBar?.setIcon(roundedBitmapDrawable)
|
||||
val roundedBitmapDrawable =
|
||||
RoundedBitmapDrawableFactory.create(resources!!, bitmapResized)
|
||||
roundedBitmapDrawable.isCircular = true
|
||||
roundedBitmapDrawable.setAntiAlias(true)
|
||||
actionBar?.setIcon(roundedBitmapDrawable)
|
||||
} else {
|
||||
Log.d(TAG, "loadAvatarForStatusBar avatarSize <= 0")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue