Class HeadModule

  • All Implemented Interfaces:

    
    public abstract class HeadModule
    
                        

    Main class to crate a Module for Hydra

    Don't modify this code, the main app and the module need to have exactly the same library implementation in order to work, in the same way you can only implement an specific list of libraries, the main app needs to have a copy of that library in order to work.

    TODO: Add compatible libraries list

    The modules are limited in the permission they can declare, if the main app detects any other permission besides those, the module will be ignored, the admitted permissions are:

    • android.permission.INTERNET

    • android.permission.ACCESS_WIFI_STATE

    To create a module you need to create a new Application project, once created you need to create a class named Module that extends HeadModule, because the core is based in abstract implementation the minimum required functions needs to be overridden, the other overridable functions are optional (i.e., the main app will try to use the functions, but if the module doesn't implement them or any of them fail/crash it will adapt the UI to hide the related elements).

    The name of the application doesn't need any requirements, but it can be a little descriptive for the users (e.g., Hydra Module: My module name) in case of a manual uninstall, the app won't use this name internally, instead it will use the name provided in the moduleName implementation.

    <b>Sample usage</b>

    class Module: HeadModule() {
         override val moduleVersionCode: Int = BuildConfig.VERSION_CODE
         override val moduleVersionName: String = BuildConfig.VERSION_NAME
         override val baseUrl: String = "https://empty.com"
         override val moduleName: String = "Test Module"
         override val dataRepository: HeadRepository = Repository()
         override val config: HeadConfig = TestConfig()
     }