I mean ways other than using vectorResource(id = ...) (this confuses me with constant calls to context, resources, and other things).
I ask this because i see that we can make TextStyles, Shapes, Colors and Strings without smthngResource using.
As example iconAccent = Color(context.getColor(R.color.iconAccent))
Edit 1:
I found Bitmap.asImageAsset() method, it doesn't work in my case because vectors, but may be useful for somebody.
Edit 2:
I get the result by this way:
val group = ContextCompat.getDrawable(context, R.drawable.icon_group) as VectorDrawable
DrawableCompat.setTint(group, context.getColor(R.color.foregroundMain))
group = group.toBitmap().asImageBitmap()
DrawableCompat.setTint
needed to correctly paint icons with theme color (we don't need it with vectorResource(id = ...)
because it correctly take colors from fillColor
property)
But it's crutch and if you know any other way - please write it. Believe compose developers will take into consideration this problem.
Yes!
ImageVector.vectorResource(R.drawable.ic_remove_circle)
it doesnt need Context.