Duplicate drawable before drawing it for folder drawable

This fixes #130 - the issue with smaller icons in drawer
This commit is contained in:
Ensar Sarajčić 2023-09-21 13:41:24 +02:00
parent d9a9c70be8
commit e70a476198
1 changed files with 3 additions and 2 deletions

View File

@ -1525,8 +1525,9 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
val (row, column) = getItemPosition(it)
val drawableX = (scaledGap + column * scaledIconSize + column * scaledGap).toInt()
val drawableY = (extraYMargin + scaledGap + row * scaledIconSize + row * scaledGap).toInt()
it.drawable?.setBounds(drawableX, drawableY, drawableX + scaledIconSize.toInt(), drawableY + scaledIconSize.toInt())
it.drawable?.draw(canvas)
val newDrawable = it.drawable?.constantState?.newDrawable()?.mutate()
newDrawable?.setBounds(drawableX, drawableY, drawableX + scaledIconSize.toInt(), drawableY + scaledIconSize.toInt())
newDrawable?.draw(canvas)
}
canvas.drawPath(circlePath, folderIconBorderPaint)
return BitmapDrawable(resources, bitmap)