mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-26 06:55:42 +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) {
|
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")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue