Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2818e466 authored by Nathan's avatar Nathan
Browse files

fix: improve fallback bitmap creation in AccountImageModelLoader fix bug...

fix: improve fallback bitmap creation in AccountImageModelLoader fix bug e/backlog#8834
parent 97fa6df5
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -67,7 +67,11 @@ internal class AccountImageDataFetcher(
    }

    private fun createFallbackBitmap(): Bitmap {
        return accountFallbackImageProvider.getDrawable(accountImage.email, accountImage.color, accountImage.tag).toBitmap()
        val drawable = accountFallbackImageProvider.getDrawable(accountImage.email, accountImage.color, accountImage.tag)
        val width = drawable.intrinsicWidth.takeIf { it > 0 } ?: 168
        val height = drawable.intrinsicHeight.takeIf { it > 0 } ?: 168
        drawable.setBounds(0, 0, width, height)
        return drawable.toBitmap(width, height)
    }

    override fun getDataClass() = Bitmap::class.java