WAI
Status Update
Comments
su...@google.com <su...@google.com> #2
We have shared this with our product and engineering team and will update this issue with more information as it becomes available.
lb...@gmail.com <lb...@gmail.com> #3
About the API, it should allow us to find all paths/groups and iterate over them . See them as a collection.
It should also allow to find them by name (and get multiple results if there are multiple with the same name).
It should also allow to find them by name (and get multiple results if there are multiple with the same name).
su...@google.com <su...@google.com> #4
I tried to even use reflection, but it didn't let me reach the children of the root group. When I checked it, the children array is empty for this result:
val drawable =
androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.create(resources, R.drawable.boy, null)!!.mutate()
val vectorStateField = drawable.javaClass.getDeclaredField("mVectorState")
vectorStateField.isAccessible = true
val vectorState = vectorStateField.get(drawable)!!
val vPathRendererField = vectorState.javaClass.getDeclaredField("mVPathRenderer")
vPathRendererField.isAccessible = true
val vPathRenderer = vPathRendererField.get(vectorState)!!
val rootGroupField = vPathRenderer.javaClass.getDeclaredField("mRootGroup")
rootGroupField.isAccessible = true
val rootGroup = rootGroupField.get(vPathRenderer)
//can't go further, as rootGroup seems not to have any children...
val drawable =
androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.create(resources, R.drawable.boy, null)!!.mutate()
val vectorStateField = drawable.javaClass.getDeclaredField("mVectorState")
vectorStateField.isAccessible = true
val vectorState = vectorStateField.get(drawable)!!
val vPathRendererField = vectorState.javaClass.getDeclaredField("mVPathRenderer")
vPathRendererField.isAccessible = true
val vPathRenderer = vPathRendererField.get(vectorState)!!
val rootGroupField = vPathRenderer.javaClass.getDeclaredField("mRootGroup")
rootGroupField.isAccessible = true
val rootGroup = rootGroupField.get(vPathRenderer)
//can't go further, as rootGroup seems not to have any children...
ra...@google.com <ra...@google.com>
vi...@google.com <vi...@google.com> #5
And using reflection on the VectorDrawable is also impossible:
val drawable = resources.getDrawable(R.drawable.boy, null) as VectorDrawable
val vectorState = drawable.constantState!!
val rootGroupField = vectorState.javaClass.getDeclaredField("mRootGroup")
This will cause an exception...
val drawable = resources.getDrawable(R.drawable.boy, null) as VectorDrawable
val vectorState = drawable.constantState!!
val rootGroupField = vectorState.javaClass.getDeclaredField("mRootGroup")
This will cause an exception...
Description
Could be nice to handle clicking on specific parts of the VectorDrawable.
This is after being able to reach the parts, as I've requested here: