I'm writing (for the first time) an Android library (with its own Activities) that will be imported in other Android projects using Android aar package.
My goal would be to publish only one class (let's call it MyPlugin
) that does all the stuff (calling activities etc.) offering public methods; but it seems, to me, that all Activities must be public
; so I would like to separate classes the user wants to use from classes i don't want to be used. Something like:
com.mycompany.myplugin.api
|--> MyPlugin (public class with public methods)
com.mycompany.myplugin.activities
|--> Acitivty1
|--> ....
|--> ActivityN (public? activities)
com.mycompany.myplugin.mystuff
|--> Services (protected? class with protected? methods)
With this design I could say to the user "You should use only api package".
The problem is the Serivice class: it's used by Activities and MyPlugin, and it should be in the same package if I want it (or its methods) to be protected
(so the final user can't see it).
I know that with reflection the final user could do anything but I want to be as clean and simple as possible.
The only solution I found is to have just one package with all the classes, but, as I said, I would like to separate MyPlugin
from Activities.