I have not developed Android for a while and I am trying to do things right with the new features as the Gradle dependencies.
I am wondering what are the best practices when you need to modify one particular dependency for suiting you needs.
For example, let's say we have two libraries that extend the RecyclerView functionality by subclassing the Adapter:
Adapter --> AdapterA
Adapter --> AdapterB
Since Java does not support multiple inheritances, I guess the only way to make both libraries work together would consist on modifying one of them so the subclassing hierarchy looks like this:
Adapter --> AdapterA --> AdapterB
If I am correct and this is the way to go, what would then be the best way of modifying and integrating the library, here are the options I can think of:
Please justify or suggest what is better and if there are any other alternatives to achieve this.
I say just make a local module which depends on the other library and modify that. Don't forget to record which changes you've made. Ideally, you import the module as a separate commit in the VCS, and then you modify it in another commit.
This has the advantage that if you want to update the library, it will be fairly easy to do since all you have to do is copy over the source for the new version and then make the same modifications. However, if you take the other approach, then you'd also have to push all the changes to GitHub, which adds complexity, but little benefit unless you want to share your modifications with someone else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With