I'm aware you cannot actually Swizzle in Java.
I was doing some research and I think 'maybe' you can do Reflection in Java to accomplish Swizzle like behaviour (that you can do on iOS).
The culprit (and one of the worst design decisions I've ever seen) is the addView()
function on all Android ViewGroup objects. You must explicitly check if the parent is null (you sometimes even need to cast the parent to get the behaviour you need!). Gross.
I want to change the behaviour of this (without creating a million subclasses) by having the addView()
method do this check automatically so the client code can ignore this.
Is this something I can do with Reflection (from what I grasp it would require special runtime calling, instead of actually changing the root method call [so maybe not good enough]), or something else? Or am I barking up the wrong tree?
Aucun commentaire:
Enregistrer un commentaire