ViewPump
ViewPump copied to clipboard
Multiple `ViewPump` instances
From what I gathered from the doc and source code, currently we call only call ViewPump.init once, and have only one configuration
If we want to add some new interceptors later, we have to call init again after getting currently installed interceptors, and add them in the new config
It also means that having an activity specific configuration while maintaining an app wide configuration is possible but complicated
In my case, I have an app-wide configuration, and for one activity, I have to override a specific widget with my own version
- One solution could be to add a
ViewPumpparameter to theViewPumpContextWrapper#wrapmethod, and then inject theViewPumpinstance intoViewPumpLayoutInflater, and by default make it useViewPump.get() - This change would also mean that the resolution would be eager, and thus after creating the wrapped context, changes to
ViewPumpwouldn't affect it anymore. An easy solution would be to inject null in theViewPumpLayoutInflater, and when creating a view, if the instance is null, fallback toViewPump.get()as before. This would prevent any behavior changes
This is not something that we are looking to support
For anyone with the same use-case, one other alternative is to code an interceptor that would do nothing when the current context is not an instance of the wanted activity (unwrapping ContextWrapper, ...).
I'll post the snippet when I'll have time to code it